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

# Convert merchant-specific SKUs to product barcodes

> Resolve merchant-specific SKUs to their standard barcodes. Requires a merchant name or URL in the config object to identify the source catalog.

The `POST /tools/convert/sku-to-barcode` endpoint converts merchant SKUs to barcodes. Because SKUs are merchant-specific, you must identify the merchant in the `config` object so the API knows which catalog to look up.

## Endpoint

```
POST /v1/tools/convert/sku-to-barcode
```

## Request body

<ParamField body="data" type="array of strings" required>
  The merchant SKUs to convert.
</ParamField>

<ParamField body="config" type="object" required>
  Configuration for the conversion. You must specify the source merchant.

  <Expandable title="config fields">
    <ParamField body="config.merchant.name" type="string">
      The merchant name (e.g. `"walmart"`). If you provide both `name` and `url`, only `name` is used.
    </ParamField>

    <ParamField body="config.merchant.url" type="string">
      The merchant domain (e.g. `"walmart.com"`). Used only when `name` is not provided.
    </ParamField>
  </Expandable>
</ParamField>

```json theme={null}
{
  "data": [
    "12987717129",
    "9853123116",
    "9885868036",
    "9899956927"
  ],
  "config": {
    "merchant": {
      "name": "walmart"
    }
  }
}
```

## Example request

```bash theme={null}
curl --request POST \
  --url 'https://api.affiliate.com/v1/tools/convert/sku-to-barcode' \
  --header 'Authorization: Bearer {your_api_key}' \
  --header 'Content-Type: application/json' \
  --data '{
    "data": [
      "12987717129",
      "9853123116",
      "9885868036",
      "9899956927"
    ],
    "config": {
      "merchant": {
        "name": "walmart"
      }
    }
  }'
```

## Example response

```json theme={null}
{
  "meta": {
    "from": "sku",
    "to": "barcode",
    "from_total": 4,
    "to_total": 4,
    "config": {
      "merchant": {
        "name": "walmart"
      }
    },
    "trace_id": "0192e388-d982-720f-9f5d-172e335160fd"
  },
  "data": {
    "12987717129": "9349520733755",
    "9853123116": "648093563899",
    "9885868036": "648093561147",
    "9899956927": "648093562182"
  }
}
```

## Response fields

### `meta` object

| Field        | Type    | Description                                          |
| ------------ | ------- | ---------------------------------------------------- |
| `from`       | string  | Always `"sku"` for this endpoint.                    |
| `to`         | string  | Always `"barcode"` for this endpoint.                |
| `from_total` | integer | Number of SKUs you submitted.                        |
| `to_total`   | integer | Number of SKUs that resolved to a barcode.           |
| `config`     | object  | The merchant config used in the request.             |
| `trace_id`   | string  | Unique request identifier for debugging and support. |

### `data` object

Each key is a SKU from your request. Each value is the barcode string for that product.

<ResponseField name="data" type="object">
  Key-value pairs where each SKU maps to a barcode string.
</ResponseField>
