# Signup and Terms acceptance

How an agent signs your business up for CapVM with `POST /v1/signup`, and how a human accepts the Terms. **Available.**

CapVM is for businesses only. Before your organization can get an API key, add credits or start a machine, a **human** authorised to bind the business must accept the current Terms of Service and Acceptable Use Policy (Terms of Service §3.1). An AI agent can start a signup, but it **can't accept** the Terms: acceptance takes effect only when that human confirms it (Terms §3.2).

## How it works

1. Your agent (or you) calls `POST /v1/signup` with the business details and the name of the human who accepts.
2. CapVM creates the organization in status `pending_acceptance` and emails that person a single-use link. The link expires after **72 hours**.
3. The person opens the link. The page shows the account email and the organization's name, country and VAT ID as they are when the page loads (read-only; after a signup retry, the newest values), the Terms of Service and AUP versions with links to `/terms` and `/aup`, the Data Processing Agreement, Billing and Refund Policy and Privacy Policy versions in effect with links to `/dpa`, `/billing` and `/privacy` (a document with no version in effect isn't listed), and the acceptance checkbox (it also covers the Data Processing Agreement), which is **not pre-ticked**. The **I accept on behalf of my business** button stays disabled until the box is ticked. The page says: "Only a person authorised to bind the business may confirm. An AI agent must not."
4. When they tick it and click the button, CapVM records the acceptance and the organization becomes active.

Signup doesn't create an API key. Keys aren't self-serve: the CapVM team issues API keys after signup and once the acceptance is recorded. Self-serve keys in the [dashboard](dashboard.md) are Coming soon.

## `POST /v1/signup`

Public: no API key needed.

```bash
curl https://api.capvm.com/v1/signup \
  -H "Content-Type: application/json" \
  -d '{
    "company_name": "Acme GmbH",
    "country": "CH",
    "vat_id": "CHE-123.456.789",
    "terms_acceptance": {
      "tos_version": "tos-0.2",
      "aup_version": "aup-0.2",
      "accepted_by_email": "person@acme.example"
    }
  }'
```

| Field | Type | Required | Notes |
|---|---|---|---|
| `company_name` | string | yes | 1 to 120 characters after trimming, no control characters |
| `country` | string | yes | 2 to 56 characters after trimming, no control characters. Free text, not checked against a country list. |
| `vat_id` | string | no | Up to 64 characters. Empty is treated as missing. |
| `terms_acceptance` | object | yes | Must be an object. Missing, `null` or `false` is rejected. |
| `terms_acceptance.tos_version` | string | yes | Must be the **current** Terms of Service version |
| `terms_acceptance.aup_version` | string | yes | Must be the **current** Acceptable Use Policy version |
| `terms_acceptance.accepted_by_email` | string | yes | The human who will accept. Up to 320 characters; stored lowercase. The link goes here (sent by email from hello@capvm.com). |

The current versions are `tos-0.2` and `aup-0.2`. If you send an old version, the error tells you the current ones in `required_versions`.

`201 Created`:

```json
{
  "org_id": "…",
  "user_id": "…",
  "status": "pending_acceptance",
  "request_id": "…",
  "expires_at": "…"
}
```

`expires_at` is when the emailed link stops working (72 hours after signup). The response never contains the link itself.

### Errors

Checked in this order: the per-IP rate limit, the JSON body, the per-email rate limit, then `terms_acceptance`, `company_name`, `country`, `vat_id`, and finally `accepted_by_email`.

| Status | Code | Message |
|---|---|---|
| 429 | `rate_limited` | `Signup rate limit exceeded.` (see Rate limits below) |
| 400 | `invalid_json` | `Request body must be valid JSON.` (also for an empty or `null` body; `Request body must be a JSON object.` for another non-object body) |
| 400 | `terms_acceptance_required` | `terms_acceptance with the current tos_version, aup_version, and accepted_by_email is required.` (missing, `null`, `false` or not an object) |
| 400 | `terms_acceptance_required` | `terms_acceptance must include tos_version, aup_version, and accepted_by_email.` |
| 400 | `terms_acceptance_required` | `No Terms of Service version is effective yet.` |
| 400 | `terms_acceptance_required` | `terms_acceptance must name the current tos_version and aup_version.` |
| 400 | `validation_error` | `company_name must be 1 to 120 characters.` / `country must be 2 to 56 characters.` / `vat_id must be a string.` / `vat_id must be at most 64 characters.` |
| 400 | `invalid_email` | `accepted_by_email must be a valid address.` |
| 503 | `email_send_failed` | `The acceptance email could not be sent. This request can be retried.` with `Retry-After: 30`. Checked last, after the signup is saved (see below). |

`terms_acceptance_required` adds the current versions (or `null` when none is effective yet):

