# 🔗Public APIs for Registration form (RF)

These **REST APIs** let you work with your wholesale registration flow: fetch **form definitions**, **create wholesalers**, **filter** registrants, and **change approval status**.

> **Requirements**
>
> * Install the **BSS B2B Solution** Shopify app
> * Get your **Access Key** from the app (see below)

***

### 🔑 Get the Access Key

1. Open the **BSS B2B Solution** app in Shopify.
2. Go to **Public API**.
3. Click **Copy** to copy your **accessKey**.
4. Include it in the request body for endpoints that require it.

***

### 📄 Form Endpoints

Get a form by ID

**Purpose**\
Fetch *form data only*. **Validation logic used on the storefront is not returned**.

**GET**

```
https://b2b-solution-public-api.bsscommerce.com/api/v1/rf/form/:id
```

**Path Params**

* `:id` – Form ID

**Query Params**

* `domain` – your myshopify domain

**Headers**

* `x-bss-b2b-api-key` – your access key

**Example Request**

```bash
curl --request GET \
  --url "https://b2b-solution-public-api.bsscommerce.com/api/v1/rf/form/1?domain=abc.myshopify.com" \
  --header "x-bss-b2b-api-key: xxx"
```

**Response (example)**

{% code expandable="true" %}

```json
{
  "success": true,
  "data": {
    "formId": 1,
    "formFields": [
      {
        "id": "header-field-aa4914b46678e",
        "label": "Primary details",
        "type": "header",
        "required": false,
        "field": "custom",
        "heading_type": "h4",
        "width": "100%"
      },
      {
        "id": "first_name",
        "label": "First name",
        "type": "text",
        "required": true,
        "help_text": "",
        "placeholder": "",
        "default_value": "",
        "max_character": "",
        "width": "100%"
      },
      {
        "id": "last_name",
        "label": "Last name",
        "type": "text",
        "required": false,
        "help_text": "",
        "placeholder": "",
        "default_value": "",
        "max_character": "",
        "width": "100%"
      }
    ]
  }
}
```

{% endcode %}

\</details>

***

### 🧑‍💼 Wholesaler Endpoints

Create wholesaler

**POST**

```
https://b2b-solution-public-api.bsscommerce.com/api/v1/rf/wholesaler/register
```

**Body**

> `name` is the **field ID** in the form.\
> `value` is the **submitted customer information**.

```json
{
  "formId": 1,
  "formData": [
    { "name": "first_name", "value": "TEST" },
    { "name": "last_name",  "value": "BSS" },
    { "name": "email",      "value": "testbss2@bsscommerce.com" },
    { "name": "password",   "value": "testbss" }
  ]
}
```

**Response**

```json
{
  "success": true,
  "message": "Created wholesaler successfully",
  "wholesalerId": 3
}
```

***

**POST**

```
https://b2b-solution-public-api.bsscommerce.com/api/v1/rf/wholesaler/filter
```

**Request Body Params**

* `domain` – your myshopify domain
* `accessKey` – your access key
* `status` – status to filter (example below)
* `start_date` – start date (YYYY-MM-DD)
* `end_date` – end date (YYYY-MM-DD)

**Example Request**

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "status": "pending",
  "start_date": "2025-03-01",
  "end_date": "2025-03-15"
}
```

**Response (example)**

{% code expandable="true" %}

```json
{
  "success": true,
  "message": "Success",
  "data": [
    {
      "id": 34408,
      "form_id": 1,
      "status": "PENDING",
      "fields": [
        { "name": "First name", "value": "TEST" },
        { "name": "Last name", "value": "CUSTOMER" },
        { "name": "Email", "value": "test@example.com" },
        { "name": "Company", "value": "BSS Commerce" },
        { "name": "Phone", "value": "+84123456789" },
        { "name": "Address", "value": "123 Main St" },
        { "name": "City", "value": "Hanoi" },
        { "name": "Country", "value": "VN" },
        { "name": "State", "value": "" },
        { "name": "Zip code", "value": "123456" },
        { "name": "Apartment/suite/etc.", "value": "Apartment 123" },
        { "name": "Subscribe to our newsletter", "value": "yes" },
        { "name": "EU VAT Validation", "value": "AT1234567" },
        { "name": "Dropdown selection(s)", "value": "option-1" },
        { "name": "UK Validation", "value": "AT1234567" },
        { "name": "US EIN Validation", "value": "AT1234567" },
        { "name": "ABN Validation", "value": "AT1234567" },
        { "name": "India GST Validation", "value": "AT1234567" },
        { "name": "Multiple checkbox", "value": "option-1,option-2" },
        { "name": "Radio options", "value": "option-1" },
        { "name": "Text field", "value": "Test Content" },
        {
          "name": "Text area",
          "value": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec semper, diam et bibendum congue"
        },
        { "name": "Number", "value": "1234567890" },
        { "name": "Date field", "value": "1/1/2025" },
        {
          "name": "File upload",
          "value": "https://cdn.shopify.com/s/files/1/0647/8964/3514/files/customers_template_20_2824_29-1741832223649.csv?v=1741832226"
        }
      ]
    }
  ]
}
```

{% endcode %}

**Response (no results)**

```json
{ "success": false, "data": [] }
```

***

**POST**

```
https://b2b-solution-public-api.bsscommerce.com/api/v1/rf/wholesaler/:action
```

**Action Path Param**

* Replace `:action` with **`approve`** or **`reject`**

**Important**

* You can **only** change status for accounts currently in **PENDING** status.

**Request Body Params**

* `domain` – your myshopify domain
* `accessKey` – your access key
* `emails` – array of customer emails to update

**Example Request**

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "emails": [
    "example@bsscommerce.com",
    "example1@bsscommerce.com"
  ]
}
```

**Response (approve with partial errors)**

```json
{
  "success": true,
  "message": "Success",
  "approved": ["example1@bsscommerce.com"],
  "errors": {
    "example@bsscommerce.com": {
      "email": "Email is not exist"
    }
  }
}
```

**Response (reject)**

```json
{
  "success": true,
  "rejected": [
    "example@bsscommerce.com",
    "example1@bsscommerce.com"
  ]
}
```

**Response (no results)**

```json
{ "success": false, "data": [] }
```

***

### ⚙️ Notes & Behavior

* **Form fetch** returns the **schema/fields** only; it **does not** include storefront validation logic.
* **Status change** endpoints operate **only** on **PENDING** accounts.
* Some endpoints require **`domain`** and **`accessKey`** in the request body (see examples above).
