Skip to main content

POST Pick Up Authorization Code

Collect the authorization code after a member allows your app on hosted Connect. This endpoint is for flows created with delivery: pickup. It is safe to poll every few seconds or call after an authorization.granted event.

Endpoint​

POST https://app.crosstrade.io/v1/api/partner/users/{external_id}/authorizations/{flow_id}/code

Headers​

NameRequiredValue
AuthorizationYesBearer <partner access token> with partner:provision

No Idempotency-Key is required. Send no body, including no empty JSON object. There are no query parameters.

Path parameters​

NameTypeRequiredDescription
external_idstringYesMember id used at creation
flow_idstringYesThe connect.flow_id returned by create, connect-link or reopen

Code examples​

Set PARTNER_TOKEN and FLOW_ID, and replace th_8831 with your member id. These examples make one pickup request; 202 means wait before trying again.

import os
import requests

flow_id = os.environ["FLOW_ID"]
response = requests.post(
f"https://app.crosstrade.io/v1/api/partner/users/th_8831/authorizations/{flow_id}/code",
headers={"Authorization": f"Bearer {os.environ['PARTNER_TOKEN']}"},
timeout=15,
)
response.raise_for_status()
authorization = response.json()["authorization"]
print(response.status_code, authorization["status"])
if authorization["status"] == "code_ready":
code = authorization["code"] # Exchange server-side; do not log the code.

Responses​

The member has not allowed the app yet.

{
"success": true,
"authorization": {
"status": "pending",
"flow_id": "pcf_a1b2c3d4e5f6"
},
"meta": {
"requestId": "preq_1a2b3c4d5e6f7a80"
}
}

See the code exchange example. Pickup repeats return the same code while it remains valid and unexchanged; token exchange is single-use.

Errors​

StatusErrorMeaning
400validation_failedInvalid path, unsupported query parameter or unexpected body
401unauthorizedInvalid partner token
403insufficient_scope, partner_not_enabled, partner_past_due, partner_suspended, partner_disabled, partner_not_activeScope or service policy blocks code pickup
404not_foundFlow is unknown, belongs to another member/client, or uses redirect delivery
410flow_closedFlow/code expired, was denied, revoked or superseded; obtain a new authorization link
429rate_limited, too_many_concurrent_requestsHonor Retry-After

See Partner errors for common availability errors and response shapes.