API REFERENCE
Record reported listening
On this page
/api/players/eventsInternal trusted Recoup player transport. Requires its Origin plus signed flow; browser-facing same-origin app proxy forwards to API. Provider and fan attribution come from the stored session. Event UUID makes retries idempotent, listenedMs is capped at 30 seconds and checked against elapsed server time. Recording failures do not stop music.
Authentication
This endpoint does not require authentication.
Request
curl --request POST \
--url 'https://api.recoupable.dev/api/players/events' \
--header 'Content-Type: application/json' \
--data '{
"flow": "string",
"event": {
"id": "YOUR_ID",
"provider": "spotify",
"event": "connected"
}
}'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/events' \
--header 'Content-Type: application/json' \
--data '{
"flow": "string",
"event": {
"id": "YOUR_ID",
"provider": "spotify",
"event": "connected"
}
}'Request body required
application/json
flowstringrequiredmaxLength: 2048
eventobjectrequiredProperties for event
idstringrequiredformat: uuid
providerstring · enumrequiredValues: "spotify", "apple_music"
eventstring · enumrequiredValues: "connected", "playing", "paused", "stopped", "track_changed", "skip", "heartbeat", "disconnected"
trackIdstring | nullpositionMsintegerDefault: 0
minimum: 0 · maximum: 86400000
listenedMsintegerDefault: 0
minimum: 0 · maximum: 30000
Responses
200ListeningReceipt fields returned by the release player service.+
application/json
successbooleanrequiredrecordedbooleanrequiredFalse for an already-recorded retry.
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": "Record reported listening",
"description": "Internal trusted Recoup player transport. Requires its Origin plus signed flow; browser-facing same-origin app proxy forwards to API. Provider and fan attribution come from the stored session. Event UUID makes retries idempotent, listenedMs is capped at 30 seconds and checked against elapsed server time. Recording failures do not stop music.",
"security": [],
"parameters": [],
"responses": {
"200": {
"description": "ListeningReceipt fields returned by the release player service.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ListeningReceipt"
}
}
}
},
"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": [
"flow",
"event"
],
"properties": {
"flow": {
"type": "string",
"maxLength": 2048
},
"event": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"provider",
"event"
],
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"provider": {
"type": "string",
"enum": [
"spotify",
"apple_music"
]
},
"event": {
"type": "string",
"enum": [
"connected",
"playing",
"paused",
"stopped",
"track_changed",
"skip",
"heartbeat",
"disconnected"
]
},
"trackId": {
"type": [
"string",
"null"
]
},
"positionMs": {
"type": "integer",
"minimum": 0,
"maximum": 86400000,
"default": 0
},
"listenedMs": {
"type": "integer",
"minimum": 0,
"maximum": 30000,
"default": 0
}
}
}
}
}
}
}
}
}