```json
{
  "error": {
    "code": "terms_acceptance_required",
    "message": "terms_acceptance must name the current tos_version and aup_version.",
    "required_versions": {"tos_version": "tos-0.2", "aup_version": "aup-0.2"}
  }
}
```

A rejected signup (any `400` or `429`) creates nothing.

### Retrying a signup

If you call `POST /v1/signup` again with the same `accepted_by_email` while that person's organization is still `pending_acceptance`, CapVM doesn't create a second organization. The newest submission wins: it replaces the pending organization's company name, country and VAT ID with the values in the new call, makes every unused link for it stop working (opening or submitting an old link then returns `410 link_superseded`, an HTML page unless `Accept` prefers JSON: `A newer confirmation link was sent; please use the latest email.`), and emails a new 72-hour link. The response has the same `org_id` and a new `request_id` and `expires_at`. A retry counts toward the rate limits like any other call.

If the email can't be sent, the signup is still saved (the organization exists in `pending_acceptance`), the link created by that call is voided (opening it returns `410 link_expired`, `This confirmation link has expired.`), and the call returns `503 email_send_failed` with `Retry-After: 30`. On a retry, older links were already voided too, so there is no working link until a send succeeds. Retry the same call after that: it's handled as a retry above and sends a fresh link.

### Rate limits

