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

# Create API Key

## Create API Key

> Creates or replaces an API key / Agent key authorization. Requires user wallet signing.\
> \
> \*\*Signing Type: B\*\*\
> \
> \*\*Rate-limit weight\*\*\
> \
> \- \*\*By IP:\*\* \`1\`\
> \- \*\*By address:\*\* \`40\`

```json
{"openapi":"3.1.0","info":{"title":"Ticko API","version":"1.0"},"tags":[{"name":"API Key","description":"Manage Agent keys (API keys): approve, revoke, renew, and list. Write endpoints are signed (Signing Type B) with the user wallet key."}],"servers":[{"url":"https://api.testnet.ticko.xyz/v1","description":"Testnet"}],"paths":{"/account/approve-agent":{"post":{"operationId":"createAPIKey","summary":"Create API Key","tags":["API Key"],"description":"Creates or replaces an API key / Agent key authorization. Requires user wallet signing.\n\n**Signing Type: B**\n\n**Rate-limit weight**\n\n- **By IP:** `1`\n- **By address:** `40`","requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"type":"object","properties":{"agent_address":{"type":"string","description":"API key / Agent key address. Must not already have a TradeVM account."},"authorized_address":{"type":"string","description":"Account the key is authorized to operate. Must be the signer wallet address or one of its sub-account addresses."},"valid_days":{"type":"integer","description":"Validity period, from 1 to 180 days."},"label":{"type":"string","description":"Key label, unique within the authorized account. Must match `^[A-Za-z0-9](?:[A-Za-z0-9_-]{0,30}[A-Za-z0-9])?$`. If the label already exists, the new Agent key replaces the old one."}},"required":["agent_address","authorized_address","valid_days","label"]},{"$ref":"#/components/schemas/SigningFieldsB"}]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"type":"object","properties":{"data":{"type":"object","properties":{"tx_hash":{"type":"string","description":"Transaction hash."},"agent_address":{"type":"string","description":"API key / Agent key address."},"label":{"type":"string","description":"Key label."},"authorized_address":{"type":"string","description":"Authorized account."},"valid_days":{"type":"integer","description":"Validity period in days."},"expires_at":{"type":"integer","description":"Expiration timestamp."},"replaced_agent_address":{"type":["string","null"],"description":"Replaced key address when the label already existed."}}}}}]}}}}}}}},"components":{"schemas":{"SigningFieldsB":{"type":"object","required":["ticko_chain","signature_chain_id","signer_address","nonce","expires_after","signature"],"properties":{"ticko_chain":{"type":"string","enum":["Testnet"],"description":"Ticko business environment. Use `Testnet`. (`Mainnet` is coming soon.) Encoded into the signed EIP-712 struct as `tickoChain`."},"signature_chain_id":{"type":"integer","enum":[1],"description":"EIP-712 domain chain ID. Currently only `1` (Ethereum) is supported. Sets the domain `chainId`; it is not part of the signed struct."},"signer_address":{"type":"string","description":"Address of the user wallet key that signs the request."},"nonce":{"type":"integer","description":"Millisecond timestamp nonce. Must be unique per signer."},"expires_after":{"type":"integer","description":"Millisecond timestamp after which the request expires."},"signature":{"$ref":"#/components/schemas/Signature"}}},"Signature":{"type":"object","required":["r","s","v"],"description":"ECDSA signature over the EIP-712 `signing_hash`.","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","enum":[27,28],"description":"Recovery identifier, `27` or `28`."}}},"Envelope":{"type":"object","description":"Standard success response envelope. `data` is defined per endpoint.","properties":{"code":{"type":"string","description":"`\"0\"` on success."},"msg":{"type":"string","description":"Empty on success."},"trace_code":{"type":"string","description":"Backend trace identifier. Empty on success."}}}}}}
```


---

# 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.ticko.xyz/api-documentation/agent-key/rest-api/create-api-key.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.
