API reference / Depository / Broker
Rotate daily token
One uniform call for every broker's daily access-token expiry.
POST
/v1/broker/connections/:id/token- Authentication
- Bearer token
- Scope
broker:write
Before you integrate
- Brokers expire their access token every day. Call this each morning with the new access_token so the connection keeps working.
- Sandbox connections have no token and are refused; a revoked or unknown connection returns NOT_FOUND.
Path parameters
| Field | Type | Description |
|---|---|---|
id | string | The connection_id of a live connection. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
credentials | object | Yes | The new broker credentials; any you send replace the stored ones and the rest are kept. Unknown keys are rejected. |
credentials.api_key | string | No | Your broker API key, 1 to 200 characters. |
credentials.api_secret | string | No | Your broker API secret, 1 to 200 characters. |
credentials.access_token | string | No | The broker's access token for today, 1 to 2000 characters. |
credentials.client_id | string | No | Your broker client id, 1 to 100 characters. |
credentials.base_url | string | No | Broker host URL, up to 300 characters; only for brokers on the xts platform. |
Sample code
Set your key in the GRAPPI_API_KEY environment variable. Sample values are placeholders.
curl -sS -X POST 'https://grappi.ai/v1/broker/connections/bconn_.../token' \
-H "Authorization: Bearer $GRAPPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"credentials": {
"access_token": "fresh_daily_token"
}
}'Sample response
{
"request_id": "req_01HZY3K8M2",
"result": {
"connection_id": "bconn_a1b2c3d4e5f60718",
"rotated": true
}
}Response fields
| Field | Type | Description |
|---|---|---|
connection_id | string | The connection's id. |
rotated | boolean | True when the credentials were replaced. |
Errors
Every failure has the same shape. A call that fails on our side or at the data source is refunded to your wallet; a "no record found" answer is charged. See the error reference.