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

FieldTypeDescription
idstringThe connection_id of a live connection.

Request body

FieldTypeRequiredDescription
credentialsobjectYesThe new broker credentials; any you send replace the stored ones and the rest are kept. Unknown keys are rejected.
credentials.api_keystringNoYour broker API key, 1 to 200 characters.
credentials.api_secretstringNoYour broker API secret, 1 to 200 characters.
credentials.access_tokenstringNoThe broker's access token for today, 1 to 2000 characters.
credentials.client_idstringNoYour broker client id, 1 to 100 characters.
credentials.base_urlstringNoBroker 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

FieldTypeDescription
connection_idstringThe connection's id.
rotatedbooleanTrue 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.