---
title: "Register a server agent and get its token"
method: POST
path: "/agents"
tags: ["Agents"]
---

# Register a server agent and get its token

`POST /agents`

## Request

- Base URL: `https://realuptime.io/api/v1`
- URL: `https://realuptime.io/api/v1/agents`
- Auth: HTTP bearer

token is an account credential and is returned by this response only. Export it on the server as REALUPTIME_AGENT_TOKEN and run installCommand there; the command reads the token from that variable.

## Request body

- object
  - `name` string, required

## Response `201`

The registered agent, its token (shown once), and the install command.

- object
  - `agent` object, required
    - `id` string, required
    - `name` string, required
    - `created_at` string, required
  - `token` string, required
  - `installCommand` string, required

## Other responses

- `400`: Malformed body or name. - `RU-3001` Invalid check request: https://realuptime.io/kb/errors/ru-3001
- `401`: Missing, invalid, or revoked API key. - `RU-1001` Missing API credentials: https://realuptime.io/kb/errors/ru-1001 - `RU-1002` Invalid or revoked API key: https://realuptime.io/kb/errors/ru-1002
- `403`: Every server the account's plan covers already has an agent. This key is read-only, or this key is IP-restricted and the request came from outside its allowlist. - `RU-2009` Server allowance exhausted: https://realuptime.io/kb/errors/ru-2009 - `RU-1004` API key is read-only: https://realuptime.io/kb/errors/ru-1004 - `RU-1007` API key is restricted to an IP allowlist: https://realuptime.io/kb/errors/ru-1007
- `429`: Per-key rate limit exceeded, a Free account's per-account request budget exceeded, or too many failed authentication attempts. - `RU-2003` API write rate limit exceeded: https://realuptime.io/kb/errors/ru-2003 - `RU-2001` Too many failed authentication attempts: https://realuptime.io/kb/errors/ru-2001

---

[API](https://skmtc.dev/realuptime/apis/realuptime-api-v1.md) · [All operations](https://skmtc.dev/realuptime/apis/realuptime-api-v1/llms.txt) · [OpenAPI document](https://skmtc.dev/realuptime/apis/realuptime-api-v1/revisions/51e481084700?raw)
