# Collect the agent token; 202 until the person creates their account or allows the agent

`POST` `/api/v1/signup/claim`

`claimSignup`

Pending responses carry Retry-After: 5, a hint in seconds, not an enforced limit. Use signup wait in the CLI, or call once when the person returns; do not repeatedly poll into agent context. The claim code is a secret like the token: save startSignup's reply privately, never print either secret or put it in argv. CLI signup wait accepts @file or - (stdin). Write a ready answer to a private file before printing anything. After the first ready answer, the claim code alone never issues the token again. For 7 days after account creation or Allow, the same request with the current token as Authorization: Bearer rotates it: the same token_id gets a new secret and the earlier secret stops working. Without the current token, the answer is 202 with next_step owner_approves_reissue, a reissue_code and an approve_url for the person: a workspace owner signs in and taps Reissue, then the same request with claim_code and reissue_code collects the new secret. The current secret keeps working until then. Neither works once a token from this sign-up was revoked. Who can call it: No sign-in needed.

**Scopes:** None. Public.

Before the person creates an account or allows the agent, returns HTTP 202 with Retry-After: 5, status=pending, expires_at, next_step=open_signup_url and a message explaining how the person can finish in the original signup_url by creating an account, or by signing in, typing the user_code the agent showed them and allowing the agent. Phone, security-key, password-manager and browser/device alternatives stay within passkey sign-in. New-account tokens have all agent scopes; existing-account grants have read, drafts, media and request-approval only. Write the ready answer to a private file before printing anything; the token can manage future schedules with drafts scope, but cannot approve or post immediately. After that, the code alone never issues the token again. Within 7 days of the passkey or Allow, claiming with the current token as Authorization: Bearer returns the same token_id with a new secret and replaced: true, and the earlier secret stops working. Without it, the answer is 202 with next_step=owner_approves_reissue, a reissue_code and an approve_url: a workspace owner signs in there and taps Reissue, then claim_code with reissue_code collects the new secret. 409 conflict once a token from that sign-up was revoked, or for a replaced reissue_code.

**Parameters**

None.

**JSON body**

| Field | Required | Type and constraints | Description |
| --- | --- | --- | --- |
| `claim_code` | Yes | `string` |  |
| `reissue_code` | No | `string`; pattern: `"^rsq_"` | After the first claim: the reissue_code from an owner_approves_reissue answer, to collect the new secret once an owner approved it. |

**Request example**

```http
POST https://app.flaghand.com/api/v1/signup/claim
Content-Type: application/json

{
  "claim_code": "claim_SYNTHETIC_DO_NOT_USE"
}
```

**Response example**

```json
{
  "status": "ready",
  "workspace_id": "ws_aaaaaaaaaaaaaaaa",
  "token": "tok_SYNTHETIC_DO_NOT_USE",
  "token_id": "tkn_cccccccccccccccc",
  "scopes": [
    "read",
    "drafts",
    "media",
    "request-approval",
    "cancel",
    "connections",
    "billing",
    "webhooks"
  ]
}
```

Success: HTTP 200. Content-Type: application/json.

**Errors:** `invalid_request` (400), `internal` (500), `invalid_json` (400), `challenge_expired` (409), `conflict` (409). See the [error codes](https://app.flaghand.com/docs/errors.md) for meanings and the shared default error response. Other domain errors from that catalog may apply; the response's code and message are authoritative.

**CLI:** `flaghand sign-up claim-signup`

```sh
flaghand sign-up claim-signup -d '{"claim_code":"claim_SYNTHETIC_DO_NOT_USE"}' --json
```

**MCP tool:** `claimSignup` (also reachable through `callWriteOperation`; use `getOperation` to load its full schema).

```json
{
  "name": "callWriteOperation",
  "arguments": {
    "operation_id": "claimSignup",
    "arguments": {
      "claim_code": "claim_SYNTHETIC_DO_NOT_USE"
    }
  }
}
```

Base URL: `https://app.flaghand.com/api/v1`. Part of the [API reference](https://app.flaghand.com/docs/api.md); every error code is in [errors](https://app.flaghand.com/docs/errors.md).
