Accounts & Keys
Issue an API key
A new key for a user. The secret is shown once and stored only as a hash.
POST/keysself-hosted · access token · manage_credentials
Self-hosted. Served by synpath serve on your own machine or host, which must be running; the engine and its order types live there. Nothing on this page runs on Synpath's servers.
Request body
| Name | Type | Description |
|---|---|---|
user_id | string | |
label | string | Where the key lives, for the audit log. |
Response
The key, secret included, once. Status 201.
import os
import httpx
TOKEN = os.environ["SYNPATH_ACCESS_TOKEN"]
r = httpx.post("http://127.0.0.1:8000/trading/keys", headers={"Authorization": f"Bearer {TOKEN}"}, json={"user_id":"u_alice","label":"alice-laptop"})
r.raise_for_status()
print(r.json())200
{
"id": "k_a3e2",
"user_id": "u_alice",
"label": "alice-laptop",
"prefix": "sk_a3e2",
"secret": "sk_a3e2_9f8c...shown once"
}
