> For the complete documentation index, see [llms.txt](https://diffio.ai/llms.txt). This page is also available as HTML at https://diffio.ai/docs/api-reference/revoke-project-share/.

# Revoke a project's share

Revokes a project's published share. Existing share URLs stop working within about 60 seconds, and [Get a share](https://diffio.ai/docs/api-reference/get-share/) returns `404` (`share_not_found`).

DELETE `https://api.diffio.ai/v2/projects/{project_id}/share`

- Key scope: `projects:write`
- Auth header: `Authorization: Bearer <apiKey>`
- Body: None

## Request

Pass `project_id` in the path; takes no request body.

### Path parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `project_id` | string | Yes | Unique identifier of the project. |

### Headers

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `Diffio-End-User` | string | No | Optional end-user identifier (up to 128 characters). Scopes the request to that end user's projects; omit to act across the whole account. |

## Example request

**Python**

```python
import os
from diffio import DiffioClient

key = os.environ["DIFFIO_API_KEY"]
client = DiffioClient(api_key=key)

revoked = client.shares.revoke(
    "62f62565-049f-5e7e-bbd2-9de0cf7ddbfe",
)
```

**Node.js**

```javascript
import { DiffioClient } from "diffio"

const client = new DiffioClient({
  apiKey: process.env.DIFFIO_API_KEY,
})

const revoked =
  await client.shares.revoke(
    "62f62565-049f-5e7e-bbd2-9de0cf7ddbfe",
  )
```

**cURL**

```bash
curl -X DELETE "https://api.diffio.ai/v2/projects/62f62565-049f-5e7e-bbd2-9de0cf7ddbfe/share" \
  -H "Authorization: Bearer $DIFFIO_API_KEY"
```

## Response

Returns `deleted: true` and the revoked share `id` (or `null` if the project was never shared).

Success: `200`

### Response fields

| Field | Type | Present | Description |
| --- | --- | --- | --- |
| `object` | string | Always | Resource type, always `"project_share"`. |
| `id` | string \| null | Always | Revoked 17-character share identifier, or `null` when the project never had a share. |
| `project_id` | string | Always | Identifier of the project. |
| `deleted` | boolean | Always | Always `true`. |

## Example response (200)

**Successful response**

```json
{
  "object": "project_share",
  "id": "Hq7cTnWm3RkZpY2vB",
  "project_id": "62f62565-049f-5e7e-bbd2-9de0cf7ddbfe",
  "deleted": true
}
```

## Return codes

- `200` Share revoked (or project had no share).
- `400` `Diffio-End-User` exceeds 128 characters. [`invalid_header`](https://diffio.ai/docs/api-reference/errors/#invalid_header)
- `403` Key is inactive or lacks `projects:write`. [`permission_denied`](https://diffio.ai/docs/api-reference/errors/#permission_denied)
- `404` No project with that `project_id` exists for this account and end user. [`project_not_found`](https://diffio.ai/docs/api-reference/errors/#project_not_found)
- `409` Project is currently being deleted, or a concurrent publish reserved after this revoke won (code conflict). [`not_available`](https://diffio.ai/docs/api-reference/errors/#not_available)
- **`401` `405` Same on every endpoint**

  - `401` Missing API key (code missing_api_key), or invalid API key (code invalid_api_key).
  - `405` HTTP method not supported on this path; check the Allow header (code method_not_allowed).

### Example error response

Errors are JSON: an `error` object with `code`, `message` and `request_id`. An unrecognized key returns `401`:

**Error response**

```json
{
  "error": {
    "code": "invalid_api_key",
    "message": "Invalid API key.",
    "request_id": "dead773b60e148fd9e22d680a22fa701"
  }
}
```

## Notes

- Idempotent: calling `DELETE` on an unshared or already-revoked project returns `200` with `deleted: true`.
- Deleting a project via [Delete a project](https://diffio.ai/docs/api-reference/delete-project/) revokes its share automatically.

## Related pages

- Previous: [Get a project's share](https://diffio.ai/docs/api-reference/get-project-share/): Read a project's currently published share and its playback URLs using your API key.
- Next: [Get a share](https://diffio.ai/docs/api-reference/get-share/): Fetch a published share's playback metadata and signed media URLs without an API key.

- [Full API guide](https://diffio.ai/docs/developers/full-api-guide/): Every topic, limit and concept in one index.
- [API reference](https://diffio.ai/docs/api-reference/introduction/): Base URL, authentication, errors and every endpoint.
