# AgentSignup

> Claiming an account an AI agent made for itself: the claim link it hands a person (`noclick.com/claim/<token>`) names a token, which the signed-in person reads (`preview_claim`) and answers (`answer_claim`). Both are a signed-in person's own calls (a session), never a key.

## AgentSignup

```typescript
class AgentSignup
```

Claiming an account an AI agent made for itself.

### AgentSignup.previewClaim

```typescript
static previewClaim(
  token: string,
  options?: { client?: NoClick },
): Promise<JsonObject>
```

The claim page's view: the agent and what it made, what waits for the claim (its spending included), and whether
the signed-in person may claim it.

Parameters:

- `token` (`string`, required)
- `options.client` (`NoClick`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: The agent and what it made, what waits for the claim (its spending included), and whether the signed-in
person may claim it.

Types:

```typescript
type JsonObject = { [key: string]: unknown };
```

### AgentSignup.answerClaim

```typescript
static answerClaim(
  token: string,
  decision: "claim" | "decline",
  options?: {
    acceptTerms?: boolean;
    keyAccess?: ClaimKeyAccess;
    client?: NoClick;
  },
): Promise<JsonObject>
```

Answer a claim: `claim` folds the agent's account and what it made into the signed-in person's (it needs
`acceptTerms`: the person accepting NoClick's Terms for it), its key acting there as `keyAccess` says (`full` by
default, `build`, or `revoked`); `decline` ends the agent's account now. Answers the claim's view as it is then.

Parameters:

- `token` (`string`, required)
- `decision` (`"claim" | "decline"`, required)
- `options.acceptTerms` (`boolean`)
- `options.keyAccess` (`ClaimKeyAccess`)
- `options.client` (`NoClick`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: The claim's view as it is then.

Types:

```typescript
/** What the agent's key may do once its account is claimed. */
type ClaimKeyAccess = "full" | "build" | "revoked";

type JsonObject = { [key: string]: unknown };
```
