API REFERENCE
Exchange player Spotify authorization
On this page
/api/players/spotify/sessionInternal trusted Recoup player endpoint, not an external website integration. Requires a fresh Spotify listening session, PKCE code/verifier, API-configured OAuth app and required scopes. Captures Spotify-confirmed available profile/email for the registered artist/workspace. Returns provider credentials only to the trusted Recoup browser, plus player_session_id and fanCapture; no email/fan ID in the response. Tokens are not persisted in fan tables. A failed capture reports fanCapture=false while valid playback credentials remain usable. Authorization is not email marketing consent.
Authentication
This endpoint does not require authentication.
Request
curl --request POST \
--url 'https://api.recoupable.dev/api/players/spotify/session' \
--header 'Content-Type: application/json' \
--data '{
"code": "string",
"verifier": "string",
"flow": "string"
}'Try it
Fill in the fields, send the request from your browser, and read the live response. The curl below updates as you type.
curl --request POST \
--url 'https://recoup-api.vercel.app/api/players/spotify/session' \
--header 'Content-Type: application/json' \
--data '{
"code": "string",
"verifier": "string",
"flow": "string"
}'Request body required
application/json
codestringrequiredminLength: 1 · maxLength: 2048
verifierstringrequiredminLength: 43 · maxLength: 128
flowstringrequiredminLength: 1 · maxLength: 2048
Responses
200SpotifyPlayerSession fields returned by the release player service.+
application/json
access_tokenstringrequiredPrivate provider access token, delivered only to the trusted Recoup browser. Never embed in an artist website.
refresh_tokenstringOptional private provider refresh token; same trusted-browser boundary.
expires_innumberrequiredtoken_typestringscopestringrequiredplayer_session_idstringrequiredformat: uuid
fanCapturebooleanrequiredTrue only after the verified fan identity was persisted.
400Invalid input+
application/json
errorstringrequiredstatusstring401Missing/invalid authentication or failed provider authorization+
application/json
errorstringrequiredstatusstring403Workspace, origin, or session access denied+
application/json
errorstringrequiredstatusstring404Player not available+
application/json
errorstringrequiredstatusstring429Request rate limit exceeded+
application/json
errorstringrequiredstatusstring503Feature/configuration temporarily unavailable+
application/json
errorstringrequiredstatusstringFull specification
Download the OpenAPI file for complete schemas, constraints, and examples.
Download players.jsonView operation source
{
"summary": "Exchange player Spotify authorization",
"description": "Internal trusted Recoup player endpoint, not an external website integration. Requires a fresh Spotify listening session, PKCE code/verifier, API-configured OAuth app and required scopes. Captures Spotify-confirmed available profile/email for the registered artist/workspace. Returns provider credentials only to the trusted Recoup browser, plus player_session_id and fanCapture; no email/fan ID in the response. Tokens are not persisted in fan tables. A failed capture reports fanCapture=false while valid playback credentials remain usable. Authorization is not email marketing consent.",
"security": [],
"parameters": [],
"responses": {
"200": {
"description": "SpotifyPlayerSession fields returned by the release player service.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SpotifyPlayerSession"
}
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PlayerError"
}
}
}
},
"401": {
"description": "Missing/invalid authentication or failed provider authorization",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PlayerError"
}
}
}
},
"403": {
"description": "Workspace, origin, or session access denied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PlayerError"
}
}
}
},
"404": {
"description": "Player not available",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PlayerError"
}
}
}
},
"429": {
"description": "Request rate limit exceeded",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PlayerError"
}
}
}
},
"503": {
"description": "Feature/configuration temporarily unavailable",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PlayerError"
}
}
}
}
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"required": [
"code",
"verifier",
"flow"
],
"properties": {
"code": {
"type": "string",
"minLength": 1,
"maxLength": 2048
},
"verifier": {
"type": "string",
"minLength": 43,
"maxLength": 128
},
"flow": {
"type": "string",
"minLength": 1,
"maxLength": 2048
}
}
}
}
}
}
}