SpaceMediaSpaceMedia
Production and tooling

SDK Generation

The Enterprise API is documented with an OpenAPI contract that can be used to generate internal or customer-specific clients. Official SDK packages should follow the same public contract and naming rules as the API documentation.

SDK authors should also read Rate Limits and Retries, Delivery Statuses, and LLM Context. Generated clients should protect customers from duplicate writes and unsafe assumptions.

Contract rules

  • Use the published OpenAPI file as the source of truth.
  • Keep operation names stable and descriptive.
  • Preserve public reference fields such as user_id, role_id, artist_id, release_id, track_id, checkout_id, smartlink_id, and review_id.
  • Do not expose numeric record references, organization references, provider payment references, or duplicate id and uuid fields.
  • Treat embedded_checkout_token as short-lived payment data and never as a durable checkout reference.
  • Treat audio_file_id as a temporary upload reference. Use the returned track_id after creating a track.

Client behavior

  • Send Authorization: Bearer ... on every protected request.
  • Retry only idempotent reads automatically. For create, checkout, submit, publish, install, and top-up actions, retry only after checking the returned state.
  • Parse errors on 422 responses and return field-level validation feedback to operators.
  • Read meta.current_page, meta.last_page, meta.per_page, and meta.total on paginated responses.
  • Keep X-User-Id support explicit and limited to supported same-organization catalog workflows.

Customer generation

Customers can generate their own client from the published OpenAPI file. Pin the downloaded spec in your build so SDK behavior changes only when your team intentionally updates it.

curl --output spacemedia-enterprise-openapi.json \
  'https://docs.spacemedia.uk/delivery-api/openapi.json'

Recommended generator settings:

AreaRecommendation
Operation namesPreserve operationId values from the spec.
Unknown fieldsKeep unknown response fields accessible so new non-breaking fields do not break clients.
ErrorsMap API error envelopes to typed exceptions or result objects.
PaginationExpose data and meta together.
UploadsSupport multipart requests for audio, chunked audio, cover art, and document uploads.
RetriesDisable automatic retries for writes unless the SDK first reads current state.
TokensStore bearer tokens securely and refresh before expiry.

SDK readiness checklist

AreaExpectation
AuthenticationToken exchange, token expiry, and bearer header handling are implemented.
Errors401, 403, 404, 409, and 422 are mapped to useful client exceptions or result objects.
PaginationCollection helpers expose pagination metadata and stop conditions.
UploadsAudio upload helpers return audio_file_id; track creation helpers return track_id.
CheckoutsHosted and embedded checkout helpers store checkout_id and protect embedded_checkout_token.
Release workflowArtist, release, track, license, distribution, readiness, and submit helpers preserve workflow order.
NamingPublic field names match the examples in this documentation.

Common questions

Which contract should I generate from? The published OpenAPI specification only. Do not hand-edit a generated client to work around a contract you disagree with; report the mismatch instead.

Should the SDK rename fields to match my language conventions? Keep the public reference names intact in the wire model. Renaming release_id to something generic is how integrations lose the ability to reconcile with support.

How should a generated client handle unknown enum values? Pass them through. Strict enums break on the next compatible addition.

Should the SDK retry automatically? Reads yes, writes no. See Rate Limits and Retries for retry safety by operation type.

Was this page helpful?

On this page