# Accept a team invitation.

> Hosted dashboard only.
> https://koi.dog/docs/api/workspace-team/accept-workspace-invitation/

`POST /api/v1/workspace-team/invitations/{id}/accept` · Key: `session only`

Adds the verified recipient to the invited workspace as a member and opens it for this browser. Use a Clerk session token at `https://app.koi.dog/api/v1` with `Origin: https://app.koi.dog`.

## Path parameters.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | The workspace team invitation's id. |

## Headers.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | `string` | no | Retry the same request with the same key. [Retry rules](https://koi.dog/docs/api/#retries). |

## Response.

200 OK · JSON object

## Request.

```sh
# Requires a Clerk dashboard session token.
curl -X POST "https://app.koi.dog/api/v1/workspace-team/invitations/$ID/accept" \
    -H "Authorization: Bearer $KOIDOG_CLERK_SESSION" \
    -H "Origin: https://app.koi.dog" \
    -H "Idempotency-Key: $(uuidgen)"
```

```js
// Requires a Clerk dashboard session token.
const res = await fetch(`https://app.koi.dog/api/v1/workspace-team/invitations/${process.env.ID}/accept`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KOIDOG_CLERK_SESSION}`,
    Origin: "https://app.koi.dog",
    "Idempotency-Key": crypto.randomUUID(),
  },
});
console.log(await res.json());
```

```python
import os
import uuid

import requests

# Requires a Clerk dashboard session token.
r = requests.post(
    f"https://app.koi.dog/api/v1/workspace-team/invitations/{os.environ['ID']}/accept",
    headers={
        "Authorization": f"Bearer {os.environ['KOIDOG_CLERK_SESSION']}",
        "Origin": "https://app.koi.dog",
        "Idempotency-Key": str(uuid.uuid4()),
    },
)
r.raise_for_status()
print(r.json())
```

## Response example.

```json
{
  "workspace": {
    "id": "string",
    "name": "string"
  },
  "accepted": false
}
```
