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

# Cancel Share Agreement

POST https://api.catenatelematics.com/v2/orgs/share-agreements/{share_agreement_id}/cancel

Cancel a Share Agreement.

Reference: https://catena.ferndocs.com/api-reference/orgs/share-agreements/cancel-share-agreement

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `share_agreement_id` (string, required)

## Response

### 200

Successful Response

- `id` (string, required) — Unique agreement identifier
- `fleet_id` (string, required) — The Catena fleet ID sharing their data with you
- `partner_id` (string, required) — Your organization ID receiving access to fleet data
- `fleet_ref` (string, required, nullable) — Your internal fleet identifier for mapping Catena fleets to your system. Returned in webhooks and APIs for easy integration.
- `status` (enum, required) — Current state: ACTIVE (data access enabled), PAUSED (temporarily disabled), CANCELLED (permanently ended), EXPIRED (past expiration_date)
  - Allowed values: `active`, `paused`, `cancelled`, `deleted`, `expired`
- `effective_date` (datetime, required) — When data access begins. Check this before attempting to fetch fleet data.
- `expiration_date` (datetime, required, nullable) — When data access ends. Null means no expiration. Status automatically changes to EXPIRED after this date.
- `scopes` (map from string to enum, required) — Defines which resources (vehicle, locations, users, etc.) you can access and the permission level (read, write) for each.
  - Allowed values: `read`, `read_write`

## Errors

### 400 Bad Request Error

Bad Request

- `code` (integer, optional, default: 400)
- `message` (string, optional, default: Bad Request)
- `detail` (string, optional, nullable)

### 401 Unauthorized Error

Unauthorized

- `code` (integer, optional, default: 401)
- `message` (string, optional, default: Unauthorized)
- `detail` (string, optional, nullable)

### 403 Forbidden Error

Forbidden

- `code` (integer, optional, default: 403)
- `message` (string, optional, default: Forbidden)
- `detail` (string, optional, nullable)

### 404 Not Found Error

Not Found

- `code` (integer, optional, default: 404)
- `message` (string, optional, default: Not Found)
- `detail` (string, optional, nullable)

### 405 Method Not Allowed Error

Method Not Allowed

- `code` (integer, optional, default: 405)
- `message` (string, optional, default: Method Not Allowed)
- `detail` (string, optional, nullable)

### 409 Conflict Error

Conflict

- `code` (integer, optional, default: 409)
- `message` (string, optional, default: Conflict)
- `detail` (string, optional, nullable)

### 422 Unprocessable Entity Error

Unprocessable Entity

- `code` (integer, optional, default: 422)
- `message` (string, optional, default: Invalid Request Body)
- `detail` (list of ValidationErrorDetail, optional, nullable)

### 429 Too Many Requests Error

Too Many Requests

- `code` (integer, optional, default: 429)
- `message` (string, optional, default: Too Many Requests)
- `detail` (RetryAfterDetail, optional, nullable)

### 500 Internal Server Error

Internal Server Error

- `message` (string, optional, default: Internal Server Error)

## Types

### ValidationErrorDetail

- `path` (string, required)
- `input` (string, required)
- `message` (string, required)
- `error_type` (string, required)

### RetryAfterDetail

- `retry_after_seconds` (integer, required)
- `message` (string, required)

## Examples

**Response**

```json
{
  "id": "22334455-6677-8899-aabb-ccddeeff0011",
  "fleet_id": "98765432-10fe-dcba-9876-543210fedcba",
  "partner_id": "11223344-5566-7788-99aa-bbccddeeff00",
  "fleet_ref": "FLEET-12345",
  "status": "active",
  "effective_date": "2025-12-11T14:22:00Z",
  "expiration_date": "2024-01-15T09:30:00Z",
  "scopes": {
    "hos_events": "read",
    "user": "read",
    "vehicle": "read_write",
    "vehicle_location": "read_write"
  },
  "invitation_id": "01234567-89ab-cdef-0123-456789abcdef"
}
```

**SDK Code**

```python
import requests

url = "https://api.catenatelematics.com/v2/orgs/share-agreements/share_agreement_id/cancel"

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

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

print(response.json())
```

```javascript
const url = 'https://api.catenatelematics.com/v2/orgs/share-agreements/share_agreement_id/cancel';
const options = {method: 'POST', headers: {Authorization: 'Bearer <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://api.catenatelematics.com/v2/orgs/share-agreements/share_agreement_id/cancel"

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

	req.Header.Add("Authorization", "Bearer <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://api.catenatelematics.com/v2/orgs/share-agreements/share_agreement_id/cancel")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <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.post("https://api.catenatelematics.com/v2/orgs/share-agreements/share_agreement_id/cancel")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.catenatelematics.com/v2/orgs/share-agreements/share_agreement_id/cancel', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.catenatelematics.com/v2/orgs/share-agreements/share_agreement_id/cancel");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.catenatelematics.com/v2/orgs/share-agreements/share_agreement_id/cancel")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```