# Cancel Agency Team Invite Beta

> Withdraw a pending team invite to an email.

> Documentation index: https://www.foxreach.io/docs/llms.txt lists every page of these docs. Each page is also served as Markdown: add `.md` to its URL.

`DELETE` https://api.foxreach.io/api/v1/agency/team/invites

> **Note:** **Beta.** Agency team endpoints are new and may change.

Requires an API key with the `write` and `admin` scopes, created by the agency workspace owner. The `admin` scope is opt-in: no default key carries it. Only keys of an Agency workspace can call it (`403 agency_required` otherwise).

Only API keys of an Agency workspace can call this endpoint (`403 agency_required` otherwise). The call always runs in the key's own workspace; `X-Workspace-Id` is ignored. Writes also need a key created by the agency workspace owner (`403 agency_owner_required` otherwise).

Withdraws the invite for every client workspace it covered. The link in the email stops working.

## Query Parameters

- `email` string query required: The invited email.

## Response

- `data` object

  - `email` string: The email, lower-cased.
  - `cancelled` integer: How many workspace invites were withdrawn.

**Request example**

```bash cURL
curl -X DELETE "https://api.foxreach.io/api/v1/agency/team/invites?email=new%40agency.com" \
  -H "X-API-Key: otr_your_key"
```

```python Python SDK (beta)
from foxreach import FoxReach

client = FoxReach(api_key="otr_your_key")
client.agency.cancel_team_invite("new@agency.com")
```

```typescript TypeScript SDK (beta)
import { FoxReach } from "foxreach";

const client = new FoxReach({ apiKey: "otr_your_key" });
await client.agency.cancelTeamInvite("new@agency.com");
```

**Response example**

```json
{
  "data": {"email": "new@agency.com", "cancelled": 2}
}
```

Each cancel is recorded as an `audit.agency_member.invite_cancelled` event with the key as the actor.

## Errors

| Status | Description |
|--------|-------------|
| `401` | Missing, invalid, revoked or expired API key |
| `403` | API key does not have the required scope: `write` |
| `403` | `agency_required` or `agency_owner_required` |
| `404` | No pending invite for this email |
| `422` | `email` is missing or not an email |

## Rate Limit

- **120 requests per minute, shared by every `write` call in your workspace.** Fixed 60-second window.
- Every response includes `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` (unix epoch seconds) and `X-RateLimit-Bucket` (`write`).
- A `429` response includes a `Retry-After` header (seconds until the bucket resets).

For client-side patterns, see [Rate Limiting](https://www.foxreach.io/docs/rate-limiting).
