curl --request POST \
--url https://api-testbed.giftbit.com/papi/v1/campaign \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"gift_template": "XDKHE",
"contacts": [
{
"firstname": "Perry",
"lastname": "Johnson",
"email": "pjohnson@giftbit.com"
},
{
"firstname": "Rita",
"lastname": "Robson",
"email": "rrobson@giftbit.com"
}
],
"price_in_cents": 5000,
"brand_codes": [
"itunesus",
"amazonus"
],
"expiry": "2018-11-01",
"id": "clientProvidedGiftId_abc123"
}
'{
"info": {
"code": "INFO_CAMPAIGN_CREATED",
"name": "Campaign Created",
"message": "Campaign creation has begun."
},
"status": 200,
"campaign": {
"company_name": "Company Name",
"message": "Thanks for being such an awesome customer!",
"subject": "Please enjoy this reward!",
"contacts": [
{
"email": "pjhonson@giftbit.com",
"firstname": "Perry",
"added_successfully": true,
"lastname": "Johnson",
"message": "Contact ready"
}
],
"price_in_cents": 5000,
"brand_codes": [
"itunesus",
"amazonus"
],
"status": "API_CREATING",
"uuid": "9a405b513c11413aaac593a0c2e1a15d",
"suppress_default_greeting": false,
"delivery_type": "GIFTBIT_EMAIL",
"expiry": "2017-05-01",
"contacts_success_count": 2,
"contacts_failure_count": 0,
"gift_template": "XDKHE",
"id": "clientProvidedGiftId_abc123"
}
}{
"error": {
"code": "ERROR_CAMPAIGN_INVALID_BRAND",
"name": "Invalid Brand or Brand/Price combination",
"message": "brand_code: itunesus - price_in_cents: 50000 - The brand_code provided is not valid or not available for the given price"
},
"status": 422
}Create order
Places an order for one or more rewards.
Email Rewards
Orders are delivered via Giftbit email by default, and at least one
valid contacts entry is required.
Shortlnk Rewards
Optionally, you can set delivery_type: SHORTLINK to create shortlink rewards that don’t require any contacts.
Shortlink rewards use the same endpoint, return the same order object,
but generate links you can distribute yourself. When using
delivery_type: SHORTLINK include a link_count to specify the number of rewards to create.
Order Configuration
The use of gift_template is optional, but all required parameters must be
specified in the API call, or set in the template.
Include the optional expiry parameter to create a promotional reward with a limited claim period.
If you do not specify delivery_type, the request defaults to an email reward delivered by Giftbit.
curl --request POST \
--url https://api-testbed.giftbit.com/papi/v1/campaign \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"gift_template": "XDKHE",
"contacts": [
{
"firstname": "Perry",
"lastname": "Johnson",
"email": "pjohnson@giftbit.com"
},
{
"firstname": "Rita",
"lastname": "Robson",
"email": "rrobson@giftbit.com"
}
],
"price_in_cents": 5000,
"brand_codes": [
"itunesus",
"amazonus"
],
"expiry": "2018-11-01",
"id": "clientProvidedGiftId_abc123"
}
'{
"info": {
"code": "INFO_CAMPAIGN_CREATED",
"name": "Campaign Created",
"message": "Campaign creation has begun."
},
"status": 200,
"campaign": {
"company_name": "Company Name",
"message": "Thanks for being such an awesome customer!",
"subject": "Please enjoy this reward!",
"contacts": [
{
"email": "pjhonson@giftbit.com",
"firstname": "Perry",
"added_successfully": true,
"lastname": "Johnson",
"message": "Contact ready"
}
],
"price_in_cents": 5000,
"brand_codes": [
"itunesus",
"amazonus"
],
"status": "API_CREATING",
"uuid": "9a405b513c11413aaac593a0c2e1a15d",
"suppress_default_greeting": false,
"delivery_type": "GIFTBIT_EMAIL",
"expiry": "2017-05-01",
"contacts_success_count": 2,
"contacts_failure_count": 0,
"gift_template": "XDKHE",
"id": "clientProvidedGiftId_abc123"
}
}{
"error": {
"code": "ERROR_CAMPAIGN_INVALID_BRAND",
"name": "Invalid Brand or Brand/Price combination",
"message": "brand_code: itunesus - price_in_cents: 50000 - The brand_code provided is not valid or not available for the given price"
},
"status": 422
}