# Accept a workspace invitation

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Accept a workspace invitation sent to the current identity.

```text
POST https://moi.matrixorigin.cn/newmoi/workspaces/invitations/{invitation_id}/accept
```

## Before you call

First [list workspaces](list-workspaces.md#query-parameters) to confirm that the current identity has a pending workspace invitation. Prepare a [personal access token](../../../../guides/genesis/api-keys.md#create-and-manage-personal-access-tokens). You do not need to enter a workspace before calling this API.

## Path parameter

Replace `$AI_STUDIO_API_KEY` and `$INVITATION_ID` with actual values.

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```bash
curl -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/invitations/$INVITATION_ID/accept" \
  -H "X-API-Key: $AI_STUDIO_API_KEY"
```

:::::
:::::{tab-item} Parameter details

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `invitation_id` | string | Yes | ID of the invitation to accept. |

:::::
::::::
:::::::

## Successful response

On success, the API returns 200. `data.accepted` is `true` when the invitation has been accepted.

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "accepted": true
  }
}
```

:::::
:::::{tab-item} Field details

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | `OK` on success. |
| `msg` | string | `OK` on success. |
| `data.accepted` | boolean | Whether the invitation was accepted. |

:::::
::::::
:::::::

## Error response

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": "NOT_FOUND",
  "msg": "Not found",
  "data": null
}
```

:::::
:::::{tab-item} Field details

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | Error code. |
| `msg` | string | Human-readable error message. |
| `data` | null | `null` in an error response. |

:::::
::::::
:::::::

## Next steps

[List workspaces](list-workspaces.md#query-parameters) to confirm that the workspace is accessible.
