# Sign up to UpRock from an agent

You can get an UpRock API key for your human over plain HTTP, without npm, a browser or
our CLI. It takes two calls, and your human reads you one code from their email.

Base URL: `https://api.uprock.ai`

## 1. Ask for a code

```http
POST /v1/agent-auth/request
Content-Type: application/json

{"email": "jane@example.com"}
```

```json
{
  "request_id": "9f2c41d07a3b5e68",
  "expires_in": 300,
  "message": "We emailed a sign-in code to jane@example.com. Ask them for the code, then call POST /v1/agent-auth/confirm with request_id and code within 5 minutes."
}
```

UpRock emails your human a numeric code. If the address has no UpRock account yet, one is
created when the code is confirmed. Tell your human to check their inbox and read you the code.

## 2. Confirm the code and get an API key

Send the code within 5 minutes, from the same agent that made step 1.

```http
POST /v1/agent-auth/confirm
Content-Type: application/json

{"request_id": "9f2c41d07a3b5e68", "code": "1234567"}
```

```json
{
  "api_key": "…",
  "user_id": "…",
  "org_id": "…",
  "created_user": true,
  "created_org": true,
  "created_key": true,
  "key": { "id": "…", "prefix": "…", "name": "…" }
}
```

Store `api_key` somewhere safe. Send it on every call as `Authorization: Bearer <api_key>`
(or `X-API-Key: <api_key>`). Signing in again with the same email returns the same key.

## 3. Check what's left

```http
GET /v1/api-keys/self
Authorization: Bearer <api_key>
```

`credits_remaining` is the account's balance. It can lag the latest calls by about a minute.

New accounts start with no credits. Credits are prepaid, from $5: $5 buys 10,000 page crawls at $0.50 per 1,000. Prices and how to buy: https://uprock.ai/llms-full.txt. To try UpRock before buying, `POST https://edge.uprock.com/v1/crawl` with no key gives a few free crawls a day.

## Errors

Errors are JSON: `{"code": "...", "message": "..."}`.

| Status | `code` | What to do |
|---|---|---|
| 400 | `invalid_request` | Send a plain email address (`jane@example.com`), or both `request_id` and `code`. |
| 400 | `invalid_code` | The code is wrong. Ask your human to read it again. Repeated wrong codes lock the request. |
| 403 | `forbidden` | This account cannot sign in. |
| 404 | `request_expired` | More than 5 minutes passed. Start again at step 1. |
| 429 | `rate_limited` | Too many attempts. Wait a few minutes before trying again. |
| 502 | `bad_gateway` | Sign-in is temporarily unavailable. Retry later. |

## Limits

- Step 1: 5 calls per minute per caller, and a few codes per email address every 10 minutes.
- Step 2: 20 calls per minute per caller.
- Asking again for the same email within 5 minutes returns the same `request_id` and does not send another email.

Everything else (tools, MCP, CLI, HTTP API, prices): https://uprock.ai/llms-full.txt
