> ## Documentation Index
> Fetch the complete documentation index at: https://api.scalysis.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch Call Recording

Once an AI-powered call finishes, Scalysis stores the call audio and makes every recording for that order available through the recordings endpoint. Use it to download the original file, attach it in your CRM, or play it back for a QA review.

## When to fetch

The recording exists only after the call has ended and the audio has been saved. If you fetch too early, the order can be found with an empty `recordings` list. Wait until the call has had time to complete, typically 30 seconds to a few minutes, then fetch again.

<Note>
  A Shopify order id is optional. Send whichever one id you already have: the Scalysis `orderId`, the Shopify `shopifyOrderId`, or the `orderNumber` such as `#34127`.
</Note>

<Steps>
  <Step title="Pick one order reference">
    You do not need all three. Pass whichever id you already have.

    <ParamField path="orderId" type="number">
      The Scalysis id returned when you triggered the call, for example `1952789`. This is not the Shopify id.
    </ParamField>

    <ParamField path="shopifyOrderId" type="string">
      Shopify's numeric order id, for example `9911279517782`. The `gid://shopify/Order/...` form also works.
    </ParamField>

    <ParamField path="orderNumber" type="string">
      The order name you see in Shopify, for example `#34127`. In the URL, write `#` as `%23`.
    </ParamField>
  </Step>

  <Step title="List the recordings">
    Swap in your real API key and one order reference.

    ```bash theme={null}
    curl -sS 'https://app.scalysis.com/api/v1/orders/recordings?shopifyOrderId=9911279517782' \
      -H 'Authorization: Bearer YOUR_API_KEY'
    ```

    The same call with the other two lookups:

    ```bash theme={null}
    curl -sS 'https://app.scalysis.com/api/v1/orders/recordings?orderId=1952789' \
      -H 'Authorization: Bearer YOUR_API_KEY'
    ```

    ```bash theme={null}
    curl -sS 'https://app.scalysis.com/api/v1/orders/recordings?orderNumber=%2334127' \
      -H 'Authorization: Bearer YOUR_API_KEY'
    ```

    No request body is needed.
  </Step>

  <Step title="Read the response">
    A completed order with one call returns:

    ```json theme={null}
    {
      "success": true,
      "matchedBy": "shopifyOrderId",
      "orders": [
        {
          "orderId": 1952789,
          "shopifyOrderId": "9911279517782",
          "orderNumber": "#34127",
          "recordings": [
            {
              "callId": 440905,
              "calledAt": "2026-10-07T03:52:51.320Z",
              "recordingUrl": "https://app.scalysis.com/api/v1/orders/1952789/recording?callId=440905&t=SIGNED_TOKEN"
            }
          ]
        }
      ]
    }
    ```

    <ResponseField name="success" type="boolean">
      `true` when the order was found.
    </ResponseField>

    <ResponseField name="matchedBy" type="string">
      Which lookup matched: `orderId`, `shopifyOrderId`, or `orderNumber`.
    </ResponseField>

    <ResponseField name="orders" type="array">
      Matching orders for this shop. Usually one.
    </ResponseField>

    <ResponseField name="orders[].orderId" type="number">
      Scalysis order id. Use this in the download URL.
    </ResponseField>

    <ResponseField name="orders[].shopifyOrderId" type="string">
      Shopify's numeric order id, when the order came from Shopify. `null` for a manual order.
    </ResponseField>

    <ResponseField name="orders[].orderNumber" type="string">
      Order name, such as `#34127`.
    </ResponseField>

    <ResponseField name="orders[].recordings" type="array">
      Every saved recording, oldest first. Empty if the audio is not saved yet.
    </ResponseField>

    <ResponseField name="recordings[].callId" type="number">
      One call. An order can have more than one.
    </ResponseField>

    <ResponseField name="recordings[].calledAt" type="string">
      When that call started, in UTC.
    </ResponseField>

    <ResponseField name="recordings[].recordingUrl" type="string">
      Link that downloads that call's original audio.
    </ResponseField>

    <Note>
      `recordingUrl` already includes `callId` and a signed `t` token. Opening it does not need a second login. The token works only for that shop, that order, and that call.
    </Note>
  </Step>

  <Step title="Download one recording">
    Use `recordingUrl` from the list as-is:

    ```bash theme={null}
    curl -sS 'https://app.scalysis.com/api/v1/orders/1952789/recording?callId=440905&t=SIGNED_TOKEN' \
      --output call.audio
    ```

    You can also call the same path with your API key and skip the token:

    ```bash theme={null}
    curl -sS 'https://app.scalysis.com/api/v1/orders/1952789/recording?callId=440905' \
      -H 'Authorization: Bearer YOUR_API_KEY' \
      --output call.audio
    ```

    The response is the original audio file, not JSON. `Content-Type` is the stored type, such as `audio/mpeg` or `audio/wav`. The file is not re-encoded.

    If the order has several recordings, pass the `callId` of the one you want. Without `callId`, the endpoint returns the latest completed call's audio.
  </Step>

  <Step title="Handle missing audio">
    The order exists, but no file is saved yet:

    ```json theme={null}
    {
      "success": true,
      "matchedBy": "orderNumber",
      "orders": [
        {
          "orderId": 1952789,
          "shopifyOrderId": "9911279517782",
          "orderNumber": "#34127",
          "recordings": []
        }
      ]
    }
    ```

    Wait 10–30 seconds and request the list again.

    <ResponseField name="401" type="error">
      Missing or invalid API key.
    </ResponseField>

    <ResponseField name="400" type="error">
      You did not send `orderId`, `shopifyOrderId`, or `orderNumber`.
    </ResponseField>

    <ResponseField name="404" type="error">
      No order for this shop, or that `callId` has no recording.
    </ResponseField>

    <ResponseField name="502" type="error">
      The audio file could not be loaded.
    </ResponseField>
  </Step>
</Steps>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.