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
}Authorizations
Send your API token prefixed by Bearer in the Authorization header.
Body
The value of the offer in cents.
A unique client-assigned identifier for the order. Idempotent on retry.
Reward email message. Required if no supplied template.
Reward email subject. Required if no supplied template.
The template id used for this order.
A list of contact objects. Required for email delivery.
Show child attributes
Show child attributes
Custom list of one or more brand_code. Not applicable to Full Catalog choice.
Region for the Full Catalog from which recipients select a brand.
Optional. Defaults to email delivery. Set to SHORTLINK to create shortlink rewards from this same /campaign endpoint instead of having Giftbit deliver the reward by email.
GIFTBIT_EMAIL, SHORTLINK Optional. For shortlink orders, the number of reward links to generate. Include this when delivery_type is SHORTLINK.
The order's claim-before date (YYYY-MM-dd). May not exceed one year from creation.