> ## 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 retailer product page URLs to barcodes

> Submit product page URLs from major retailers and receive the corresponding barcodes. Returns an array per URL; empty array means no match was found.

The `POST /tools/convert/url-to-barcode` endpoint accepts product page URLs and returns the barcodes associated with each product. You can submit URLs from Amazon, Target, Walmart, Home Depot, Best Buy, Cabela's, and other major retailers in a single request.

## Endpoint

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

## Request body

Send a JSON body with a `data` array containing the product URLs you want to convert. No `config` object is required for URL conversions.

<ParamField body="data" type="array of strings" required>
  The product page URLs to convert. Each element must be a full URL string.
</ParamField>

```json theme={null}
{
  "data": [
    "https://www.cabelas.com/shop/en/jbl-by-harman-charge-5-waterproof-speaker-with-partyboost",
    "https://www.abt.com/JBL-Charge-5-Black-Portable-Waterproof-Speaker-With-Powerbank-JBLCHARGE5BLKAM/p/159497.html"
  ]
}
```

## Example request

```bash theme={null}
curl --request POST \
  --url 'https://api.affiliate.com/v1/tools/convert/url-to-barcode' \
  --header 'Authorization: Bearer {your_api_key}' \
  --header 'Content-Type: application/json' \
  --data '{
    "data": [
      "https://www.cabelas.com/shop/en/jbl-by-harman-charge-5-waterproof-speaker-with-partyboost",
      "https://www.abt.com/JBL-Charge-5-Black-Portable-Waterproof-Speaker-With-Powerbank-JBLCHARGE5BLKAM/p/159497.html"
    ]
  }'
```

## Example response

```json theme={null}
{
  "meta": {
    "from": "url",
    "to": "barcode",
    "from_total": 2,
    "to_total": 2,
    "trace_id": "0192e7dc-209a-7169-9c4f-5e9a298d3e76"
  },
  "data": {
    "https://www.cabelas.com/shop/en/jbl-by-harman-charge-5-waterproof-speaker-with-partyboost": [
      "50036380232"
    ],
    "https://www.abt.com/JBL-Charge-5-Black-Portable-Waterproof-Speaker-With-Powerbank-JBLCHARGE5BLKAM/p/159497.html": [
      "50036380218"
    ]
  }
}
```

## Response fields

### `meta` object

| Field        | Type    | Description                                          |
| ------------ | ------- | ---------------------------------------------------- |
| `from`       | string  | Always `"url"` for this endpoint.                    |
| `to`         | string  | Always `"barcode"` for this endpoint.                |
| `from_total` | integer | Number of URLs you submitted.                        |
| `to_total`   | integer | Number of URLs that returned at least one barcode.   |
| `trace_id`   | string  | Unique request identifier for debugging and support. |

### `data` object

Each key is a URL from your request. Each value is an **array** of barcode strings for that product. A single product URL can match more than one barcode.

<ResponseField name="data" type="object">
  Key-value pairs where each URL maps to an array of barcodes.
</ResponseField>

<Note>
  URL conversions always return an array of barcodes for each URL, not a single string. Check for an empty array `[]` to detect URLs where no barcode was found — `to_total` only counts URLs with at least one result.
</Note>
