# API

If you ever need to add registrations or serial numbers programatically, there is an API for it.

## Generate Access Token

Access token can be obtain in the Shopify Admin > Apps > My Product Registration > Settings > Advance > Generate Token

![](/files/-M4QrwAn5CfPIIJk7GWt)

## Usage

### Registrations - add new (POST)

Once the access token is generated, it can be use to register a new product

1. Make an **HTTP POST request** to the endpoint - <https://product-reg.varify.xyz/api/registrations>
2. The POST request should have the following **JSON payload**

```
{
    "accessToken": "12323213123",
    "registrations": [
        {
            "productName": "MacBook 2018",
            "customerEmail": "tom@example.com",
            "customerName": "Tom Delong",
            "serialNumbers": [
                "123",
                "321"
            ],
            "purchaseDate": "2019-01-01",
            "extraFields": {
                "extra_field_name_in_lower_case": "extra_field_value",
                "extra_field_name_in_lower_case_2": "extra_field_value_2",
            }
        }
    }
```

It's possible to register multiple products in one call - simply add another registration object to the registrations array.

If there are extra fields - make sure the **extra field name** is used and it's in **lowercase**

Extra field name - this can be found in the webhook payload or admin extra fields (make sure its exact name in lowercase)

### Registrations - Modify existing registration (PUT)

Once the access token is generated, it can be used to modify existing registration (the registration id can be found in the admin or via the webhook payload)

1. Make a **HTTP PUT request** to the endpoint - [https://product-reg.varify.xyz/api/registration](https://product-reg.varify.xyz/api/registrations)/:regId
2. The PUT request should have the following **JSON payload**

```
{
    "accessToken": "12323213123",
    "registration": {
            "productName": "MacBook 2018",
            "customerEmail": "tom@example.com",
            "customerName": "Tom Delong",
            "serialNumbers": [
                "123",
                "321"
            ],
            "purchaseDate": "2019-01-01",
            "extraFields": {
                "extra_field_name_in_lower_case": "extra_field_value",
                "extra_field_name_in_lower_case_2": "extra_field_value_2",
            }
    }
}
```

If there are extra fields - make sure the **extra field name** is used and it's in **lowercase**

### Serial Numbers

Here is example the payload for adding serial numbers

```
{
    "accessToken": "12323213123",
    "serialNumbers": [
        {
            "serialNumber": "22018",
            "sku": "mac123",
            "customerTags": "VIP,mac",
        }
    }
```

The customerTags is a comma-separated of tags you want to tag the customer who register this serial number


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.product-reg.varify.xyz/v1-shopify-product-registration/admin/api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
