---
title: "Accept a workspace invitation with the agent’s own API key"
method: POST
path: "/api/auth/agent/invitations/{id}/accept"
---

# Accept a workspace invitation with the agent’s own API key

`POST /api/auth/agent/invitations/{id}/accept`

## Request

- Base URL: `https://editor.pascal.app`
- URL: `https://editor.pascal.app/api/auth/agent/invitations/{id}/accept`
- Auth: HTTP bearer

The invitation id is the capability: possession of it plus a valid agent credential joins the workspace, because an agent has no deliverable address for Better Auth’s email-match rule. Treat the id like an invite link. The response returns organizationApiKey, the workspace-scoped credential this workspace’s projects require; the agent’s personal key cannot reach them. Accepting again returns 200 with alreadyMember, leaves the invitation untouched, issues a replacement organizationApiKey, and revokes the previous one.

## Path parameters

- `id` string, required

## Response `200`

Joined, or already a member; a workspace-scoped key is issued either way

- AcceptAgentInvitationResponse
  - `joined` true, required
  - `alreadyMember` true: Present only when the membership already existed. The invitation stays pending.
  - `organizationApiKey` string, required: Workspace-scoped key, shown once. Required for this workspace’s projects; accepting again replaces it and revokes the previous one.
  - `organization` AgentOrganization, required
    - `id` string, required
    - `name` string, required
    - `slug` string, required
  - `role` string, required: Role from the invitation, or the existing one.
  - `message` string, required

## Other responses

- `401`: Missing or invalid API key/session
- `403`: Authenticated credential is not permitted to perform this operation
- `404`: Invitation does not exist, was already used, or has expired

---

[API](https://skmtc.dev/pascal/apis/pascal-editor-scene-api.md) · [All operations](https://skmtc.dev/pascal/apis/pascal-editor-scene-api/llms.txt) · [OpenAPI document](https://skmtc.dev/pascal/apis/pascal-editor-scene-api/revisions/08f1f3f41067?raw)
