# Make an account token for the command line or an agent

`POST /account/tokens` · Rivier · workspace

Make an account token for the command line or an agent. The secret is shown once. Needs a signed-in person; a token cannot make a token.

- Scope: workspace:write
- Sdk: workspace.accountToken.create
- Cli: workspace account token create

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "scopes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "account:read",
          "account:write",
          "account:members"
        ]
      }
    },
    "expiresInDays": {
      "type": "integer",
      "minimum": 1,
      "maximum": 365
    },
    "organizationId": {
      "type": "string",
      "format": "uuid"
    }
  },
  "required": [
    "name"
  ],
  "additionalProperties": false
}
```

## Responses

- `201`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/account/tokens' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string"
}'
```
