Create Buyers via REST API
This feature allows you to create Buyers via our REST API, which useful if you have Buyers sign up via a form outside of LeadByte and you want to automate the Buyer account creation in LeadByte.
Getting Started
In order to search via the REST API, you'll need a REST API key with the correct permissions.
Head to the Admin tab > Tech Hub > REST API to get started:
1) Create yourself an Administrator Key
2) Ensure the Administrator Key has the Buyers > Create permission
3) Activate your Administrator Key
Creating your Buyer
In order to create your Buyer, you'll be making a JSON Post to the below URL:
https://[ACCOUNT].leadbyte.com/restapi/v1.3/buyers/create
With the following body:
{
"company": "MY-COMPANY"
}
Headers:
X_KEY: [API KEY GOES HERE]
Response
{
"status": "Success",
"message": "Buyer record created",
"bid": 1234
}
The "company" field is the only required field when creating a Buyer and is used to give your Buyer a name in LeadByte.
You are able to add other Buyer related data. However, these fields are all optional.
Creating Your Buyer User
You can also add a Buyer User when initially creating a Buyer on LeadByte. This will allow the Buyer access to the Buyer Portal to view their leads, amongst other actions. You would use the same call as the above, but add the below required values:
{
"company": "MY-COMPANY",
"firstname": "Ange",
"lastname": " Postecoglou",
"email": "bigange@spurs.com"
}
Full list 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
email - Buyer User email address
Adding Buyer credit via REST API
Now you've got your Buyer created in LeadByte, follow this article in order to add credit to them -
Creating Buyer & Delivery in the same API call
It is possible to create a delivery in the same call as creating a Buyer, you just need to make sure your API key has the Delivery > Create permission enabled.
Create a Buyer & 'Store Lead' delivery:
[POST] https://[ACCOUNT].leadbyte.co.uk/restapi/v1.3/buyers/create
{ "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
Only SMS, Email & Store Leads can be created via the API, these deliveries MUST use Buyer credit and be included in an Evenly Weighted distribution model.
As always, please raise a support ticket with any questions or concerns.
Comments