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

# GraphQL API conventions

> How ids, paging, filtering, sorting, mutations and errors work across the GraphQL API.

These rules apply across the whole schema. Each field's description in the schema adds the details for that field.

## Ids

Most objects have two kinds of id:

* A **global id** in `id`. It is opaque; treat it as a string. Queries such as `dataSourceById` and arguments named like `dataSourceId` take it. For types that implement `Node`, such as `DataSource` and `CardDefinition`, `node(id:)` fetches the object by its global id.
* A **raw id**, such as the source id `products` or an entry id `SKU-123`. The REST APIs use raw ids. In GraphQL, raw ids appear in fields like `SourceEntry.entryId` and `SourceEntry.sourceId`, and arguments like `sourceEntries(sourceId:)` take them.

The schema says which kind each field and argument expects. When a field description says "global id", pass the `id` you read from the API, not the raw id.

## Paging

Lists use cursor-based connections. Ask for a page with `first` and continue with `after`:

```graphql theme={null}
query NextPage($after: String) {
  dataSources(first: 50, after: $after) {
    nodes { id name }
    pageInfo { hasNextPage endCursor }
  }
}
```

* Read items from `nodes`, or from `edges` when you also need each item's `cursor`.
* When `pageInfo.hasNextPage` is `true`, pass `pageInfo.endCursor` as `after` to get the next page.
* Keep the same filters and sort when you follow a cursor.
* Each list sets its own default and maximum page size.
* `totalCount` returns the number of matching items. On large lists, select it only when you need it.

Configuration lists such as `dataSources` and `cardDefinitions` also accept `last` and `before` to page backwards. Entry lists such as `sourceEntries` and `cardEntries` page forwards only.

## Filtering

The API has two filter styles.

### `where` and `order` on configuration lists

Lists of configuration, such as `dataSources`, `cardDefinitions` and `folders`, take a `where` object with one key per filterable field and an operator per key. Combine conditions with `and` and `or`. Sort with `order`.

```graphql theme={null}
dataSources(
  where: {
    or: [
      { name: { contains: "Product" } }
      { createdAt: { gte: "2026-10-01T00:00:00Z" } }
    ]
  }
  order: [{ updatedAt: DESC }]
)
```

Operators depend on the field type: for example `eq`, `neq`, `in`, `contains` and `startsWith` for text, and `eq`, `gt`, `gte`, `lt` and `lte` for dates.

### `Predicate` and `sort` on entry lists

Entry lists, such as `sourceEntries` and `cardEntries`, filter on property values. Their `where` takes a `Predicate`. A predicate has exactly one branch, chosen by the property type: `text`, `integer`, `decimal`, `boolean`, `timestamp`, `list` or `hasValue`. Combine predicates with `and`, `or` and `not`.

```graphql theme={null}
sourceEntries(
  sourceId: "products"
  language: "en"
  where: {
    and: [
      { text: { property: "brand", in: ["Acme", "Globex"] } }
      { not: { hasValue: { property: "discontinuedAt" } } }
    ]
  }
  sort: [{ property: "name", direction: ASC }]
)
```

* Pass `language` when the filter or sort uses a localized property. There is no fallback language.
* `sort` takes up to 16 keys. Use a property id, `id`, `@createdAt` or `@updatedAt`. Without `sort`, entries are sorted by entry id.
* Card entry queries also support `segment`, `relation` and `lifecycle` predicates. Source entry queries reject them.

## Mutations

Each mutation takes one `input` argument and returns a payload object. The payload has a field for the result, such as `managedTagsList`, and an `errors` list.

Some objects carry an `etag`. When an update input asks for one, pass the `etag` you last read. If the object changed since then, the mutation fails with `OptimisticConcurrencyError`. Read it again and retry.

## Errors

Errors come in two places.

**Expected mutation failures** are returned in the payload's `errors` list as `GraphQlError` objects. The result field is then `null`.

| `code` | Meaning |
| - | - |
| `ValidationError` | The input is invalid. `details` lists each failing input field (`key`) with its messages (`value`). |
| `NotFoundError` | An id does not exist. |
| `ConflictError` | The change clashes with the current state, such as a name already in use or an item still referenced. |
| `OptimisticConcurrencyError` | The `etag` is stale. Read the object again and retry. |
| `UnauthorizedError`, `ForbiddenError` | The caller has no access. |

A mutation's description names any other code it can return.

**Request errors** are returned in the standard GraphQL `errors` array of the response, for example a syntax error, a missing scope, or a missing token (`AUTH_NOT_AUTHENTICATED`). Fields that did resolve still return their data.

A request that takes longer than 30 seconds ends with HTTP `504` and a JSON body with a `requestId`. Include the `requestId` when you contact support.


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