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

# Agent Keys

## Approve Agent Key

> Authorize an Agent Key to sign delegated trading requests for an approved account scope.

```json
{"openapi":"3.0.3","info":{"title":"UniX API","version":"1.11.0"},"tags":[{"name":"Agent Keys"}],"servers":[{"url":"https://api.unixtrade.pro/v1","description":"Production"}],"paths":{"/account/approve-agent":{"post":{"tags":["Agent Keys"],"summary":"Approve Agent Key","operationId":"approveAgent","description":"Authorize an Agent Key to sign delegated trading requests for an approved account scope.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["agent_address","authorized_address","valid_days","label","address","nonce","expires_after","signature"],"properties":{"agent_address":{"type":"string","description":"New Agent Key's Ethereum address."},"authorized_address":{"type":"string","description":"Account being delegated to. Must be the signer's own address or a sub-account."},"valid_days":{"type":"integer","minimum":1,"maximum":180,"description":"Validity in days. On-chain expiry = `approval_block_time + valid_days × 86400000`."},"label":{"type":"string","description":"Unique-per-authorized-account identifier. If an existing label is reused, the old Agent is immediately revoked."},"address":{"type":"string","description":"Signer (user) address."},"nonce":{"type":"integer","format":"int64"},"expires_after":{"type":"integer","format":"int64"},"signature":{"$ref":"#/components/schemas/Signature"}}}}}},"responses":{"200":{"description":"Agent Key approved","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ResponseEnvelope"},{"type":"object","properties":{"data":{"type":"object","properties":{"tx_hash":{"type":"string"},"agent_address":{"type":"string"},"label":{"type":"string"},"authorized_address":{"type":"string"},"valid_days":{"type":"integer"},"expires_at":{"type":"integer","format":"int64"},"replaced_agent_address":{"type":"string","nullable":true,"description":"Old Agent address if a same-label record was overwritten."}}}}}]}}}},"422":{"description":"Errors: `10007` (limit reached), `10009` (address already approved), `10010` (invalid authorized_address), `10011` (agent_address already has a TradeVM account)"}}}}},"components":{"schemas":{"Signature":{"type":"object","description":"ECDSA signature components `(r, s, v)` over the EIP-712 signing hash.","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex string with `0x` prefix."},"s":{"type":"string","description":"32-byte hex string with `0x` prefix."},"v":{"type":"integer","description":"Recovery identifier — typically 27 or 28.","enum":[27,28]}}},"ResponseEnvelope":{"type":"object","description":"Standard response envelope shared by every endpoint.","required":["code","msg","data"],"properties":{"code":{"type":"string","description":"`\"0\"` for success. Non-zero indicates an error code — see [Error Codes](/reference/error-codes)."},"msg":{"type":"string","description":"Empty on success; human-readable error description on failure."},"data":{"description":"Endpoint-specific payload on success; `null` on failure.","nullable":true},"trace_code":{"type":"string","description":"Backend trace identifier. Empty on success; populated on failure for support diagnostics."}}}}}}
```

## Renew Agent Key

> Renew the validity period of an existing Agent Key from the current block time.

```json
{"openapi":"3.0.3","info":{"title":"UniX API","version":"1.11.0"},"tags":[{"name":"Agent Keys"}],"servers":[{"url":"https://api.unixtrade.pro/v1","description":"Production"}],"paths":{"/account/renew-agent":{"post":{"tags":["Agent Keys"],"summary":"Renew Agent Key","operationId":"renewAgent","description":"Renew the validity period of an existing Agent Key from the current block time.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["agent_address","valid_days","address","nonce","expires_after","signature"],"properties":{"agent_address":{"type":"string"},"valid_days":{"type":"integer","minimum":1,"maximum":180},"address":{"type":"string"},"nonce":{"type":"integer","format":"int64"},"expires_after":{"type":"integer","format":"int64"},"signature":{"$ref":"#/components/schemas/Signature"}}}}}},"responses":{"200":{"description":"Agent renewed","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ResponseEnvelope"},{"type":"object","properties":{"data":{"type":"object","properties":{"tx_hash":{"type":"string"},"agent_address":{"type":"string"},"valid_days":{"type":"integer"},"expires_at":{"type":"integer","format":"int64"}}}}}]}}}}}}}},"components":{"schemas":{"Signature":{"type":"object","description":"ECDSA signature components `(r, s, v)` over the EIP-712 signing hash.","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex string with `0x` prefix."},"s":{"type":"string","description":"32-byte hex string with `0x` prefix."},"v":{"type":"integer","description":"Recovery identifier — typically 27 or 28.","enum":[27,28]}}},"ResponseEnvelope":{"type":"object","description":"Standard response envelope shared by every endpoint.","required":["code","msg","data"],"properties":{"code":{"type":"string","description":"`\"0\"` for success. Non-zero indicates an error code — see [Error Codes](/reference/error-codes)."},"msg":{"type":"string","description":"Empty on success; human-readable error description on failure."},"data":{"description":"Endpoint-specific payload on success; `null` on failure.","nullable":true},"trace_code":{"type":"string","description":"Backend trace identifier. Empty on success; populated on failure for support diagnostics."}}}}}}
```

## Revoke Agent Key

> Revoke an existing Agent Key so it can no longer sign delegated trading requests.

```json
{"openapi":"3.0.3","info":{"title":"UniX API","version":"1.11.0"},"tags":[{"name":"Agent Keys"}],"servers":[{"url":"https://api.unixtrade.pro/v1","description":"Production"}],"paths":{"/account/revoke-agent":{"post":{"tags":["Agent Keys"],"summary":"Revoke Agent Key","operationId":"revokeAgent","description":"Revoke an existing Agent Key so it can no longer sign delegated trading requests.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["agent_address","address","nonce","expires_after","signature"],"properties":{"agent_address":{"type":"string"},"address":{"type":"string"},"nonce":{"type":"integer","format":"int64"},"expires_after":{"type":"integer","format":"int64"},"signature":{"$ref":"#/components/schemas/Signature"}}}}}},"responses":{"200":{"description":"Agent revoked","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ResponseEnvelope"},{"type":"object","properties":{"data":{"type":"object","properties":{"tx_hash":{"type":"string"},"agent_address":{"type":"string"}}}}}]}}}},"422":{"description":"Errors: `10012` (Agent not found or not approved)"}}}}},"components":{"schemas":{"Signature":{"type":"object","description":"ECDSA signature components `(r, s, v)` over the EIP-712 signing hash.","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex string with `0x` prefix."},"s":{"type":"string","description":"32-byte hex string with `0x` prefix."},"v":{"type":"integer","description":"Recovery identifier — typically 27 or 28.","enum":[27,28]}}},"ResponseEnvelope":{"type":"object","description":"Standard response envelope shared by every endpoint.","required":["code","msg","data"],"properties":{"code":{"type":"string","description":"`\"0\"` for success. Non-zero indicates an error code — see [Error Codes](/reference/error-codes)."},"msg":{"type":"string","description":"Empty on success; human-readable error description on failure."},"data":{"description":"Endpoint-specific payload on success; `null` on failure.","nullable":true},"trace_code":{"type":"string","description":"Backend trace identifier. Empty on success; populated on failure for support diagnostics."}}}}}}
```

## List Authorized Agents

> Return the Agent Keys currently authorized for the requested address.

```json
{"openapi":"3.0.3","info":{"title":"UniX API","version":"1.11.0"},"tags":[{"name":"Agent Keys"}],"servers":[{"url":"https://api.unixtrade.pro/v1","description":"Production"}],"paths":{"/account/agents":{"get":{"tags":["Agent Keys"],"summary":"List Authorized Agents","operationId":"listAgents","description":"Return the Agent Keys currently authorized for the requested address.","parameters":[{"$ref":"#/components/parameters/AddressQuery"}],"responses":{"200":{"description":"Authorized Agent Keys","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ResponseEnvelope"},{"type":"object","properties":{"data":{"type":"object","properties":{"list":{"type":"array","items":{"$ref":"#/components/schemas/AccountAgent"}}}}}}]}}}}}}}},"components":{"parameters":{"AddressQuery":{"name":"address","in":"query","required":true,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"Account address (`0x`-prefixed hex)."}},"schemas":{"ResponseEnvelope":{"type":"object","description":"Standard response envelope shared by every endpoint.","required":["code","msg","data"],"properties":{"code":{"type":"string","description":"`\"0\"` for success. Non-zero indicates an error code — see [Error Codes](/reference/error-codes)."},"msg":{"type":"string","description":"Empty on success; human-readable error description on failure."},"data":{"description":"Endpoint-specific payload on success; `null` on failure.","nullable":true},"trace_code":{"type":"string","description":"Backend trace identifier. Empty on success; populated on failure for support diagnostics."}}},"AccountAgent":{"type":"object","properties":{"agent_address":{"type":"string"},"authorized_address":{"type":"string"},"label":{"type":"string"},"approved_at":{"type":"integer","format":"int64"},"expires_at":{"type":"integer","format":"int64"}}}}}}
```


---

# 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:

```
GET https://docs.unix.market/rest-api/agent-keys.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
