curl -X POST "$LEGEND_API_BASE/v1/api-keys" \
-H "Content-Type: application/json" \
--data @signed-request.json
Legend documentation
Request parameters and responses for api key actions.
All paths are relative to the base URL. See authentication and errors and idempotency.
POST /v1/api-keys
Requires the main account owner’s EIP-712 signature. Copy-wallet key creation is rejected with main_account_required; non-mainnet grants are rejected with mainnet_required.
| Field | Type | Required | Details |
|---|---|---|---|
consent | object | Yes | |
consent.account | string | Yes | Format: uuid |
consent.network | string | Yes | hyperliquid_mainnet |
consent.key_hash | string | Yes | |
consent.policy | object | Yes | |
consent.policy.scopes | array | Yes | |
consent.issued_at | integer | Yes | Maximum: 8640000000000000 |
consent.expires_at | null | No | Default: null |
signature | string | Yes |
curl -X POST "$LEGEND_API_BASE/v1/api-keys" \
-H "Content-Type: application/json" \
--data @signed-request.json
| Field | Type | Required | Details |
|---|---|---|---|
object | string | Yes | api_key |
account | string | Yes | |
network | string | Yes | |
key_hash | string | Yes | |
scopes | array | Yes | |
expires_at | string or null | Yes |
See the OpenAPI schema for nested response objects and validation patterns.
Illustrative successful response:
{
"object": "api_key",
"account": "00000000-0000-4000-8000-000000000001",
"network": "hyperliquid_mainnet",
"key_hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"scopes": ["trading:read", "trading:write"],
"expires_at": null
}
POST /v1/api-keys/revoke
Requires the account owner’s EIP-712 signature.
| Field | Type | Required | Details |
|---|---|---|---|
account | string | Yes | Format: uuid |
key_hash | string | Yes | |
signature | string | Yes |
curl -X POST "$LEGEND_API_BASE/v1/api-keys/revoke" \
-H "Content-Type: application/json" \
--data @signed-request.json
| Field | Type | Required | Details |
|---|---|---|---|
object | string | Yes | api_key |
key_hash | string | Yes | |
revoked | boolean | Yes | True |
See the OpenAPI schema for nested response objects and validation patterns.
Illustrative successful response:
{
"object": "api_key",
"key_hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"revoked": true
}