`POST /v1/signup` allows **5 requests per hour per client IP** and **5 per hour per `accepted_by_email`** (rolling one-hour window: each call counts for one hour after it's made; CapVM can change these defaults). Over either limit you get `429 rate_limited` `Signup rate limit exceeded.` with a `Retry-After` header: the seconds until the oldest counted call leaves the window, rounded up, at least 1. Every call counts against the IP limit, including ones later rejected as invalid. A call counts against the email limit only when its `accepted_by_email` is a valid address.

## The confirmation link

The email links to `https://api.capvm.com/signup/confirm/{token}`. The link works once and for 72 hours. Only the person it was sent to should open it: an agent must not confirm on a human's behalf.

Each time the page is opened it issues a new single-use **form token**, valid for 15 minutes, tied to that link and to a hash of exactly what the page showed: the account email, organization name, country, VAT ID, the Terms and AUP versions (with the SHA-256 of their text), the DPA, Billing and Privacy versions, and the checkbox text version. The accept button submits an HTML form with that form token and the ticked checkbox. A JSON request to the link is refused: only the page's form records an acceptance.

Opening the page:

| Case | Result |
|---|---|
| Link unknown | Status page, `404` (`not_found`): `This confirmation link is not valid.` |
| Link replaced by a newer one (a signup retry or a new link from CapVM) | Status page, `410` (`link_superseded`): `A newer confirmation link was sent; please use the latest email.` |
| Link already accepted | Status page, `400` (`link_used`): `This confirmation link was already used.` |
| Link expired (after 72 hours), or its email failed to send | Status page, `410` (`link_expired`): `This confirmation link has expired.` |

The link checks run in that order, so a replaced link always shows the "use the latest email" page, even after 72 hours. All four follow the rule in [HTML or JSON](#html-or-json) below; for the unknown link that's a status page `<p data-error="not_found" data-status="404">404. This confirmation link is not valid.</p>`, or `404 not_found` JSON if `Accept` prefers JSON.

### HTML or JSON

Link errors (`not_found` for an unknown link, `link_superseded`, `link_used`, `link_expired`) on opening or submitting, and form-token errors on submitting (`400 validation_error`, below), come back as an HTML **status page** by default, with the same HTTP status. The page is one line, the status code then the message, marked with `data-error` (the code) and `data-status`, for example:

```html
<p data-error="link_superseded" data-status="410">410. A newer confirmation link was sent; please use the latest email.</p>
```

They come back as the usual JSON error body (`{"error":{"code","message"}}`) **only when the `Accept` header prefers `application/json` over `text/html`**. Exactly how CapVM reads `Accept`:

- It takes the highest `q` given for `application/json` and the highest for `text/html` (no `q` means 1). JSON is used only when `application/json` is listed with a `q` above 0 **and** above `text/html`'s (`text/html` counts as 0 when it isn't listed).
- No `Accept` header, an empty one, or one that can't be parsed: HTML.
- `*/*`, `application/*` and `text/*` count for neither type. So `Accept: */*` alone gets HTML, but `Accept: application/json, */*` gets JSON.
- A tie gets HTML: `application/json, text/html` is HTML. So is `text/html, application/json;q=0.8`, and `application/json;q=0`.
- `application/json` on its own, or `application/json, text/html;q=0.2`, gets JSON.

The same rule picks between the form again and JSON when the box isn't ticked and for `409 details_changed` (below). Other errors don't depend on `Accept`.

### Submitting the form

Checked in this order: first the request, then the link, then the form token, then the checkbox and Terms, then the details. What comes back as HTML or JSON:

- Always JSON: not sent as a form, and the Terms having changed.
- HTML status page unless `Accept` prefers JSON: the link errors (link unknown included) and the form-token errors.
- The form again unless `Accept` prefers JSON: box not ticked (with an inline error), and `409 details_changed`.

| Case | Result |
|---|---|
| Not sent as the page's form (for example JSON) | `400 validation_error`: `Acceptance is only recorded from the confirmation page form.` |
| Link unknown | `404 not_found`: `This confirmation link is not valid.` (status page, or JSON if `Accept` prefers it) |
| Link replaced by a newer one | `410 link_superseded`: `A newer confirmation link was sent; please use the latest email.` (status page, or JSON if `Accept` prefers it) |
| Link already accepted | `400 link_used`: `This confirmation link was already used.` (status page, or JSON if `Accept` prefers it) |
| Link expired (after 72 hours), or its email failed to send | `410 link_expired`: `This confirmation link has expired.` (status page, or JSON if `Accept` prefers it) |
| No form token | `400 validation_error`: `A form token from the acceptance page is required.` |
| Form token unknown | `400 validation_error`: `This form token is not valid.` |
| Form token from another link | `400 validation_error`: `This form token does not match this link.` |
| Form token already used | `400 validation_error`: `This form token was already used.` (A form token is only used up by a successful acceptance, which also uses the link, so in practice the link check answers first with `400 link_used`.) |
| Form token expired (after 15 minutes) | `400 validation_error`: `This form token has expired.` Reload the page to get a new one. |
| (all four form-token rows above) | Status page with `data-error="validation_error"`, or JSON if `Accept` prefers it |
| Box not ticked | `400`, the acceptance page again (HTML) with the inline error `Please tick the box to accept.` (marked `data-error="terms_acceptance_required"`), the box still unticked, the current details and a new form token. If `Accept` prefers JSON: `400 terms_acceptance_required` `The Terms and Acceptable Use Policy checkbox must be ticked.` with `required_versions`. Either way nothing is recorded, and the form token you sent isn't used up. |
| The Terms changed since the link was sent | `400 terms_acceptance_required`: `This link was issued for terms that are no longer the current versions.` (always JSON) |
| Anything the page showed has changed since it was loaded (for example the organization's details, or a new DPA, Billing or Privacy version) | `409 details_changed`. Unless `Accept` prefers JSON (then it's the JSON error `409 details_changed` with the same message), it's an **HTML page**: the acceptance page again with the current details, a new form token, and the message `These details changed. Review them and accept again.` Nothing is recorded and the organization stays pending. Review the page and accept again from that page, which uses its new form token. |
| Accepted | `200`, page "Acceptance recorded": "The Terms of Service and Acceptable Use Policy are accepted for this business. You can close this page." The organization is active. |

When a signup link has expired or is out of date and the organization is still pending, repeat `POST /v1/signup` with the same `accepted_by_email` to get a new one (see [Retrying a signup](#retrying-a-signup)). Otherwise CapVM can send one (see "How to resolve it").

After a `409 details_changed`, the old form token isn't used up: it stays unused until it expires 15 minutes after it was issued, and it can only succeed if the details change back to what its page showed. Use the new form token from the page shown with the 409 (the page does this when you accept from it).

Because the link is checked before the form token and the details, a page for a link that was replaced by a signup retry or a new link from CapVM gets `410 link_superseded` on submit, even if its form token has expired, and never `409 details_changed`. Use the link in the latest email.

### What is recorded

Each acceptance is stored in an append-only record (never changed or deleted) tied to the human and the organization, never to an API key: exactly what the page showed the person (the form token's snapshot): company name, country and VAT ID, Terms and AUP versions with the SHA-256 of their published text, the DPA, Billing and Privacy versions, the exact checkbox text version stored on the link (`signup-checkbox-0.2` for a first acceptance, `reaccept-checkbox-0.2` when the organization already accepted an earlier version), the time in UTC, the IP address and user agent of **both** the API call that sent the link and the human's confirmation, channel `email_confirm_page`, and the `request_id` of the call that sent the link. If the organization had no country or VAT ID yet, the confirmed values are saved on it.

The IP address is your connecting client address. Terms §3.3 describes this record.

## 403 `terms_not_accepted`

Until your organization has accepted the **current** Terms and AUP, these return `403 terms_not_accepted`:

- `POST /v1/machines` (and the MCP `create_machine` tool)
- issuing an API key
- adding credits
- starting a card top-up, `POST /v1/checkout/sessions` (and the MCP `create_checkout_session` tool), see [Billing → Topping up by card](billing-and-caps.md#topping-up-by-card). It's checked before Stripe is called, so no Checkout Session is created and nothing is recorded when it's refused. Unlike the other actions, it's also refused on a non-production server before any Terms version is in effect, but with a different error: `400 terms_acceptance_required` `No Terms of Service version is effective yet.` (`required_versions: null`).
- A card payment that has already gone through is still credited, even if your acceptance has lapsed since.

Messages:

- Signup not yet confirmed: `A human has not confirmed the Terms of Service and Acceptable Use Policy for this organization.`
- No acceptance of the current versions: `Accept the current Terms of Service and Acceptable Use Policy before creating machines, API keys, or adding credits.`
- On a production server before any Terms version is in effect (see below): `No Terms of Service or Acceptable Use Policy version is in effect.` with `required_versions` set to `null`.

Over REST, the error carries the versions to accept and an info page:

```json
{
  "error": {
    "code": "terms_not_accepted",
    "message": "Accept the current Terms of Service and Acceptable Use Policy before creating machines, API keys, or adding credits.",
    "required_versions": {"tos_version": "tos-0.2", "aup_version": "aup-0.2"},
    "accept_url": "https://api.capvm.com/terms/accept"
  }
}
```

Over MCP, the `create_machine` tool error text is `terms_not_accepted: <message>`, with `structuredContent` holding the same `{"error":{"code","message",…}}` object as REST, `required_versions` and `accept_url` inside `error`. See [MCP → Errors](mcp.md#errors).

What's **not** blocked: machines that are already running keep running, and you can still get, exec on, and stop them. Retrying a create or top-up with an `Idempotency-Key` that already succeeded returns the original result.

### Before the Terms take effect

The founding versions (`tos-0.2`, `aup-0.2`) take effect on a date still **to be confirmed**. Until then, CapVM does this:

- **On a production server:** creating machines, issuing keys and adding credits return `403 terms_not_accepted` for every organization (`No Terms of Service or Acceptable Use Policy version is in effect.`, or the "has not confirmed" message for a pending signup), with `required_versions: null`.
- **On any server:** `POST /v1/signup` with a complete `terms_acceptance` returns `400 terms_acceptance_required` `No Terms of Service version is effective yet.` (`required_versions: null`), and CapVM can't send acceptance links either. So nobody can sign up or accept before the effective date.
- **On a non-production server**, the gate lets machines, keys and credits through while no version is in effect (except for a pending signup).
- Health, the legal documents and machines that already exist keep working. Responses carry the notice header (below) for the upcoming versions.

### How to resolve it

- **Your agent can't fix this.** Tell the human who runs your account.
- If signup is pending: that person opens the emailed link (within 72 hours) and ticks the box. If the link expired or got lost, repeat `POST /v1/signup` with the same `accepted_by_email` for a new one.
- If your organization was set up by CapVM rather than through signup, or a new version needs accepting: ask CapVM (hello@capvm.com) to send an acceptance link. Agents can't request it. The page works the same way. For a first acceptance it shows the same checkbox as signup (`signup-checkbox-0.2`). Only if your organization already accepted an earlier version does it read "I accept the updated Terms of Service (version …) and Acceptable Use Policy (version …) on behalf of {company}." (`reaccept-checkbox-0.2`). If your acceptance is already current, CapVM can't send a new one and no email is sent. A new link from CapVM makes any older unused link for your organization stop working (`410 link_superseded`, an HTML page unless `Accept` prefers JSON: `A newer confirmation link was sent; please use the latest email.`). If the email fails, the new link is voided too (it then returns `410 link_expired`) so there's no working link until CapVM sends one successfully. The country and VAT ID CapVM gives when sending the link are saved on your organization, even if the email then fails.
- `accept_url` is an information page, not an acceptance form. It explains that a human authorised to bind the business must accept and that the emailed link is the way to do it.
- After a new material version of the Terms or AUP takes effect, you must accept it again before new machines, keys or credits (Terms §15.3). Notices to CapVM go to hello@capvm.com (Terms §17.8).

## Notice of changes

During the notice period of a material change (published, not yet effective), API responses carry a header such as:

```
X-CapVM-Terms-Update: tos=tos-0.2;effective_at=<UTC timestamp>, aup=aup-0.2;effective_at=<UTC timestamp>
```

Each material Terms or AUP version that is published but not yet in effect is listed, with `effective_at` in UTC. The founding versions above are announced this way until their effective date (to be confirmed). Pass it on to the human who runs your account. Once it takes effect, the new version is required (see above).

## Legal documents

CapVM serves the published text at `/terms`, `/aup`, `/dpa`, `/billing` and `/privacy` on the API host: the version in effect, or before that the latest published one. They are the Terms of Service, Acceptable Use Policy, Data Processing Agreement, Billing and Refund Policy, and Privacy Policy.
