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

# Size Charts

> Maintain a bank of size charts and associate them with products

Size charts let you maintain a reusable bank of sizing guides and tie one to each product. Charts can be supplied as markdown or as a PDF — PDFs are converted to markdown automatically on ingestion. When a product has an associated chart, Remark's AI assistant can pull it up to answer sizing questions in conversation.

<CardGroup cols={2}>
  <Card title="Managing Charts" icon="table" href="#managing-charts">
    Create, update, and bulk-load size charts from markdown or PDF.
  </Card>

  <Card title="PDF Ingestion" icon="file-text" href="#pdf-ingestion">
    Supply a PDF by URL or upload; it's converted to markdown asynchronously.
  </Card>

  <Card title="Product Linking" icon="link" href="#linking-products">
    Associate a size chart with a product during import.
  </Card>

  <Card title="AI Assistant" icon="bot" href="#ai-assistant-behavior">
    How Remark's assistant uses size charts to help customers.
  </Card>
</CardGroup>

***

## Before You Begin

<Info>
  All size chart operations require an integration API key with the `SIZE_CHART_MANAGE` permission.
</Info>

| Requirement                    | Where to find it                             |
| ------------------------------ | -------------------------------------------- |
| Integration API Key            | Dashboard → Settings → API Keys              |
| `SIZE_CHART_MANAGE` permission | Enabled when creating or editing the API key |

All size chart mutations and queries are served at `https://api.withremark.com/graphql` and authenticate via the `X-Vendor-Api-Key` header.

Each size chart has an `externalId` you control. This is how you reference a chart when associating it with products, and how bulk operations match existing charts.

***

## Managing Charts

