# Quickstart

> Get a single ready for stores from your own backend: upload a cover and a master, describe the release, submit it, and see it accepted into the catalog with Spotify, Apple Music and four other stores selected, all in sandbox. It takes about twenty minutes.

Source: https://docs.releaseapi.com/quickstart.html

Sandbox · A tenant key · cURL, Node.js 18+ or Python 3 · A JPEG and a WAV

**At a glance**

- It takes about twenty small HTTP calls, all made in sandbox with one tenant key.
- You choose the release id, and the draft and the live release share it.
- Your tenant needs its own GTIN and ISRC ranges, or acceptance fails. [Register them](https://docs.releaseapi.com/quickstart.html#register-ranges) first.
- RecordJet’s team reviews the release. In sandbox, ask your RecordJet contact to review it.
- Delivery starts by itself once the release is accepted, and you follow it on the journal. Sandbox stops before the stores, so the sync stays queued.

## What you’ll build

You’ll build a one-track release, **Midnight Static** by **Nova Reyes**, owned by a customer who receives 100% of its earnings. By the end you’ll have touched every object a distribution integration is built from:

*Diagram: Sequence of calls in the quickstart: check key, register code ranges, create owner, upload files, write and validate the draft, submit, RecordJet accepts, read the journal, automatic delivery, read the live release.* Every call in the quickstart, numbered by step. Steps 1–9 are yours. Review happens at RecordJet, and the store sync starts on its own once the release is accepted.

New to the vocabulary? [How ReleaseAPI works](https://docs.releaseapi.com/concepts.html) explains each of these in a page. You don’t need it to follow along.

## Before you start

- **A sandbox tenant.** Your RecordJet contact creates it and invites you to the [sandbox dashboard](https://app-sandbox.releaseapi.com). If you can sign in there, you have one. (Client accounts create their own: [Create a tenant](https://docs.releaseapi.com/client-accounts.html#create-a-tenant).)
- **A tenant key** with the `MEMBER` or `ADMIN` role. Create it in the sandbox dashboard and export it as `RELEASEAPI_KEY`. This is the key your product backend will use.
- **Your label’s barcode and recording-code prefixes.** Every release needs a barcode (GTIN) and every track a recording code (ISRC). ReleaseAPI makes them from number blocks you own:

  - a **GS1 company prefix**: the block of barcode numbers your company licenses from its national GS1 office (GS1 is the organisation behind retail barcodes);
  - an **ISRC registrant code**: the 2-letter country code plus 3-character code your national ISRC agency gave your label.

  ReleaseAPI doesn’t hand out codes, in sandbox either. You register your blocks once per tenant, in [the first step below](https://docs.releaseapi.com/quickstart.html#register-ranges).
- **A cover**: a square JPEG or PNG, 1,500–8,000 px a side, in RGB colour.
- **A master**: a stereo WAV or FLAC, 16-, 24- or 32-bit, 44.1–192 kHz. MP3 and AAC aren’t accepted. Stores pay only for plays of 30 seconds or more, so use a full-length track.

Sandbox runs everything up to the stores: files, validation, review, acceptance, codes and the ledger work as in production, but the sync is never processed, so nothing is delivered. Experiment freely.

The Node.js and Python tabs share a small helper, so every later snippet stays short. `BASE` already ends in `/v1`, so paths in the snippets leave it out: `api("GET", "/me/token")` calls `$BASE/me/token`. Where a page writes `GET /v1/…`, drop the `/v1` (the helper strips it if you forget). Set it up once:

**Setup**

**cURL**

```bash
export RELEASEAPI_KEY="your-sandbox-key"
export BASE="https://api-sandbox.releaseapi.com/v1"
export RUN=$(date +%s)   # makes externalIds unique, so you can run this again
# export RELEASEAPI_CLIENT_KEY="…"   # client accounts only; used by the "Client accounts:" sections
# needs jq (https://jqlang.github.io/jq/) and uuidgen
```

**Node.js**

```javascript
// quickstart.mjs — Node.js 18+ (built-in fetch)
import { readFile } from "node:fs/promises";
import { randomUUID } from "node:crypto";

const BASE = "https://api-sandbox.releaseapi.com/v1";
const RUN = Date.now().toString(36); // makes externalIds unique, so you can run this again

// path starts after /v1 (a leading /v1 is dropped); pass another key only for client-key calls
async function api(method, path, body, key = process.env.RELEASEAPI_KEY) {
  const res = await fetch(BASE + path.replace(/^\/v1(?=\/)/, ""), {
    method,
    headers: {
      "X-API-KEY": key,
      ...(body !== undefined && { "Content-Type": "application/json" }),
    },
    body: body === undefined ? undefined : JSON.stringify(body),
  });
  const data = await res.json().catch(() => ({}));
  if (!res.ok) {
    // the error code is in message, error or exception (see API basics → Errors)
    const code = data.message ?? data.error ?? data.exception ?? `HTTP_${res.status}`;
    throw new Error(`${method} ${path} → ${res.status} ${code}`);
  }
  return data;
}

const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
```

**Python**

```python
# quickstart.py — Python 3 with requests
import os, time, uuid, requests

BASE = "https://api-sandbox.releaseapi.com/v1"
RUN = str(int(time.time()))  # makes externalIds unique, so you can run this again
session = requests.Session()
session.headers["X-API-KEY"] = os.environ["RELEASEAPI_KEY"]

def api(method, path, body=None, key=None):
    if path.startswith("/v1/"):  # paths start after /v1; a leading /v1 is dropped
        path = path[3:]
    headers = {"X-API-KEY": key} if key else {}
    r = session.request(method, BASE + path, json=body, headers=headers)
    if not r.ok:
        try:
            data = r.json()
        except ValueError:
            data = {}
        # the error code is in message, error or exception (see API basics → Errors)
        code = (data.get("message") or data.get("error") or data.get("exception")
                or f"HTTP_{r.status_code}")
        raise RuntimeError(f"{method} {path} → {r.status_code} {code}")
    return r.json()
```

1. **Check your key**

   Ask the API who you are. The answer names your client (RecordJet, for a RecordJet tenant), your tenant and the key’s roles (`token.accessRights`). If this fails, nothing else will work.

   `GET /v1/me/token`

   **cURL**

   ```bash
   curl $BASE/me/token -H "X-API-KEY: $RELEASEAPI_KEY"
   ```

   **Node.js**

   ```javascript
   const me = await api("GET", "/me/token");
   console.log(`Working in tenant "${me.tenant.displayName}" as ${me.token.accessRights.join(", ")}`);
   ```

   **Python**

   ```python
   me = api("GET", "/me/token")
   print(f'Working in tenant "{me["tenant"]["displayName"]}" as {", ".join(me["token"]["accessRights"])}')
   ```

   **Response**

   ```json
   {
     "token": {
       "clientId": "7c4a91e2-5d3b-4f08-a6e1-93b2c0d4e517",
       "tenantId": "b55ec853-f63b-4cb3-9c2f-868b4eb42f95",
       "description": "quickstart",
       "accessRights": ["MEMBER"],
       "id": "0f6a2b9e-6c1d-4e8a-9a51-2b7f3d0c8e44",
       "createdAt": "2026-10-05T08:00:00Z"
     },
     "client": {
       "displayName": "RecordJet",
       "id": "7c4a91e2-5d3b-4f08-a6e1-93b2c0d4e517",
       "...": "..."
     },
     "tenant": {
       "displayName": "Lowtide Records",
       "id": "b55ec853-f63b-4cb3-9c2f-868b4eb42f95",
       "...": "..."
     }
   }
   ```

2. **Register your code ranges (once per tenant)**

   Acceptance gives the release a GTIN and the track an ISRC from ranges registered on your tenant. A new tenant has none, so check, and register what’s missing. An ISRC range is for one calendar year, and assignment always uses the current one.

   **GTIN and ISRC ranges**

   **cURL**

   ```bash
   # Check what the tenant has (both lists empty on a new tenant)
   curl $BASE/distribution/identifiers/gtin-ranges -H "X-API-KEY: $RELEASEAPI_KEY"
   curl $BASE/distribution/identifiers/isrc-ranges -H "X-API-KEY: $RELEASEAPI_KEY"

   # Register a block from YOUR GS1 company prefix (40 + 63361: replace)
   curl -X POST $BASE/distribution/identifiers/gtin-ranges \
     -H "X-API-KEY: $RELEASEAPI_KEY" -H "Content-Type: application/json" \
     -d '{"countryCode": 40, "companyNumber": 63361,
          "articleFrom": 1, "articleTo": 999}'

   # Register this year's block from YOUR ISRC registrant code (DE + XW9: replace)
   curl -X POST $BASE/distribution/identifiers/isrc-ranges \
     -H "X-API-KEY: $RELEASEAPI_KEY" -H "Content-Type: application/json" \
     -d "{\"countryKey\": \"DE\", \"ownerKey\": \"XW9\", \"year\": $(date +%Y),
          \"recordingFrom\": 1, \"recordingTo\": 999}"
   ```

   **Node.js**

   ```javascript
   const rangeYear = new Date().getUTCFullYear(); // ISRC ranges are per year
   const gtinRanges = await api("GET", "/distribution/identifiers/gtin-ranges");
   const isrcRanges = await api("GET", "/distribution/identifiers/isrc-ranges");

   if (gtinRanges.items.length === 0) {
     await api("POST", "/distribution/identifiers/gtin-ranges", {
       countryCode: 40,      // first 2 digits of YOUR GS1 company prefix
       companyNumber: 63361, // next 5 digits of YOUR prefix
       articleFrom: 1,
       articleTo: 999,
     });
   }
   if (!isrcRanges.items.some((r) => r.year === rangeYear)) {
     await api("POST", "/distribution/identifiers/isrc-ranges", {
       countryKey: "DE", // YOUR registrant code: country …
       ownerKey: "XW9",  // … and the 3 characters after it
       year: rangeYear,
       recordingFrom: 1,
       recordingTo: 999,
     });
   }
   ```

   **Python**

   ```python
   import datetime

   range_year = datetime.date.today().year  # ISRC ranges are per year
   gtin_ranges = api("GET", "/distribution/identifiers/gtin-ranges")
   isrc_ranges = api("GET", "/distribution/identifiers/isrc-ranges")

   if not gtin_ranges["items"]:
       api("POST", "/distribution/identifiers/gtin-ranges", {
           "countryCode": 40,       # first 2 digits of YOUR GS1 company prefix
           "companyNumber": 63361,  # next 5 digits of YOUR prefix
           "articleFrom": 1,
           "articleTo": 999,
       })
   if not any(r["year"] == range_year for r in isrc_ranges["items"]):
       api("POST", "/distribution/identifiers/isrc-ranges", {
           "countryKey": "DE",  # YOUR registrant code: country …
           "ownerKey": "XW9",   # … and the 3 characters after it
           "year": range_year,
           "recordingFrom": 1,
           "recordingTo": 999,
       })
   ```

   **Response**

   ```json
   {
     "items": [
       {
         "countryCode": 40,
         "companyNumber": 63361,
         "articleFrom": 1,
         "articleTo": 999,
         "articleNext": 1,
         "id": "6d2e8f41-3b7a-4c09-9e15-a8b7c6d5e4f3",
         "...": "..."
       }
     ],
     "hasMore": false,
     "limit": 100,
     "offset": 0
   }
   ```

   Use your own numbers, not the ones above. A range may not overlap any range already registered anywhere in ReleaseAPI, by any account (`GTIN_RANGE_OVERLAPS_EXISTING`, `ISRC_RANGE_OVERLAPS_EXISTING`), so numbers copied from these docs may already be taken. Use a block you won’t need for real releases. [Register your ranges](https://docs.releaseapi.com/identifiers.html#register-ranges) has every field and error.

3. **Create the owner and a wallet**

   Every release has an **owner**, a customer who receives its share of the money. Here that’s the artist. A **wallet** is where money collects, and each track says which wallets split it. Create one of each, with your own id in `externalId`. An `externalId` must be unique in your tenant, which is why the snippets add `RUN`: a second run with the same values fails with `400 EXTERNAL_ID_ALREADY_DEFINED`.

   `POST /v1/distribution/accounting/customers`

   **cURL**

   ```bash
   CUSTOMER_ID=$(curl -s -X POST $BASE/distribution/accounting/customers \
     -H "X-API-KEY: $RELEASEAPI_KEY" -H "Content-Type: application/json" \
     -d "{
       \"externalId\": \"artist-$RUN\",
       \"details\": {\"firstName\": \"Nova\", \"lastName\": \"Reyes\",
                     \"email\": \"nova@example.com\"}
     }" \
     | jq -r .id)

   WALLET_ID=$(curl -s -X POST $BASE/distribution/accounting/wallets \
     -H "X-API-KEY: $RELEASEAPI_KEY" -H "Content-Type: application/json" \
     -d "{\"customerId\": \"$CUSTOMER_ID\", \"externalId\": \"artist-$RUN-main\"}" \
     | jq -r .id)
   ```

   **Node.js**

   ```javascript
   const customer = await api("POST", "/distribution/accounting/customers", {
     externalId: `artist-${RUN}`,
     details: { firstName: "Nova", lastName: "Reyes", email: "nova@example.com" },
   });
   const wallet = await api("POST", "/distribution/accounting/wallets", {
     customerId: customer.id,
     externalId: `artist-${RUN}-main`,
   });
   ```

   **Python**

   ```python
   customer = api("POST", "/distribution/accounting/customers", {
       "externalId": f"artist-{RUN}",
       "details": {"firstName": "Nova", "lastName": "Reyes", "email": "nova@example.com"},
   })
   wallet = api("POST", "/distribution/accounting/wallets", {
       "customerId": customer["id"],
       "externalId": f"artist-{RUN}-main",
   })
   ```

   **Response**

   ```json
   {
     "id": "0b1c2d3e-4f50-4a61-8b72-93c4d5e6f708",
     "clientId": "7c4a91e2-5d3b-4f08-a6e1-93b2c0d4e517",
     "tenantId": "b55ec853-f63b-4cb3-9c2f-868b4eb42f95",
     "details": { "firstName": "Nova", "lastName": "Reyes", "email": "nova@example.com" },
     "externalId": "artist-mgd3k2x1",
     "createdAt": "2026-10-05T08:02:11.402Z"
   }
   ```

4. **Upload the cover and the master**

   Each file takes three steps: ask for an upload URL, `PUT` the bytes to it (the URL is pre-signed, so no API key), then tell ReleaseAPI you’re done. The cover goes under `/covers`, the master under `/masters`.

   **Upload a cover**

   **cURL**

   ```bash
   # upload KIND ID_FIELD FILE: announce, send the bytes, start processing
   upload() {
     START=$(curl -s -X POST $BASE/distribution/files/$1/upload/put/start \
       -H "X-API-KEY: $RELEASEAPI_KEY" -H "Content-Type: application/json" \
       -d "{\"originalFileName\": \"$3\"}")
     ID=$(echo "$START" | jq -r ".$2")
     # the bytes go to the pre-signed URL, with no API key
     curl -s -X PUT --upload-file "$3" "$(echo "$START" | jq -r .url)" > /dev/null
     curl -s -X POST $BASE/distribution/files/$1/upload/put/finish/$ID \
       -H "X-API-KEY: $RELEASEAPI_KEY" > /dev/null
     echo "$ID"
   }

   COVER_ID=$(upload covers coverFileId midnight-static.jpg)
   MASTER_ID=$(upload masters masterFileId midnight-static.wav)
   ```

   **Node.js**

   ```javascript
   async function upload(kind, idField, path) {
     const start = await api("POST", `/distribution/files/${kind}/upload/put/start`, {
       originalFileName: path,
     });
     const put = await fetch(start.url, { method: "PUT", body: await readFile(path) });
     if (!put.ok) throw new Error(`Upload of ${path} failed: ${put.status}`);
     await api("POST", `/distribution/files/${kind}/upload/put/finish/${start[idField]}`);
     return start[idField];
   }

   const coverId = await upload("covers", "coverFileId", "midnight-static.jpg");
   const masterId = await upload("masters", "masterFileId", "midnight-static.wav");
   ```

   **Python**

   ```python
   def upload(kind, id_field, path):
       start = api("POST", f"/distribution/files/{kind}/upload/put/start",
                   {"originalFileName": path})
       with open(path, "rb") as f:
           requests.put(start["url"], data=f).raise_for_status()
       api("POST", f"/distribution/files/{kind}/upload/put/finish/{start[id_field]}")
       return start[id_field]

   cover_id = upload("covers", "coverFileId", "midnight-static.jpg")
   master_id = upload("masters", "masterFileId", "midnight-static.wav")
   ```

   **Response**

   ```json
   {
     "coverFileId": "5b1c0e3a-1d2e-4f56-9a78-0b1c2d3e4f50",
     "url": "https://…amazonaws.com/…?X-Amz-Signature=…"
   }
   ```

   Processing takes seconds for a cover and up to a few minutes for a long master. Wait for `status` `SUCCESS`. If it’s `INVALID`, `failureReasons` says why (for example `NO_SQUARE`).

   `GET /v1/distribution/files/covers/{coverFileId}`

   **cURL**

   ```bash
   # wait_for_file KIND ID: poll until processing has finished
   wait_for_file() {
     KIND=$1; ID=$2
     while :; do
       STATUS=$(curl -s $BASE/distribution/files/$KIND/$ID \
         -H "X-API-KEY: $RELEASEAPI_KEY" | jq -r .status)
       echo "$KIND $STATUS"
       case $STATUS in SUCCESS|INVALID|ERROR) break ;; esac
       sleep 2
     done
   }

   wait_for_file covers $COVER_ID
   wait_for_file masters $MASTER_ID
   ```

   **Node.js**

   ```javascript
   async function waitForFile(kind, id) {
     for (;;) {
       const file = await api("GET", `/distribution/files/${kind}/${id}`);
       if (file.status === "SUCCESS") return file;
       if (file.status === "INVALID" || file.status === "ERROR")
         throw new Error(`${kind} ${id}: ${file.status} ${file.failureReasons}`);
       await sleep(2000);
     }
   }

   await waitForFile("covers", coverId);
   await waitForFile("masters", masterId);
   ```

   **Python**

   ```python
   def wait_for_file(kind, file_id):
       while True:
           f = api("GET", f"/distribution/files/{kind}/{file_id}")
           if f["status"] == "SUCCESS":
               return f
           if f["status"] in ("INVALID", "ERROR"):
               raise RuntimeError(f"{kind} {file_id}: {f['status']} {f.get('failureReasons')}")
           time.sleep(2)

   wait_for_file("covers", cover_id)
   wait_for_file("masters", master_id)
   ```

   **Response**

   ```json
   {
     "id": "5b1c0e3a-1d2e-4f56-9a78-0b1c2d3e4f50",
     "clientId": "7c4a91e2-5d3b-4f08-a6e1-93b2c0d4e517",
     "tenantId": "b55ec853-f63b-4cb3-9c2f-868b4eb42f95",
     "status": "SUCCESS",
     "originalFileName": "midnight-static.jpg",
     "details": { "format": "JPEG", "width": 3000, "height": 3000, "byteSize": 869659 },
     "analysis": { "palette": ["#1b1f3a", "#e94f64", "#f6c177"] },
     "processedAt": "2026-10-05T08:03:40.120Z",
     "createdAt": "2026-10-05T08:03:31.884Z"
   }
   ```

5. **Write the draft**

   A draft is the release as you’re preparing it. **You choose its id**: generate a UUID, store it on your release row and use it from now on. The live release keeps the same id. Each track gets your id too, and points back through `details.releaseId`, which must match the id in the URL. The snippets build a complete single that passes validation:

   **Build the draft body**

   **cURL**

   ```bash
   RELEASE_ID=$(uuidgen | tr 'A-Z' 'a-z')   # store this on your release row
   TRACK_ID=$(uuidgen | tr 'A-Z' 'a-z')
   RELEASE_DATE=$(date -u -d '+28 days' +%F 2>/dev/null || date -u -v+28d +%F)  # four weeks ahead (GNU date, or macOS)

   jq -n --arg release "$RELEASE_ID" --arg track "$TRACK_ID" \
         --arg date "$RELEASE_DATE" \
         --arg cover "$COVER_ID" --arg master "$MASTER_ID" \
         --arg customer "$CUSTOMER_ID" --arg wallet "$WALLET_ID" --arg run "$RUN" '{
     release: {
       externalId: ("release-" + $run),
       details: { title: "Midnight Static", language: "EN", genrePrimary: "ELECTRONIC" },
       contributions: [
         { role: "ARTIST", name: "Nova Reyes", providerArtistId: "artist-nova-reyes" }
       ],
       flags: { explicit: "NONE", isLive: false, isRemix: false, isDJRemix: false,
                isCompilation: false, hasNonExclusives: false },
       files: { coverFileId: $cover },
       distribution: {
         originalReleaseDate: $date,
         releaseDateTime: ($date + "T00:00:00"),
         stores: ["SPOTIFY", "APPLE_MUSIC", "AMAZON_STREAMING",
                  "DEEZER", "TIDAL", "YOUTUBE_MUSIC"],
         countriesMode: "EXCLUDE", countries: [],
         pricingTier: "MID"
       },
       rightsholders: { labelName: "Lowtide Records",
                        cLineYear: ($date[0:4] | tonumber), cLineHolder: "Lowtide Records",
                        pLineYear: ($date[0:4] | tonumber), pLineHolder: "Lowtide Records" },
       accounting: { ownerCustomerId: $customer }
     },
     tracks: [ {
       id: $track,
       externalId: ("track-" + $run + "-1"),
       details: { releaseId: $release, volumeNumber: 1, trackNumber: 1,
                  title: "Midnight Static", audioLanguage: "EN", genrePrimary: "ELECTRONIC" },
       contributions: [
         { role: "ARTIST", name: "Nova Reyes", providerArtistId: "artist-nova-reyes" },
         { role: "VOCALS", name: "Nova Reyes" },
         { role: "COMPOSER", name: "Mara Lind" },
         { role: "LYRICIST", name: "Mara Lind" },
         { role: "PRODUCER", name: "Jon Aster" }
       ],
       flags: { explicit: "NONE", isLive: false, isRemix: false, isDJRemix: false,
                isCover: false, isPublicDomain: false },
       files: { masterFileId: $master },
       rightsholders: { labelName: "Lowtide Records",
                        pLineYear: ($date[0:4] | tonumber), pLineHolder: "Lowtide Records" },
       accounting: {
         shareRules: [ { shares: [ { walletId: $wallet, sharePerMio: 1000000 } ] } ]
       }
     } ]
   }' > draft.json
   ```

   **Node.js**

   ```javascript
   const releaseId = randomUUID(); // store this on your release row
   const trackId = randomUUID();
   // about four weeks ahead
   const releaseDate = new Date(Date.now() + 28 * 864e5).toISOString().slice(0, 10);
   const rightsYear = Number(releaseDate.slice(0, 4)); // ℗ and © year: the release year
   const label = "Lowtide Records";
   const artist = { role: "ARTIST", name: "Nova Reyes", providerArtistId: "artist-nova-reyes" };

   const draft = {
     release: {
       externalId: `release-${RUN}`,
       details: { title: "Midnight Static", language: "EN", genrePrimary: "ELECTRONIC" },
       contributions: [artist],
       flags: { explicit: "NONE", isLive: false, isRemix: false, isDJRemix: false,
                isCompilation: false, hasNonExclusives: false },
       files: { coverFileId: coverId },
       distribution: {
         originalReleaseDate: releaseDate,
         releaseDateTime: `${releaseDate}T00:00:00`,
         stores: ["SPOTIFY", "APPLE_MUSIC", "AMAZON_STREAMING",
                  "DEEZER", "TIDAL", "YOUTUBE_MUSIC"],
         countriesMode: "EXCLUDE",
         countries: [],
         pricingTier: "MID",
       },
       rightsholders: { labelName: label,
                        cLineYear: rightsYear, cLineHolder: label,
                        pLineYear: rightsYear, pLineHolder: label },
       accounting: { ownerCustomerId: customer.id },
     },
     tracks: [{
       id: trackId,
       externalId: `track-${RUN}-1`,
       details: { releaseId, volumeNumber: 1, trackNumber: 1,
                  title: "Midnight Static", audioLanguage: "EN", genrePrimary: "ELECTRONIC" },
       contributions: [
         artist,
         { role: "VOCALS", name: "Nova Reyes" },
         { role: "COMPOSER", name: "Mara Lind" },
         { role: "LYRICIST", name: "Mara Lind" },
         { role: "PRODUCER", name: "Jon Aster" },
       ],
       flags: { explicit: "NONE", isLive: false, isRemix: false, isDJRemix: false,
                isCover: false, isPublicDomain: false },
       files: { masterFileId: masterId },
       rightsholders: { pLineYear: rightsYear, pLineHolder: label, labelName: label },
       accounting: {
         shareRules: [{ shares: [{ walletId: wallet.id, sharePerMio: 1_000_000 }] }],
       },
     }],
   };
   ```

   **Python**

   ```python
   release_id = str(uuid.uuid4())  # store this on your release row
   track_id = str(uuid.uuid4())
   # about four weeks ahead
   release_date = (datetime.date.today() + datetime.timedelta(days=28)).isoformat()
   rights_year = int(release_date[:4])  # ℗ and © year: the release year
   label = "Lowtide Records"
   artist = {"role": "ARTIST", "name": "Nova Reyes", "providerArtistId": "artist-nova-reyes"}

   draft = {
       "release": {
           "externalId": f"release-{RUN}",
           "details": {"title": "Midnight Static", "language": "EN",
                       "genrePrimary": "ELECTRONIC"},
           "contributions": [artist],
           "flags": {"explicit": "NONE", "isLive": False, "isRemix": False, "isDJRemix": False,
                     "isCompilation": False, "hasNonExclusives": False},
           "files": {"coverFileId": cover_id},
           "distribution": {
               "originalReleaseDate": release_date,
               "releaseDateTime": f"{release_date}T00:00:00",
               "stores": ["SPOTIFY", "APPLE_MUSIC", "AMAZON_STREAMING",
                          "DEEZER", "TIDAL", "YOUTUBE_MUSIC"],
               "countriesMode": "EXCLUDE",
               "countries": [],
               "pricingTier": "MID",
           },
           "rightsholders": {"cLineYear": rights_year, "cLineHolder": label,
                             "pLineYear": rights_year, "pLineHolder": label, "labelName": label},
           "accounting": {"ownerCustomerId": customer["id"]},
       },
       "tracks": [{
           "id": track_id,
           "externalId": f"track-{RUN}-1",
           "details": {"releaseId": release_id, "volumeNumber": 1, "trackNumber": 1,
                       "title": "Midnight Static", "audioLanguage": "EN",
                       "genrePrimary": "ELECTRONIC"},
           "contributions": [
               artist,
               {"role": "VOCALS", "name": "Nova Reyes"},
               {"role": "COMPOSER", "name": "Mara Lind"},
               {"role": "LYRICIST", "name": "Mara Lind"},
               {"role": "PRODUCER", "name": "Jon Aster"},
           ],
           "flags": {"explicit": "NONE", "isLive": False, "isRemix": False, "isDJRemix": False,
                     "isCover": False, "isPublicDomain": False},
           "files": {"masterFileId": master_id},
           "rightsholders": {"pLineYear": rights_year, "pLineHolder": label, "labelName": label},
           "accounting": {
               "shareRules": [{"shares": [{"walletId": wallet["id"], "sharePerMio": 1_000_000}]}],
           },
       }],
   }
   ```

   A few things in that body are easy to miss, and each one is a validation error if you leave it out:

   - Every `ARTIST` contributor needs a `providerArtistId`. Despite the name, this is *your* stable id for the artist, not a store’s. Use the same value on every release by the same artist. Spotify and Apple Music artist ids go in separate fields (see [Artist profiles](https://docs.releaseapi.com/identifiers.html#artist-profiles)).
   - All six release flags and all six track flags must be set explicitly. `false` is a fine answer, but a missing flag is not.
   - Each track needs at least a `COMPOSER` and, for current releases, a `PRODUCER`.
   - For a single, the track’s title and main artists must match the release’s.
   - `releaseDateTime` has no time zone, because stores release at local midnight in each country. In production, leave at least two weeks between submit and release date, more if you want the release pitched to playlists.
   - `EXCLUDE` with an empty country list means worldwide.
   - `cLineYear` and `pLineYear` are the years the rights date from. For a new recording, that’s the release year.
   - `labelName` and the ℗ and © holders are required. Always use a label name, never just the artist’s name: a self-released artist uses their own imprint (for example “Nova Reyes Music”), and a platform acting as the label uses its company or imprint name.
   - The body has no GTIN or ISRC, because ReleaseAPI assigns both from your tenant’s ranges when the release is accepted (see [Before you start](https://docs.releaseapi.com/quickstart.html#before-you-start)). Send `identifiers.gtin` and `identifiers.isrc` if you already have codes.

   Now write it under the id you generated:

   `PUT /v1/distribution/drafts/full-releases/{draftReleaseId}`

   **cURL**

   ```bash
   curl -X PUT $BASE/distribution/drafts/full-releases/$RELEASE_ID \
     -H "X-API-KEY: $RELEASEAPI_KEY" -H "Content-Type: application/json" \
     -d @draft.json
   ```

   **Node.js**

   ```javascript
   const full = await api("PUT", `/distribution/drafts/full-releases/${releaseId}`, draft);
   console.log(full.release.status); // "DRAFT"
   ```

   **Python**

   ```python
   full = api("PUT", f"/distribution/drafts/full-releases/{release_id}", draft)
   print(full["release"]["status"])  # "DRAFT"
   ```

   **Response**

   ```json
   {
     "release": {
       "id": "6f2d8c4a-93b1-4e57-a0c2-5d81e7f43b19",
       "clientId": "7c4a91e2-5d3b-4f08-a6e1-93b2c0d4e517",
       "tenantId": "b55ec853-f63b-4cb3-9c2f-868b4eb42f95",
       "status": "DRAFT",
       "details": { "title": "Midnight Static", "language": "EN", "genrePrimary": "ELECTRONIC" },
       "generated": { "artistLine": "Nova Reyes" },
       "...": "..."
     },
     "coverFile": {
       "id": "5b1c0e3a-1d2e-4f56-9a78-0b1c2d3e4f50", "status": "SUCCESS", "...": "..."
     },
     "tracks": [
       {
         "track": { "id": "9c0b1a22-77e1-4c0a-8f11-223344556677", "...": "..." },
         "masterFile": {
           "id": "aa11bb22-cc33-4d44-8e55-667788990011", "status": "SUCCESS", "...": "..."
         }
       }
     ]
   }
   ```

   > **A write replaces the whole draft:** Each `PUT` is the complete release. A section you leave out is cleared, and a track that isn’t in `tracks` is deleted. That’s what makes the call safe to retry: send the full body every time.

6. **Check it before you submit**

   Saving never fails because a draft is incomplete. Validation runs when you ask, and again on submit. Only `CRITICAL` and `ERROR` findings block submission, so an empty list means you’re clear:

   `GET /v1/distribution/drafts/releases/{id}/validation`

   **cURL**

   ```bash
   curl $BASE/distribution/drafts/releases/$RELEASE_ID/validation \
     -H "X-API-KEY: $RELEASEAPI_KEY"
   ```

   **Node.js**

   ```javascript
   const issues = await api("GET", `/distribution/drafts/releases/${releaseId}/validation`);
   const blocking = issues.filter((i) => ["CRITICAL", "ERROR"].includes(i.check.severity));
   if (blocking.length) throw new Error(blocking.map((i) => i.check.name).join(", "));
   ```

   **Python**

   ```python
   issues = api("GET", f"/distribution/drafts/releases/{release_id}/validation")
   blocking = [i for i in issues if i["check"]["severity"] in ("CRITICAL", "ERROR")]
   if blocking:
       raise RuntimeError(", ".join(i["check"]["name"] for i in blocking))
   ```

   **Response**

   ```json
   [
     {
       "check": {
         "severity": "REVIEW",
         "name": "RELEASE_COVER_TEXT_DOES_NOT_MATCH_TITLE_OR_ARTISTS",
         "description": "text on coverFile does not match title or artists names"
       },
       "context": { "trackId": null, "bookletId": null, "hint": null }
     },
     {
       "check": {
         "severity": "REVIEW",
         "name": "TRACK_MASTER_FILE_TRUE_PEAK_SPIKES",
         "description": "true peak exceeds recommended values"
       },
       "context": { "trackId": "9c0b1a22-77e1-4c0a-8f11-223344556677", "bookletId": null, "hint": null }
     }
   ]
   ```

   `WARNING` and `REVIEW` findings, like the two in the sample response (a real sandbox answer), never block. You can show them to your user if you like, since the reviewer sees them too, but you don’t have to.

7. **Submit for review**

   Set the draft’s status to `REVIEW`. Validation runs once more, synchronously: if anything blocks, you get `400 RELEASE_HAS_VALIDATION_ERRORS` and nothing changes. Otherwise the draft is locked and queued.

   `PUT /v1/distribution/drafts/releases/{id}/status`

   **cURL**

   ```bash
   curl -X PUT $BASE/distribution/drafts/releases/$RELEASE_ID/status \
     -H "X-API-KEY: $RELEASEAPI_KEY" -H "Content-Type: application/json" \
     -d '{"status": "REVIEW"}'
   ```

   **Node.js**

   ```javascript
   const submitted = await api("PUT", `/distribution/drafts/releases/${releaseId}/status`, {
     status: "REVIEW",
   });
   console.log(submitted.review.result); // "OPEN": waiting for a reviewer
   ```

   **Python**

   ```python
   submitted = api("PUT", f"/distribution/drafts/releases/{release_id}/status",
                   {"status": "REVIEW"})
   print(submitted["review"]["result"])  # "OPEN": waiting for a reviewer
   ```

   **Response**

   ```json
   {
     "id": "6f2d8c4a-93b1-4e57-a0c2-5d81e7f43b19",
     "status": "REVIEW",
     "review": {
       "requestedAt": "2026-10-05T08:06:12.031Z",
       "result": "OPEN"
     },
     "...": "..."
   }
   ```

   Submit only goes through once every file is `SUCCESS`, so file processing is already behind you. From here, **RecordJet’s review team** accepts or rejects the release. You don’t call anything for it. Three fields on the draft describe this, and they’re easy to mix up: `status` is where the draft is (`DRAFT`, `REVIEW`, `REJECTED`), `review.status` is a short automatic step before the release reaches the reviewer (`PREPARE`, then `READY`), and `review.result` is the decision (`OPEN` until someone decides). For your users, [one status](https://docs.releaseapi.com/delivery.html#status-for-users) is enough.

   > **Ask for your sandbox review:** Tell your RecordJet contact which test release to review. In production, leave time for RecordJet’s review before the release date.

   **If you run your own client account**

   Review decisions are made at client level, so a client account reviews its own tenants’ releases: in the dashboard, or through the API with a *client* key (a tenant key gets `401`). The decision is applied once file preparation has finished (`review.status` `READY`).

   `PUT /v1/distribution/drafts/releases/{id}/review`

   ```bash
   curl -X PUT $BASE/distribution/drafts/releases/$RELEASE_ID/review \
     -H "X-API-KEY: $RELEASEAPI_CLIENT_KEY" -H "Content-Type: application/json" \
     -d '{"result": "ACCEPTED"}'
   ```

   Small edits to a release that’s already live, like a new release date or a removed store, are accepted automatically. See [Submit and review](https://docs.releaseapi.com/review.html).

8. **Wait for the outcome on the journal**

   The decision lands on the **journal**, the event log every integration reads. Here you follow only this release’s stream by passing its id (draft and catalog release share it). In production you read your tenant’s whole stream from a stored cursor, and a webhook tells you when to read it ([Events and webhooks](https://docs.releaseapi.com/events.html)).

   `POST /v1/journal/query`

   **cURL**

   ```bash
   curl -X POST $BASE/journal/query \
     -H "X-API-KEY: $RELEASEAPI_KEY" -H "Content-Type: application/json" \
     -d "{\"elementId\": \"$RELEASE_ID\"}" \
     | jq -r '.[] | "\(.elementType) \(.eventType) \(.eventName)"'
   ```

   **Node.js**

   ```javascript
   // Reads this release's events once. Run it again later until it isn't "pending".
   async function checkDecision(id) {
     const events = await api("POST", "/journal/query", { elementId: id });
     for (const e of events) {
       if (e.eventName === "DRAFT_RELEASE_ACCEPTED") return "accepted";
       if (e.eventName === "DRAFT_RELEASE_REJECTED") return "rejected";
     }
     return "pending";
   }

   console.log(await checkDecision(releaseId)); // "pending" until RecordJet decides
   ```

   **Python**

   ```python
   # Reads this release's events once. Run it again later until it isn't "pending".
   def check_decision(element_id):
       events = api("POST", "/journal/query", {"elementId": element_id})
       for e in events:
           if e.get("eventName") == "DRAFT_RELEASE_ACCEPTED":
               return "accepted"
           if e.get("eventName") == "DRAFT_RELEASE_REJECTED":
               return "rejected"
       return "pending"

   print(check_decision(release_id))  # "pending" until RecordJet decides
   ```

   **Response**

   ```json
   [
     {
       "clientId": "7c4a91e2-5d3b-4f08-a6e1-93b2c0d4e517",
       "tenantId": "b55ec853-f63b-4cb3-9c2f-868b4eb42f95",
       "eventType": "UPDATED",
       "eventName": "DRAFT_RELEASE_SUBMITTED",
       "elementType": "DRAFT_RELEASE",
       "elementId": "6f2d8c4a-93b1-4e57-a0c2-5d81e7f43b19",
       "id": "2b7c1f60-9a8e-4c3d-b1f2-0e9d8c7b6a51",
       "createdAt": "2026-10-05T08:06:13.114210Z"
     },
     {
       "eventType": "UPDATED",
       "eventName": "DRAFT_RELEASE_REVIEW_READY",
       "elementType": "DRAFT_RELEASE",
       "elementId": "6f2d8c4a-93b1-4e57-a0c2-5d81e7f43b19",
       "id": "4f0a9c31-6b2d-4e8f-a1c7-9d3e5b2f8a60",
       "createdAt": "2026-10-05T08:06:23.247315Z",
       "...": "..."
     },
     {
       "eventType": "DELETED",
       "eventName": "DRAFT_RELEASE_ACCEPTED",
       "elementType": "DRAFT_RELEASE",
       "elementId": "6f2d8c4a-93b1-4e57-a0c2-5d81e7f43b19",
       "id": "8d41a7c2-3e5f-4b6a-9c0d-1e2f3a4b5c6d",
       "createdAt": "2026-10-05T08:41:57.630118Z",
       "...": "..."
     }
   ]
   ```

   After a few seconds, `DRAFT_RELEASE_REVIEW_READY` appears. It means the release has reached the reviewer’s queue, not that it has been accepted. A person from the review team makes that decision later, so there’s no need to keep a process waiting. Checking about once an hour is enough. The release keeps its place in the queue while you wait. A release’s own stream holds only a few events, so one read without a cursor sees all of them.

   Match on `eventName`. Acceptance writes several `DRAFT_RELEASE_ACCEPTED` events at once: a `DELETED` one on the draft (the draft has become the catalog release) and a `CREATED` one on the new `RELEASE`. The check stops at the first one it finds. A production consumer reacts to acceptance on the `RELEASE` event and to rejection on the `DRAFT_RELEASE` event whose `eventType` is `OTHER`. [Submit and review](https://docs.releaseapi.com/review.html#wait-for-the-outcome) explains why.

   If the answer is `rejected`, read the draft with `` api("GET", `/distribution/drafts/releases/${releaseId}`) ``. `review.rejectionReasons` lists what to fix. Write the draft again and resubmit it under the same id.

9. **Read the live release**

   The draft is now a **catalog release** with the *same id* (the draft endpoints return 404). The GTIN and ISRC are assigned, the ledger knows who earns, and a sync to the stores is already queued.

   `GET /v1/distribution/catalog/full-releases/{releaseId}`

   **cURL**

   ```bash
   curl $BASE/distribution/catalog/full-releases/$RELEASE_ID \
     -H "X-API-KEY: $RELEASEAPI_KEY"
   ```

   **Node.js**

   ```javascript
   const live = await api("GET", `/distribution/catalog/full-releases/${releaseId}`);
   const { identifiers, status, storeSnapshot } = live.release;
   console.log(identifiers.gtin, status, storeSnapshot.isSynced);
   ```

   **Python**

   ```python
   live = api("GET", f"/distribution/catalog/full-releases/{release_id}")
   r = live["release"]
   print(r["identifiers"]["gtin"], r["status"], r["storeSnapshot"]["isSynced"])
   ```

   **Response**

   ```json
   {
     "release": {
       "id": "6f2d8c4a-93b1-4e57-a0c2-5d81e7f43b19",
       "status": "UNRELEASED",
       "identifiers": { "gtin": "4063361000016" },
       "storeSnapshot": {
         "deliveredStores": [],
         "syncRequest": "FULL_SYNC",
         "syncRequestPriority": 1,
         "isSynced": false,
         "storeChanges": [
           { "store": "SPOTIFY", "firstSelectedAt": "2026-10-05T08:41:57.601Z", "lastSelectedAt": "2026-10-05T08:41:57.601Z", "...": "..." },
           "..."
         ],
         "...": "..."
       },
       "generated": { "artistLine": "Nova Reyes", "trackCount": 1, "...": "..." },
       "...": "..."
     },
     "tracks": [
       {
         "track": {
           "id": "9c0b1a22-77e1-4c0a-8f11-223344556677",
           "identifiers": { "isrc": "DEXW92600001" },
           "...": "..."
         }
       }
     ]
   }
   ```

   This is the response right after acceptance, and in sandbox it stays that way. Three fields tell the delivery story:

   - `storeSnapshot.syncRequest` is the queued sync (`FULL_SYNC` for a new release). In production a scheduler picks it up within seconds, opens the delivery requests and clears it. Sandbox doesn’t process sync requests, so it stays set.
   - `storeSnapshot.deliveredStores` lists every store ReleaseAPI has contacted for this release, and when. A store shows up as soon as its delivery is requested, and gets `lastDeliveryAt` once the store has accepted it. In sandbox it stays empty.
   - `storeSnapshot.isSynced` is `true` when every store you selected has the current version.

   `/catalog/full-releases/{id}` returns the release with its tracks, and `/catalog/releases/{id}` returns the release alone, with the same `storeSnapshot`. To turn all of this into one status for your users (in review, rejected, delivering, live), use the table in [One status for your users](https://docs.releaseapi.com/delivery.html#status-for-users).

   In production, ReleaseAPI then opens one **delivery request** per provider and retries failures itself. The journal shows `RELEASE_SYNC_STARTED` and `DELIVERY_REQUEST_SUCCESS`. `status` moves from `UNRELEASED` to `RELEASED` on the release date. See [Deliver to stores](https://docs.releaseapi.com/delivery.html).

## What you built

With a few dozen lines of code you’ve built the core loop of a distribution product:

| You did | ReleaseAPI did |
| --- | --- |
| Created a customer and a wallet | Gave the release an owner and a place for the money to land |
| Uploaded two files | Checked format, size and audio quality, and analysed the cover and the master |
| Wrote one draft under your own id | Kept it editable until you were ready, with validation on demand |
| Submitted it | Ran the review, assigned a GTIN and an ISRC, wrote the ledger |
| Read the journal | Created the catalog release, assigned the GTIN and ISRC, wrote the ledger and queued the sync (production delivers it; sandbox doesn’t) |

Point the same code at `https://api.releaseapi.com/v1` with a production key and it ships for real, once the points below are settled.

## Before you go live

Sandbox lets you skip a few things that production needs. Settle these with your RecordJet contact before your first real release:

| You need | Why | Read |
| --- | --- | --- |
| A production tenant and keys | Sandbox and production don’t share accounts, keys or data. Your RecordJet contact creates the production tenant. | [Environments](https://docs.releaseapi.com/api-basics.html#environments) |
| The list of stores you offer | A release can only select stores your account delivers to. For a RecordJet tenant, those are the stores RecordJet delivers to; for a client account, they’re the stores your own delivery profiles cover. Otherwise validation fails with `RELEASE_STORE_NOT_COVERED_BY_DELIVERY_PROFILE`. | [Stores and providers](https://docs.releaseapi.com/delivery.html#stores-and-providers) |
| Your own GTIN and ISRC ranges, or codes on each draft | Ranges come from your own GS1 prefix and ISRC registrant code. Each range belongs to one tenant, and each ISRC range covers one year. A tenant without them can’t have a release accepted. | [Identifiers and artists](https://docs.releaseapi.com/identifiers.html) |
| A journal consumer | Replace the one-off check above with a cursor-based worker and a webhook. | [Build a reliable consumer](https://docs.releaseapi.com/events.html#consumer) |
| A plan for release dates | RecordJet reviews every new release, and stores need time to ingest it. Submit at least two weeks before the release date, more if you want it pitched to playlists. `distribution.isPriority` requests a priority review, which is billed (prices on [releaseapi.com](https://releaseapi.com/#pricing)). Client accounts review their own releases. | [Submit and review](https://docs.releaseapi.com/review.html) |
| A plan for the money | RecordJet imports the monthly store statements, and you decide how you pay your users from the results. | [How money flows](https://docs.releaseapi.com/royalties.html) |

## If something went wrong

| You saw | What it means | Fix |
| --- | --- | --- |
| `401 UNAUTHORIZED` | The key is missing, unknown, from the other environment, or the endpoint is for client keys only. | Check `GET /me/token` and the base URL. |
| `400 TENANT_ID_NEEDED_FOR_CLIENT_REQUEST` or `SAME_TENANT_ID_NEEDED_ON_ALL_REQUESTS` | Client accounts only: you used a client key on a create call without naming the tenant. | Add `tenantId` to the body (on a draft: `release.tenantId`), or use a tenant key. All variants of this error are listed under [the tenantId rules](https://docs.releaseapi.com/api-basics.html#tenant-id-rules). |
| `400 PATCH_FULL_DRAFT_REQUIRES_TRACK_ID_IN_CHANGE_REQUEST` | A track in the full-release body has no `id`. | Generate a UUID per track and keep it. |
| `400 RELEASE_HAS_VALIDATION_ERRORS` | Submit found a blocking check. | Call `/validation` and fix every `CRITICAL` and `ERROR`. |
| `TRACK_MASTER_STATUS_NOT_SUCCESS` | The master is still processing, or was rejected. | Wait for `SUCCESS`, or upload a corrected file. |
| `RELEASE_STORE_NOT_COVERED_BY_DELIVERY_PROFILE` | Your account has no delivery set up for one of the stores you picked. | Remove that store, or ask your RecordJet contact which stores you can offer. See [Which stores you can offer](https://docs.releaseapi.com/delivery.html#your-stores). |
| `409 RELEASE_LOCKED_IN_REVIEW` | You wrote to a draft that’s in review. | Withdraw it with `{"status": "DRAFT"}`, edit it, then resubmit. |
| `400 EXTERNAL_ID_ALREADY_DEFINED` or `DIFFERENT_DRAFT_RELEASE_WITH_SAME_EXTERNAL_ID_EXISTS_ALREADY` | You ran the quickstart again with the same `externalId` values. | Keep the `RUN` suffix from the setup, or look the existing object up by `?externalId=`. |
| `400 RELEASE_NOT_FOUND` on the draft write | A track’s `details.releaseId` isn’t the id in the URL. (If it points at another draft that’s in review, you get `409 RELEASE_LOCKED_IN_REVIEW` instead.) | Use the same release id in both places. |
| The draft stays in `REVIEW` | No review decision has been made yet. | Ask your RecordJet contact to review it ([Submit for review](https://docs.releaseapi.com/quickstart.html#step-submit)). Client accounts accept it themselves. |
| Rejected with `PROVIDER_OUT_OF_GTIN` or `PROVIDER_OUT_OF_ISRC` | The tenant has no free GTIN, or no ISRC range for this year. | Add a range ([Register your code ranges](https://docs.releaseapi.com/quickstart.html#register-ranges)), or send your own codes, then resubmit. |

## Next steps

- [Events and webhooks](https://docs.releaseapi.com/events.html): Replace the one-off check with a cursor-based journal worker woken by webhooks.
- [Build a release](https://docs.releaseapi.com/drafts.html): Go beyond a single with albums, pre-orders, featured artists and booklets, and see how writes behave.
- [Manage live releases](https://docs.releaseapi.com/catalog.html): Change a live release by opening an edit draft under the same id and submitting it.
- [How money flows](https://docs.releaseapi.com/royalties.html): What happens to the wallet you just created when the first statement arrives.
