Skip to main content

POST Create Connect Link

Issue a new private hosted Connect link for an existing member. Use authorize for new or changed consent, or relink to repair a broker identity already covered by an active grant. Earlier unfinished flows of the same purpose are closed, including unexchanged authorization codes.

Endpoint​

POST https://app.crosstrade.io/v1/api/partner/users/{external_id}/connect-link

Headers​

NameRequiredValue
AuthorizationYesBearer <partner access token> with partner:provision
Content-TypeYesapplication/json (UTF-8)
Idempotency-KeyYesUnique per logical request; 1–200 printable ASCII characters without spaces

Path parameters​

NameTypeRequiredDescription
external_idstringYesMember id used at creation; 1–64 ASCII letters, digits, periods, underscores or hyphens

Body parameters​

NameTypeRequiredDescription
purposestringYesauthorize or relink
authorizationobjectFor authorizeFresh OAuth request, including a new PKCE challenge. See authorization fields. Omit for relink

No query parameters. The body is limited to 64 KiB; unknown fields are rejected. This route is available while active or past due within grace. A revoked member needs POST Reopen Member.

Code examples​

For a new authorization, set PARTNER_TOKEN, XT_REDIRECT_URI, CODE_CHALLENGE, OAUTH_STATE and IDEMPOTENCY_KEY. Generate and retain a fresh PKCE pair with the exact body and key before sending. Replace th_8831 with your member id.

import os
import requests

body = {
"purpose": "authorize",
"authorization": {
"scope": "tv:read manage:read",
"redirect_uri": os.environ["XT_REDIRECT_URI"],
"code_challenge": os.environ["CODE_CHALLENGE"],
"code_challenge_method": "S256",
"state": os.environ["OAUTH_STATE"],
"delivery": "pickup",
},
}
response = requests.post(
"https://app.crosstrade.io/v1/api/partner/users/th_8831/connect-link",
headers={
"Authorization": f"Bearer {os.environ['PARTNER_TOKEN']}",
"Idempotency-Key": os.environ["IDEMPOTENCY_KEY"],
},
json=body,
timeout=30,
)
response.raise_for_status()
connect = response.json()["connect"]
# Store flow_id with the verifier and deliver the URL privately.
# An idempotent replay can return connect=None after the original URL expires.

For a broker repair, replace the body with this object and use a new key:

{
"purpose": "relink"
}

Relinking does not issue a new authorization code or token pair and cannot add identities outside the standing grant.

Response​

201 Created. This example starts a second authorization flow for an already connected member. No membership ETag is returned.

{
"success": true,
"member": {
"external_id": "th_8831",
"uid": "k3Qz9pLa",
"email": "member@example.com",
"name": "Jamie Rivera",
"status": "connected",
"ownership_verified": true,
"version": 1,
"environments": [
"demo"
],
"metadata": {},
"seat": {
"started": "2026-10-15T14:02:11Z",
"ended": null
},
"created": "2026-10-15T14:02:11Z",
"authorization": {
"status": "pending",
"flow_id": "pcf_1122334455aa",
"purpose": "authorize",
"generation": 2
},
"grant": {
"version": 1,
"active": true
}
},
"connect": {
"flow_id": "pcf_1122334455aa",
"purpose": "authorize",
"url": "https://app.crosstrade.io/v1/connect/xt_tk_...",
"expires": "2026-10-16T09:10:00Z"
},
"meta": {
"requestId": "preq_2f3e4d5c6b7a8900"
}
}

The URL lasts 10 minutes and is redeemed by one browser. Result replay lasts 24 hours but returns connect: null after the original URL expires. Use a new request and key for a fresh URL. See Hosted Connect for the member's browser flow.

Errors​

StatusErrorMeaning
400validation_failedInvalid purpose, authorization, path or idempotency key
401unauthorizedInvalid partner token
403insufficient_scope, partner_not_enabled, partner_suspended, partner_disabled, partner_not_activeScope or service policy blocks a new link
404member_not_foundUnknown member
409conflictMember is revoked or expired
409grant_requiredRelink requires an existing active grant; request authorization instead
409partner_tag_requiredSet your business name first
409idempotency_conflict, idempotency_in_progress, idempotency_key_expiredSee replay rules
413 / 415validation_failedBody too large or unsupported content type/encoding
429rate_limited, too_many_concurrent_requestsHonor Retry-After
503outcome_unknownRetain and retry the exact request and key

See Partner errors for common availability errors and response shapes.