> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.joincandidhealth.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.joincandidhealth.com/_mcp/server.

# Deactivate

DELETE https://pre-api.joincandidhealth.com/appointments/v1/{id}/{version}

Sets an appointment as deactivated.  The path must contain the most recent version to prevent race conditions.  Deactivating historic versions is not supported. Subsequent updates via PUT to the appointment will "reactivate" the appointment, set the deactivated flag to false, and clear the cancellation reason.

Reference: https://docs.joincandidhealth.com/api-reference/pre-encounter/appointments/v-1/deactivate

## Authentication

- OAuth2 — send the obtained token as `Authorization: Bearer <token>`

## Servers

- `https://pre-api.joincandidhealth.com` (Production, default)
- `https://pre-api-staging.joincandidhealth.com` (Staging)
- `https://sandbox-pre-api.joincandidhealth.com` (CandidSandbox)
- `https://staging-pre-api.joincandidhealth.com` (CandidStaging)
- `http://localhost:4000` (Local)

## Request

### Path parameters

- `id` (string, required) — The unique identifier for an Appointment.
- `version` (string, required)

### Query parameters

- `cancellation_reason` (string, optional) — The reason the appointment is being cancelled.

## Errors

### 404 Not Found Error

- `errorName` ("NotFoundError", required)
- `content` (ErrorBase4xx, required)

### 409 Version Conflict Error

- `errorName` ("VersionConflictError", required)
- `content` (VersionConflictErrorBody, required)

## Types

### ErrorBase4xx

- `message` (string, required)
- `data` (any, optional)

### VersionConflictErrorBody

- `message` (string, required)
- `data` (any, optional)
- `latest_version` (integer, optional)

## Examples

**SDK Code**

```python
import requests

url = "https://pre-api.joincandidhealth.com/appointments/v1/id/version"

headers = {"Authorization": "<token>."}

response = requests.delete(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://pre-api.joincandidhealth.com/appointments/v1/id/version';
const options = {method: 'DELETE', headers: {Authorization: '<token>.'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://pre-api.joincandidhealth.com/appointments/v1/id/version"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("Authorization", "<token>.")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://pre-api.joincandidhealth.com/appointments/v1/id/version")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = '<token>.'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://pre-api.joincandidhealth.com/appointments/v1/id/version")
  .header("Authorization", "<token>.")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://pre-api.joincandidhealth.com/appointments/v1/id/version', [
  'headers' => [
    'Authorization' => '<token>.',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://pre-api.joincandidhealth.com/appointments/v1/id/version");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "<token>.");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "<token>."]

let request = NSMutableURLRequest(url: NSURL(string: "https://pre-api.joincandidhealth.com/appointments/v1/id/version")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```