POST /api/v2/buyer/storefronts/{storefrontId}/sources/{sourceId}/credentials
Registers credentials for an inventory source within a storefront. Required for sources that report requiresCredentials: true. Once registered, the source reports connected: true and discovery and media buys flow through it. For OAuth sources, the response carries an oauth.authorizationUrl the buyer must visit to finish consent.
Check the source’s
requiresCredentials on the parent storefront before
calling — sources that report requiresCredentials: false don’t need this step.Request
Parameters
| Field | In | Type | Required | Notes |
|---|---|---|---|---|
storefrontId | path | integer | Yes | Storefront ID |
sourceId | path | string | Yes | Inventory source ID within the storefront |
accountIdentifier | body | string | Yes | Unique account identifier at the source (1–255) |
auth | body | object | No | Source credentials. Required for API key / JWT sources; omit for OAuth sources |
auth.type | body | enum | — | api_key (also bearer, apikey) or jwt |
auth.token | body | string | — | Required when type is api_key |
auth.privateKey, issuer, subject, keyId, scope, tokenEndpointUrl, audienceUrl | body | string | — | Required when type is jwt. Optional: algorithm (ES256, RS256), environment |
marketplaceAccount | body | boolean | No | Admin-only. When true, creates a marketplace account instead of a client account |
Response
201 Created. For API key / JWT sources, the credential is active immediately:
oauth block — visit authorizationUrl to complete consent, then refresh the storefront to confirm connected: true:
| Field | Type | Notes |
|---|---|---|
id | string | Credential record ID |
accountIdentifier | string | The buyer’s account identifier at the source |
status | string | Credential status (ACTIVE, or PENDING for OAuth) |
registeredBy | string | null | Who registered the credential |
createdAt | string | ISO 8601 timestamp |
oauth | object | Present only for OAuth sources — authorizationUrl, storefrontId, sourceId, sourceName |
Errors
400 VALIDATION_ERROR— missingaccountIdentifier, orauthmissing required fields for the source’s auth type.401 UNAUTHORIZED— missing or invalid bearer token.404 NOT_FOUND— the storefront or source does not exist or is not visible to the caller.
Related
Storefront tasks
All storefront operations
Get storefront
Confirm connected: true after registering
List credentials
All your registered credentials
Storefront object guide
OAuth flow and the seller side