- Hedging: read your hedge books and positions, send hedge requests, and check where they stand.
- Automations: start runs of automations set to run from the API, and hand a waiting run what it’s waiting for.
You need a workspace API key with the right scope. A workspace admin creates one under Settings → API. See API keys.
Base URL and authentication
{workspace} with your workspace’s subdomain; the exact base URL is under Settings → API → Connection. Requests and responses use JSON.
Send the key as a Bearer token on every request:
Scopes
Each endpoint needs one scope. A key without it gets a403.
POST /hedge-requests also needs the Hedging module, and both automation endpoints need the Automations module. While the module is off, those calls return 403. See Modules.
Errors
Request bodies have a fixed schema: unknown fields are refused, so a misspelled field fails with a422 instead of being ignored. Errors always come back as JSON with an error message; a 422 also lists each problem in issues:
field is the path to the field that failed, or null when the problem isn’t tied to one field.
Idempotency
POST /hedge-requests and POST /agents/{id}/run take your own external_id: any string up to 200 characters that identifies the request in your system, such as a purchase order number.
- Same
external_id, same body: Mercora returns what it created the first time, with200instead of201. If you lose a response, for example on a timeout, just send the request again. - Same
external_id, different body:409. Use a newexternal_idfor a new request.
id for every object it creates; read objects back by it, for example GET /hedge-requests/{id}. If you lose a hedge request’s id, resend the original POST with the same external_id to get it back.