Create Buyers via REST API
This article explains how to create Buyers in LeadByte using the REST API. It covers the permissions required, how to set up an Administrator API key, and the endpoint used to submit a JSON POST request. It also shows how to include optional Buyer details and how to create a Buyer User at the same time to grant portal access.
Getting Started
To create Buyers via the REST API, you’ll need an API key with the correct permissions.
Go to:
Admin → Tech Hub → REST API
Then:
- Create an Administrator API Key
- Enable the permission: Buyers → Create
- Activate your API key
Creating your Buyer
To create a Buyer, send a JSON POST request to:
https://[ACCOUNT].leadbyte.com/restapi/v1.3/buyers/createWith the following body:
{
"company": "MY-COMPANY"
}Headers:
X_KEY: [API KEY GOES HERE]Response
{
"status": "Success",
"message": "Buyer record created",
"bid": 1234
}
Required = "company" The only mandatory field. This becomes the Buyer’s name in LeadByte.
All other Buyer-related fields are optional and can be included if needed.
Creating Your Buyer User
You can also create a Buyer User at the same time. This gives the Buyer access to the Buyer Portal, where they can view leads and perform other actions.
Use the same endpoint as above, but include the additional required fields:
{
"company": "MY-COMPANY",
"firstname": "Ange",
"lastname": "Postecoglou",
"email": "bigange@example.com"
}
Full list is available below -
| Field | Description |
| street1 | Buyer address |
| towncity | Name of town/city |
| county | Name of county |
| postcode | Postcode |
| country_name | Name of country |
| phone | Phone number |
| external_ref | Buyer external reference |
| external_ref_2 | Buyer external reference 2 |
| external_ref_3 | Buyer external reference 3 |
| external_ref_4 | Buyer external reference 4 |
| external_ref_5 | Buyer external reference 5 |
| firstname | Buyer User first name |
| lastname | Buyer User last name |
| Buyer User email address |
All of these fields are optional and can be included as needed when creating a Buyer.
Adding Buyer credit via REST API
Once your Buyer has been created, you can add credit to their account using the REST API.
For full instructions, see: Add Buyer credit via REST API
Creating Buyer & Delivery in the same API call
You can create a Buyer and a Delivery in a single API request. To do this, ensure your API key has the following permission enabled: Delivery → Create
Example Request
[POST] https://[ACCOUNT].leadbyte.co.uk/restapi/v1.3/buyers/createBody:
{
"company": "MY-COMPANY",
"street1": "Hope Street",
"towncity": "Farndon",
"county": "Cheshire",
"country_name": "United Kingdom",
"postcode": "CH4 8PH",
"phone": "07879000194",
"external_ref": "Buyer external reference",
"external_ref_2": "Buyer external reference 2",
"create_delivery": "Yes",
"campaign_code": "MY-CAMPAIGN",
"delivery_name": "MY-DELIVERY",
"delivery_type": "Store Lead",
"rules": [
{ "field": "email", "operator": "Not Contain", "value": "AOL" },
{ "field": "age", "operator": "Greater than or equal", "value": "21" }
],
"credit_amount": "500"
}
Headers:
X_KEY: [API KEY GOES HERE]
For more information on Delivery creation parameters, please see: Create Deliveries via REST API
Important Notes
Only SMS, Email, and Store Lead deliveries can be created via the API.
These deliveries must use Buyer credit.
They must also be part of an Evenly Weighted distribution model.
As always, please raise a support ticket with any questions or concerns.
Comments