Archive API docs
    Jump to

    Narrow by kind with a prefix — q: queries, m: mutations, t: types, g: guides, f: fields and arguments.

    Workspaces

    Most data in Archive belongs to a workspace, typically a single brand or region. Send its UUID in WORKSPACE-ID to choose where a request reads or changes data.

    http
    WORKSPACE-ID: <workspace-uuid>

    Finding workspace IDs

    A workspace ID is the id returned by the workspaces query, which lists every workspace your token can access. You can also copy it from the Archive app’s API settings. Run workspaces with your bearer token; it does not require a WORKSPACE-ID header.

    query.graphql
    query WorkspacesDefault($first: Int, $after: String) {
      workspaces(first: $first, after: $after) {
        totalCount
        edges {
          node {
            id
            name
          }
        }
        pageInfo {
          hasNextPage
          endCursor
        }
      }
    }
    variables.json
    {
      "first": 10
    }
    Headers
    Authorization: Bearer docs_demo_token_0000000000000000000000
    WORKSPACE-ID: 6ccefa76-e8ba-5ab0-9c60-e48a9e235a4a
    200 OK 19 lines
    {
      "data": {
        "workspaces": {
          "totalCount": 1,
          "edges": [
            {
              "node": {
                "id": "6ccefa76-e8ba-5ab0-9c60-e48a9e235a4a",
                "name": "Northwind Botanicals"
              }
            }
          ],
          "pageInfo": {
            "hasNextPage": false,
            "endCursor": "Z2lkOi8vYXJjaGl2ZS9Xb3Jrc3BhY2UvNmNjZWZhNzYtZThiYS01YWIwLTljNjAtZTQ4YTllMjM1YTRh"
          }
        }
      }
    }

    Which operations are workspace-scoped

    Every operation is workspace-scoped except workspaces. Queries like workspace, items, creators, and transcriptions all read from the workspace identified by the header, so they need it on every call. Configure your client to include the header in each request:

    query.graphql
    query WorkspaceDefault {
      workspace {
        id
        name
      }
    }
    Headers
    Authorization: Bearer docs_demo_token_0000000000000000000000
    WORKSPACE-ID: 6ccefa76-e8ba-5ab0-9c60-e48a9e235a4a
    200 OK 8 lines
    {
      "data": {
        "workspace": {
          "id": "6ccefa76-e8ba-5ab0-9c60-e48a9e235a4a",
          "name": "Northwind Botanicals"
        }
      }
    }

    Missing or unknown workspaces

    Check the header value against these three cases:

    • Omitting the WORKSPACE-ID header on a workspace-scoped operation, or sending it empty, returns HTTP 400 with the body {"errors":"WORKSPACE-ID header is required"}.
    400 Bad Request 3 lines
    {
      "errors": "WORKSPACE-ID header is required"
    }
    • A value that isn’t a UUID at all, such as the numeric workspace ID from an app URL or a UUID with a character missing, returns HTTP 404 with the body {"errors":"WORKSPACE-ID must be the workspace UUID shown in the app's API settings; numeric workspace ids are not accepted"}. Send the workspace’s id from workspaces instead.

    • An unknown workspace, or one your token can’t access, returns HTTP 404 with the body {"errors":"Shop not found"}.

    404 Not Found 3 lines
    {
      "errors": "Shop not found"
    }

    Iterating across workspaces

    With an organization-wide token:

    1. List accessible workspaces with workspaces.
    2. Set WORKSPACE-ID to the first workspace’s id and run your queries.
    3. Repeat for each workspace, changing the header and keeping the same bearer token.

    When making concurrent requests, set the workspace header on each request to avoid mixing workspaces.

    For the full error model, see the Errors guide.