> ## 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.

# Tools API: convert between product identifiers

> Convert between barcodes, SKUs, ASINs, and retailer URLs using a consistent POST format. Results map each source value to its converted target or null.

The Tools API lets you convert product identifiers from one type to another. If you have a barcode and need the Walmart SKU, an Amazon ASIN and need the matching barcode, or a retailer URL and need the UPC, this API handles the lookup.

## When to use the Tools API

Use the Tools API when you have one type of product identifier and need a different one. Supported conversions:

* Product page URLs → barcodes
* Barcodes → merchant SKUs
* Merchant SKUs → barcodes
* Amazon ASINs → barcodes
* Barcodes → Amazon ASINs

## Available endpoints

All endpoints use `POST` and accept a JSON request body.

| Endpoint                              | Converts                       |
| ------------------------------------- | ------------------------------ |
| `POST /tools/convert/url-to-barcode`  | Retailer product URL → barcode |
| `POST /tools/convert/barcode-to-sku`  | Barcode → merchant SKU         |
| `POST /tools/convert/sku-to-barcode`  | Merchant SKU → barcode         |
| `POST /tools/convert/ASIN-to-barcode` | Amazon ASIN → barcode          |
| `POST /tools/convert/barcode-to-asin` | Barcode → Amazon ASIN          |

## Request format

Every endpoint accepts the same JSON body structure: a `data` array of values to convert, and an optional `config` object for additional parameters.

```json theme={null}
{
  "data": ["value1", "value2"],
  "config": {}
}
```

### Required headers

| Header          | Value                   |
| --------------- | ----------------------- |
| `Content-Type`  | `application/json`      |
| `Authorization` | `Bearer {your_api_key}` |

### Config requirements

Some conversions require a `config` object:

**ASIN conversions** — you must specify the Amazon locale:

```json theme={null}
{
  "config": {
    "asin": {
      "locale": "US"
    }
  }
}
```

**SKU conversions** — you must specify either the merchant name or merchant URL. If you supply both, only `name` is used:

```json theme={null}
{
  "config": {
    "merchant": {
      "name": "walmart"
    }
  }
}
```

```json theme={null}
{
  "config": {
    "merchant": {
      "url": "walmart.com"
    }
  }
}
```

## Response format

Every response includes a `meta` object describing the conversion and a `data` object containing the results.

```json theme={null}
{
  "meta": {
    "from": "barcode",
    "to": "sku",
    "from_total": 5,
    "to_total": 4,
    "config": { "merchant": { "name": "walmart" } },
    "trace_id": "0192e7de-ee66-72ad-9a8c-95f8055238da"
  },
  "data": {
    "9349520733755": "12987717129",
    "648093563899": "9853123116",
    "1234567890123": null
  }
}
```

### `meta` fields

| Field        | Type    | Description                                          |
| ------------ | ------- | ---------------------------------------------------- |
| `from`       | string  | The source identifier type.                          |
| `to`         | string  | The target identifier type.                          |
| `from_total` | integer | Number of source values you submitted.               |
| `to_total`   | integer | Number of successful conversions returned.           |
| `config`     | object  | The config object used in the request.               |
| `trace_id`   | string  | Unique request identifier for debugging and support. |

### `data` object

The `data` object maps each source value to its converted result. When a conversion cannot be made, the API returns `null` for that entry.

For URL-to-barcode and ASIN-to-barcode conversions, each source maps to an **array** of barcodes rather than a single string — a single product URL or ASIN can correspond to multiple barcodes. An empty array `[]` means no barcode was found.

## Conversion endpoints

<CardGroup cols={2}>
  <Card title="URL to Barcode" href="/api-reference/tools/url-to-barcode">
    Convert product page URLs from Amazon, Walmart, Target, and other major retailers to barcodes.
  </Card>

  <Card title="Barcode to SKU" href="/api-reference/tools/barcode-to-sku">
    Look up merchant-specific SKUs for a list of barcodes.
  </Card>

  <Card title="SKU to Barcode" href="/api-reference/tools/sku-to-barcode">
    Convert merchant SKUs back to their corresponding barcodes.
  </Card>

  <Card title="ASIN to Barcode" href="/api-reference/tools/asin-to-barcode">
    Retrieve barcodes for Amazon Standard Identification Numbers.
  </Card>

  <Card title="Barcode to ASIN" href="/api-reference/tools/barcode-to-asin">
    Find Amazon ASINs and locales for a given barcode.
  </Card>
</CardGroup>
