> For the complete documentation index, see [llms.txt](https://docs.nexus.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nexus.xyz/api-reference/agents/register-agent.md).

# POST /agents/register

Register an agent key

Register an agent key.

`operationId`: `registerAgent`

> **Not reachable through CCXT.** Nexus-specific trading-agent registration. No CCXT equivalent — the closest unified concepts are API-key management, which CCXT deliberately leaves to the venue.

**Authentication:** a wallet signature carried in the request body — no `X-API-Key` and no session token. API-key headers are ignored here and do not substitute for the signature. The description below says what to sign; an unsigned call is refused with `401`.

Register a new agent key for your wallet. An agent is an Ethereum-derived keypair that can sign trading requests on your behalf without exposing your main wallet. The registration is authorized by an EIP-712 signature from the wallet that will own the agent — no session token required.

EIP-712 domain: `{ name: 'Nexus Exchange', version: '1', chainId: <per-network chain id>, salt: <per-network salt> }`. The `chainId` is a REQUEST field — you state it, and a wrong value costs you a registration (it recovers to the wrong signer) but proves nothing about which network you meant it for, since nothing server-side pins it. `salt` (ENG-11924) is what actually does that: `keccak256(network)` for `network` = `testnet`/`mainnet`/`local` (see `x-nexus-networks.networks.*.signing_domain.salt`, published directly there since it is a pure function of the network identifier, not server config — compute it locally or read it, the two must agree). Read `signing_domain.chain_id` from `/metadata` for the network you are connected to instead of hardcoding it, and refuse to sign if you cannot obtain it — a wrong domain either fails verification or produces a signature that is valid somewhere you did not intend. Mainnet is the real-funds exchange on Ethereum Mainnet, not a Nexus L1 chain, so a Nexus L1 chain id is never correct there. Because `salt` differs per network, a registration signed for one network does not verify on another; never replay one across networks. Typed data type: `RegisterAgent { address agent, uint64 expiresAt, uint64 nonce }`.

## Request body

**Required.** [`AgentRegistrationRequest`](/api-reference/guides/schemas.md#agentregistrationrequest) — `application/json`.

```json
{
  "wallet": "0xAbCdEf0123456789AbCdEf0123456789AbCdEf01",
  "agent": "0x1234567890AbCdEf1234567890AbCdEf12345678",
  "expires_at": 1782000000000,
  "nonce": 1,
  "signature": "0xdeadbeef..."
}
```

## Responses

| Status | Body                                                                                      | Meaning                                                                                              |
| ------ | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `200`  | [`AgentRegistrationResponse`](/api-reference/guides/schemas.md#agentregistrationresponse) | Agent registered                                                                                     |
| `400`  | — *(no schema declared)*                                                                  | Bad request: bad\_wallet, bad\_agent, expiry\_out\_of\_range \[1 d, 90 d from now], or invalid\_json |
| `401`  | — *(no schema declared)*                                                                  | signature\_invalid or signer\_mismatch — the EIP-712 signature did not recover to the claimed wallet |
| `409`  | — *(no schema declared)*                                                                  | duplicate\_agent — the agent address is already registered to this wallet                            |

## Example

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST 'https://exchange.nexus.xyz/api/exchange/agents/register' \
  -H 'Content-Type: application/json' \
  -d '{
  "wallet": "0xAbCdEf0123456789AbCdEf0123456789AbCdEf01",
  "agent": "0x1234567890AbCdEf1234567890AbCdEf12345678",
  "expires_at": 1782000000000,
  "nonce": 1,
  "signature": "0xdeadbeef..."
}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

headers = {
    "Content-Type": "application/json"
}
payload = {
    "wallet": "0xAbCdEf0123456789AbCdEf0123456789AbCdEf01",
    "agent": "0x1234567890AbCdEf1234567890AbCdEf12345678",
    "expires_at": 1782000000000,
    "nonce": 1,
    "signature": "0xdeadbeef..."
}

response = requests.post("https://exchange.nexus.xyz/api/exchange/agents/register", headers=headers, json=payload)
response.raise_for_status()
print(response.json())
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
const response = await fetch("https://exchange.nexus.xyz/api/exchange/agents/register", {
  method: "POST",
  headers: {
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "wallet": "0xAbCdEf0123456789AbCdEf0123456789AbCdEf01",
    "agent": "0x1234567890AbCdEf1234567890AbCdEf12345678",
    "expires_at": 1782000000000,
    "nonce": 1,
    "signature": "0xdeadbeef..."
  }),
});
if (!response.ok) throw new Error(`${response.status} ${await response.text()}`);
console.log(await response.json());
```

{% endtab %}
{% endtabs %}

***

<sub>Generated from</sub> <sub></sub><sub>`eng/apps/exchange/api/openapi.json`</sub> <sub></sub><sub>(spec</sub> <sub></sub><sub>`0.9.76`</sub><sub>). Do not edit by hand — regenerate with</sub> <sub></sub><sub>`python3 product/docs/tools/api-reference/generate.py`</sub><sub>. Hand-authored context lives in the Guides pages.</sub>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.nexus.xyz/api-reference/agents/register-agent.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