A size chart has a `name`, an `externalId`, and a markdown `body`. The `body` can be supplied directly as markdown, or generated from a PDF (see [PDF Ingestion](#pdf-ingestion)).

### Create a Chart

Provide **exactly one** of `body` (markdown) or `sourceUrl` (a PDF URL).

```graphql theme={null}
mutation CreateSizeChart($input: CreateSizeChartInput!) {
  createSizeChart(input: $input) {
    id
    externalId
    name
    source
    status
    body
  }
}
```

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.withremark.com/graphql \
    -H "Content-Type: application/json" \
    -H "X-Vendor-Api-Key: rmrk_your_api_key" \
    -d '{
      "query": "mutation CreateSizeChart($input: CreateSizeChartInput!) { createSizeChart(input: $input) { id externalId name source status body } }",
      "variables": {
        "input": {
          "externalId": "mens-footwear",
          "name": "Men'\''s Footwear Size Guide",
          "body": "| US | EU | UK |\n|----|----|----|\n| 8 | 41 | 7 |\n| 9 | 42 | 8 |\n| 10 | 43 | 9 |"
        }
      }
    }'
  ```
</CodeGroup>

| Field        | Type   | Required | Description                                                                                    |
| ------------ | ------ | -------- | ---------------------------------------------------------------------------------------------- |
| `externalId` | String | Yes      | Your unique identifier for this chart (max 255 chars)                                          |
| `name`       | String | Yes      | Display name (max 255 chars)                                                                   |
| `body`       | String | One of   | Markdown body (max 50,000 chars). Provide exactly one of `body` or `sourceUrl`                 |
| `sourceUrl`  | String | One of   | URL of a PDF to convert to markdown on ingestion. Provide exactly one of `body` or `sourceUrl` |

A chart created from markdown is `READY` immediately. A chart created from a PDF is `PENDING` until conversion completes — see [PDF Ingestion](#pdf-ingestion).

### List Charts

```graphql theme={null}
query SizeCharts($first: Int, $cursor: ID) {
  sizeCharts(first: $first, cursor: $cursor) {
    nodes {
      id
      externalId
      name
      source
      status
      body
    }
    totalCount
    hasNextPage
    endCursor
  }
}
```

Returns your size charts with cursor-based pagination. Pass `first` (1–100) and the previous response's `endCursor` to page forward.

### Update a Chart

```graphql theme={null}
mutation UpdateSizeChart($id: ID!, $input: UpdateSizeChartInput!) {
  updateSizeChart(id: $id, input: $input) {
    id
    name
    status
    body
  }
}
```

All `input` fields are optional — only include what you want to change. Passing `sourceUrl` replaces the body with a freshly converted PDF and sets the chart back to `PENDING` until conversion finishes.

### Delete a Chart

```graphql theme={null}
mutation DeleteSizeChart($id: ID!) {
  deleteSizeChart(id: $id)
}
```

<Note>
  Deleting a chart unlinks it from any associated products — those products simply lose their size chart. It does not affect the products otherwise.
</Note>

### Bulk Upsert

For loading large sets of charts (up to 5,000 per request), use `bulkUpsertSizeCharts`. Charts are matched by `externalId` — existing charts are updated, new ones are created.

```graphql theme={null}
mutation BulkUpsertSizeCharts($input: BulkUpsertSizeChartsInput!) {
  bulkUpsertSizeCharts(input: $input) {
    created
    updated
    total
  }
}
```

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.withremark.com/graphql \
    -H "Content-Type: application/json" \
    -H "X-Vendor-Api-Key: rmrk_your_api_key" \
    -d '{
      "query": "mutation BulkUpsertSizeCharts($input: BulkUpsertSizeChartsInput!) { bulkUpsertSizeCharts(input: $input) { created updated total } }",
      "variables": {
        "input": {
          "sizeCharts": [
            { "externalId": "mens-footwear", "name": "Men'\''s Footwear", "body": "| US | EU |\n|----|----|\n| 9 | 42 |" },
            { "externalId": "womens-apparel", "name": "Women'\''s Apparel", "sourceUrl": "https://cdn.example.com/charts/womens-apparel.pdf" }
          ]
        }
      }
    }'
  ```
</CodeGroup>

Each entry takes the same `body` / `sourceUrl` rules as [Create a Chart](#create-a-chart). Response:

```json theme={null}
{
  "data": {
    "bulkUpsertSizeCharts": { "created": 1, "updated": 1, "total": 2 }
  }
}
```

### Bulk Delete

Delete up to 5,000 charts by `externalId` in a single call. Unknown external IDs are skipped and counted in `notFound`.

```graphql theme={null}
mutation BulkDeleteSizeCharts($input: BulkDeleteSizeChartsInput!) {
  bulkDeleteSizeCharts(input: $input) {
    deleted
    notFound
    total
  }
}
```

***

## PDF Ingestion

If your sizing guides are PDFs, you can hand Remark a PDF and it will convert it to markdown for you. There are two ways to supply one:

**By URL** — pass `sourceUrl` to `createSizeChart`, `updateSizeChart`, or any bulk upsert entry. Remark fetches and converts the PDF.

**By upload** — for PDFs not hosted at a public URL, upload the file directly with `uploadSizeChartPdf`:

```graphql theme={null}
mutation UploadSizeChartPdf($externalId: String!, $name: String!, $file: Upload!) {
  uploadSizeChartPdf(externalId: $externalId, name: $name, file: $file) {
    id
    externalId
    status
  }
}
```

This is a [GraphQL multipart](https://github.com/jaydenseric/graphql-multipart-request-spec) upload. Either way, the chart is created with `source: PDF` and `status: PENDING`, and conversion runs in the background.

### Conversion Status

Every chart exposes a `status` reflecting where its body stands:

| Status    | Meaning                                                                           |
| --------- | --------------------------------------------------------------------------------- |
| `READY`   | The markdown `body` is available for use. Markdown charts are `READY` immediately |
| `PENDING` | A PDF source is queued or converting; `body` is not yet populated                 |
| `FAILED`  | Conversion failed. See `conversionError` for the reason                           |

Poll the chart (via `sizeCharts` or the product's `sizeChart` field) to check when a PDF finishes converting. Conversion is typically fast, but you should treat a chart as usable only once it reaches `READY`.

<Note>
  An unchanged PDF re-ingested with the same source is not re-converted — Remark detects identical source content and reuses the existing markdown.
</Note>

***

## Linking Products

Associate a size chart with a product by including `sizeChartExternalId` in your [product import](/guides/product-import) payload. This works with both SFTP and direct API imports. Each product can have **one** size chart.

```json theme={null}
{
  "externalId": "trail-runner-shoe",
  "name": "Trail Runner Shoe",
  "brandName": "Summit",
  "externalUrl": "https://store.example.com/products/trail-runner-shoe",
  "sizeChartExternalId": "mens-footwear"
}
```

The association is tri-state:

* **Omit** `sizeChartExternalId` to leave the existing association unchanged.
* **`null`** clears the association.
* **An external ID** sets the association. An unknown external ID clears it.

<Note>
  Create your size charts before importing products. Referencing an external ID that doesn't match an existing chart clears the product's association rather than failing the import.
</Note>

***

## AI Assistant Behavior

Once you've created at least one size chart, Remark's AI assistant can look up a product's chart during a conversation. It's offered to your customers when they ask about sizing or fit for a specific product.

### How it works

1. **Lookup**: When a customer asks about sizing for a product, the assistant looks up that product's associated chart by ID or name.
2. **In-conversation answer**: If the chart is `READY`, the assistant uses its markdown to answer the customer's question directly — recommending a size, reading off measurements, or comparing across the table.
3. **PDF fallback**: If the chart's PDF is still converting (`PENDING`) or conversion failed (`FAILED`), the assistant falls back to linking the customer to the original PDF so they're never left without a sizing reference.

### Example conversation

> **Customer**: What size should I get in the Trail Runner Shoe? I'm a US 9.5.
>
> **Assistant**: For the Trail Runner Shoe, a US 9.5 maps to a EU 43. These run true to size, so a 9.5 should be a good fit.

***

## Setup Checklist

<Steps>
  <Step title="Load your charts">
    Create or bulk upsert your size charts from markdown or PDF. For large catalogs, batch into requests of up to 5,000 charts each.
  </Step>

  <Step title="Wait for conversion">
    For PDF charts, confirm each reaches `READY` before relying on it.
  </Step>

  <Step title="Link products">
    Include `sizeChartExternalId` in your product import payloads.
  </Step>

  <Step title="Test">
    Start a conversation with Remark's AI assistant and ask a sizing question about a linked product.
  </Step>
</Steps>

***

## Need Help?

Contact [support@remark.ai](mailto:support@remark.ai) for assistance with size chart setup.
