# Agents

Sign up as an agent, and let a person claim the account with an email code.


These operations let an agent get an account without a person, give the account to a person, and manage API keys. All paths are under `https://summonmade.com/api/v1`. The full flow is in [Sign up as an agent](/docs/agents/sign-up).

## Account status

| Status | What it means |
| --- | --- |
| `unclaimed` | No person owns the account. The account can use the Workbench, check parts, create draft orders and get quotes, but cannot pay. |
| `claim_pending` | Summonmade sent a code to the email of a person. The account waits for the code. |

An unclaimed account with no activity is deleted after 30 days. A lost key of an unclaimed account cannot be recovered.

## Sign up

`POST /agents/sign-up` needs no authentication.

| Field | Type | Required | Value |
| --- | --- | --- | --- |
| `name` | string | yes | The name of the agent, for example `Claude Code`. |
| `humanEmail` | string | no | The email of the person who will own the account. |

It answers `201`:

```json
{
  "account": { "id": "acc_…", "status": "unclaimed" },
  "apiKey": "sm_…"
}
```

The status is `claim_pending` when you send `humanEmail`. The key shows only once, so store it at once. Sign-up is rate-limited per IP address, and too many sign-ups get `429`.

```sh
curl -X POST https://summonmade.com/api/v1/agents/sign-up \
  -H "Content-Type: application/json" \
  -d '{"name": "Claude Code"}'
```

## Claim

`POST /agents/claim` sends a code to the person who will own the account. Authenticate with the key of the account.

| Field | Type | Required | Value |
| --- | --- | --- | --- |
| `humanEmail` | string | yes | The email of the person. |

It answers `202`. Summonmade emails the person a 6-digit code that works for 10 minutes. The account status becomes `claim_pending`.

```sh
curl -X POST https://summonmade.com/api/v1/agents/claim \
  -H "Authorization: Bearer $SUMMONMADE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"humanEmail": "ana@example.com"}'
```

## Verify the claim

`POST /agents/claim/verify` sends the code that the person gives you. Authenticate with the key of the account.

| Field | Type | Required | Value |
| --- | --- | --- | --- |
| `code` | string | yes | The 6-digit code from the email. |

When the code is right, the answer is `200` with the account, and the account belongs to the person:

```json
{ "id": "acc_…", "status": "claimed", "email": "ana@example.com" }
```

The person signs in on the website with that email and sees the same designs and orders. The key keeps working.

If the email already has an account, the designs and orders of the agent move into it. The key then acts for that account.

```sh
curl -X POST https://summonmade.com/api/v1/agents/claim/verify \
  -H "Authorization: Bearer $SUMMONMADE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"code": "123456"}'
```

:::callout{type="warning"}
Give the key to the person only through a channel that you already share, such as the chat. Never send it by email.
:::

## Read the account

`GET /account` answers the account of the key or the session, with its status. Use it to see if a person has claimed the account.

```sh
curl https://summonmade.com/api/v1/account \
  -H "Authorization: Bearer $SUMMONMADE_API_KEY"
```

## API keys

| Operation | What it does |
| --- | --- |
| `GET /keys` | Lists the keys of the account: ID, name, the first characters, and when the key was made and last used. |
| `POST /keys` | Makes a key. Send `{ "name": "What the key is for" }`. The answer `201` holds the key in `apiKey`. It shows only once. |
| `DELETE /keys/{id}` | Deletes a key. It stops working at once. |

```sh
curl -X POST https://summonmade.com/api/v1/keys \
  -H "Authorization: Bearer $SUMMONMADE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Build script"}'
```
