Leat Docs
OAuth APICRM

Contacts

Contacts are the end-users of Clients. Contacts are provided with basic attributes, such as an email address, first name, last name, and so forth. Any custom at

Contacts are the end-users of Clients. Contacts are provided with basic attributes, such as an email address, first name, last name, and so forth. Any custom attributes can also be created, either in the Business Dashboard or via API. Their email address is the standard unique identifier, via which Contacts can be found. Aside from the email address, Contact Identifiers can also be used to find a Contact.


List Contacts

Retrieve a list of Contacts with pagination. The pagination has default values, but you can alter those by supplying the pageand limitparameters including values with the call.

Please note: the attributes array is now deprecated.

GET

https://api.piggy.eu/api/v3/oauth/clients/contacts

Headers

Authorization

Accept

Bearer {{ personal_access_token }}

application/json

Input parameters

limit number

optional

Limit of records to retrieve. Maximum: 100.

page number

optional

Page to retrieve. Default: 1.

sort string

optional

Sort by column. Ascending by default, prefix with a hyphen to sort descending (e.g. ?sort=-created_at)

Possible values:

created_at'Sort by creation date. Prefix with '-' for descending.

created_at array

optional

Filter on creation date, can only be sent in as array. Date value must be in ISO8601 format. Combine to retrieve contacts created between two dates.

Possible values:

created_at[gt]Filter on creation date is greater than value.

created_at[gte]Filter on creation date is greater than or equal to value.

created_at[lt]Filter on creation date is lower than value.

created_at[lte]Filter on creation date is greater than value.

Response Example

{
    "data": [
        {
            "id": 21,
            "uuid": "9504d4b2-03c5-41d8-8423-4b1821b6aa00",
            "email": "spongebob@bikinibottom.sea",
            "attributes": [],
            "tier": null,
            "subscriptions": [
                {
                    "is_subscribed": false,
                    "status": "UNSUBSCRIBED",
                    "subscription_type": {
                        "name": "Marketing",
                        "description": "Subscribe here for marketing purposes",
                        "active": true,
                        "strategy": "DOUBLE_OPT_IN",
                        "uuid": "123123123",
                        "id": 1
                    }
                },
                {
                    "is_subscribed": false,
                    "status": "UNSUBSCRIBED",
                    "subscription_type": {
                        "name": "Bikini Bottom Deals",
                        "description": "A monthly email blast with our best offers!",
                        "active": true,
                        "strategy": "DOUBLE_OPT_IN",
                        "uuid": null,
                        "id": 3
                    }
                },
                {
                    "is_subscribed": false,
                    "status": "UNSUBSCRIBED",
                    "subscription_type": {
                        "name": "Events",
                        "description": "Stay in the loop for all our special events",
                        "active": true,
                        "strategy": "OPT_IN",
                        "uuid": null,
                        "id": 4
                    }
                },
                {
                    "is_subscribed": false,
                    "status": "UNSUBSCRIBED",
                    "subscription_type": {
                        "name": "Krusty Krab News",
                        "description": "Never miss out on any of our newest features",
                        "active": true,
                        "strategy": "OPT_OUT",
                        "uuid": null,
                        "id": 5
                    }
                }
            ],
            "credit_balance": {
                "balance": 0,
                "id": 2625749
            },
            "prepaid_balance": {
                "balance_in_cents": 0
            },
            "current_values": {
                "age": null,
                "city": "Bikini Bottom",
                "dier": null,
                "tier": null,
                "uuid": "9504d4b2-03c5-41d8-8423-4b1821b6aa00",
                "email": "spongebob@bikinibottom.sea",
                "avatar": "",
                "locale": null,
                "status": "ACTIVE",
                "address": "",
                "channel": null,
                "lastname": "",
                "birthdate": null,
                "firstname": "",
                "created_at": "2021-10-20T18:06:09+00:00",
                "postalcode": "9999YZ",
                "updated_at": "2023-11-13T12:56:00+00:00",
                "housenumber": 12,
                "phonenumber": "",
                "is_anonymous": false,
                "add_to_wallet": "http://piggy.eu/add-to-wallet/loyalty?uuid=9504d4b2-03c5-41d8-8423-4b1821b6aa00",
                "a_custom_attribute": null,
                "loyalty_balance": 0,
                "prepaid_balance": 0,
                "custom_app_login_url": "http://piggy.eu/home?token=eyJpdiI6IklhRnV6cDNkRUVieTZ2YzN2NlM0Y2c9PSIsInZhbHVlIjoieUZyMlJrRU5MVXRLZDh0dDErWWwxWjN6cnI2VFg3YmVWSWYvQTZhQXRWd1UrQXBqVTcwVmp1ZHo0bDNaK3FncTlGZWdBOEV3ZHkyY0pHemgrSitLSHRyblI0bEJwNnE4eEsyZ0cvN2dEeDQ2ekRjRVlzN05vWW9PWkZ1VjR5NUlCdDdFZUZwUmNHZ2pLTlp5OGdNWnRIaHFpVDdrVzljWC9JU2U4Vk1POFQ4RU9qdU5GbFAyc1ZSaStEekNGUkhyUjRINDRRSHkwa24yVmxkN25lVVBkdz09IiwibWFjIjoiOTcyMTRhZmRhNzRmYWQ3M2NjODY2YTYyOTgxYWFlZWY5OWMzMWY2ZTM0OWJiNDQxNTc1M2ViNjE4ODJjMDVjNyIsInRhZyI6IiJ9",
                "favorite_color": null,
                "custom_app_login_code": 973756,
                "subscription_status_1": "UNSUBSCRIBED",
                "subscription_status_3": "UNSUBSCRIBED",
                "subscription_status_4": "UNSUBSCRIBED",
                "subscription_status_5": "UNSUBSCRIBED",
                "loyalty_associated_shops": "",
                "previous_loyalty_balance": 0,
                "default_contact_identifier": null,
                "subscription_preferences_url": "http://piggy.eu/subscription-preferences/9504d4b2-03c5-41d8-8423-4b1821b6aa00",
                "loyalty_last_transaction_date": null,
                "loyalty_first_transaction_date": null,
                "loyalty_number_of_transactions": 0,
                "loyalty_total_credits_received": 0,
                "double_opt_in_confirmation_url_1": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=9504d4b2-03c5-41d8-8423-4b1821b6aa00&subscription_type=1",
                "double_opt_in_confirmation_url_3": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=9504d4b2-03c5-41d8-8423-4b1821b6aa00&subscription_type=3",
            },
            "current_display_values": {
                "age": "",
                "city": "",
                "dier": "False",
                "tier": "",
                "uuid": "",
                "email": "spongebob@bikinibottom.sea",
                "avatar": "",
                "locale": "",
                "status": "Active",
                "address": "",
                "channel": "",
                "lastname": "",
                "birthdate": "",
                "firstname": "",
                "created_at": "2021-10-20, 20:06",
                "postalcode": "",
                "updated_at": "2023-11-13, 13:56",
                "housenumber": "",
                "phonenumber": "",
                "is_anonymous": "False",
                "add_to_wallet": "http://piggy.eu/add-to-wallet/loyalty?uuid=9504d4b2-03c5-41d8-8423-4b1821b6aa00",
                "a_custom_attribute": "",
                "loyalty_balance": "0",
                "prepaid_balance": "0",
                "custom_app_login_url": "http://piggy.eu/home?token=eyJpdiI6Ikt2N3d5RXJRdEx3VXNqdFZpc2tNaVE9PSIsInZhbHVlIjoiSmpXeVRqZlJ5S2c1cUhOUGtzeXRmMmNQcEpBTzU3K1RjaFpzNnJxY2NBc2xFbVZDNXd5R2k1WDRyQWVQRUt3TDUrRnVPTnp5MURMakFjN0RITjNKQWtaRXpWK3V1V2lqOThTVnEvK3pyZkhHWm42VXdKSkkxSjc1MHZuTFBaK1hFdTZIRHBKaGdmaFR5clczelhYbHhkM0RaL2kzV0l1T0JtRVNqSk5lRm53TWpyWGlNYWExSzlEdXNCMmZyQi9YOU0xOUpvZjdYN2dZRzBJNnFFeVpMdz09IiwibWFjIjoiYmI5MzE3MGU5YmQxODUwOWI1ZTVjNjFjMWRjN2U0Y2FhOGEyOTI5ZDcwNWI5NzY3ZGUwN2U3NzQyNDEyZjAxMyIsInRhZyI6IiJ9",
                "favorite_color": "",
                "custom_app_login_code": "973756",
                "subscription_status_1": "Unsubscribed",
                "subscription_status_3": "Unsubscribed",
                "subscription_status_4": "Unsubscribed",
                "subscription_status_5": "Unsubscribed",
                "loyalty_associated_shops": "",
                "previous_loyalty_balance": "0",
                "default_contact_identifier": "",
                "subscription_preferences_url": "http://piggy.eu/subscription-preferences/9504d4b2-03c5-41d8-8423-4b1821b6aa00",
                "loyalty_last_transaction_date": "",
                "loyalty_first_transaction_date": "",
                "loyalty_number_of_transactions": "0",
                "loyalty_total_credits_received": "0",
                "double_opt_in_confirmation_url_1": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=9504d4b2-03c5-41d8-8423-4b1821b6aa00&subscription_type=1",
                "double_opt_in_confirmation_url_3": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=9504d4b2-03c5-41d8-8423-4b1821b6aa00&subscription_type=3",
            }
        },
        {
            "id": 22,
            "uuid": "123",
            "email": "spongebob@bikinibottom.sea",
            "attributes": [],
            "tier": {
                "uuid": "ea77edd4-5a5e-4a6e-aeda-55038c43c839",
                "name": "Krusty Krew",
                "description": "Krusty Krew Members only",
                "position": 1,
                "media": null
            },
            "subscriptions": [
                {
                    "is_subscribed": false,
                    "status": "UNSUBSCRIBED",
                    "subscription_type": {
                        "name": "Marketing",
                        "description": "Subscribe here for marketing purposes",
                        "active": true,
                        "strategy": "DOUBLE_OPT_IN",
                        "uuid": "123123123",
                        "id": 1
                    }
                },
                {
                    "is_subscribed": false,
                    "status": "UNSUBSCRIBED",
                    "subscription_type": {
                        "name": "Bikini Bottom Deals",
                        "description": "A monthly email blast with our best offers!",
                        "active": true,
                        "strategy": "DOUBLE_OPT_IN",
                        "uuid": null,
                        "id": 3
                    }
                },
                {
                    "is_subscribed": false,
                    "status": "UNSUBSCRIBED",
                    "subscription_type": {
                        "name": "Events",
                        "description": "Stay in the loop for all our special events",
                        "active": true,
                        "strategy": "OPT_IN",
                        "uuid": null,
                        "id": 4
                    }
                },
                {
                    "is_subscribed": false,
                    "status": "UNSUBSCRIBED",
                    "subscription_type": {
                        "name": "Krusty Krab News",
                        "description": "Never miss out on any of our newest features",
                        "active": true,
                        "strategy": "OPT_OUT",
                        "uuid": null,
                        "id": 5
                    }
                }
            ],
            "credit_balance": {
                "balance": 2895,
                "id": 2625740
            },
            "prepaid_balance": {
                "balance_in_cents": 4000
            },
            "current_values": {
                "age": null,
                "city": "Bikini Bottom",
                "dier": null,
                "tier": "1",
                "uuid": "123",
                "email": "spongebob@bikinibottom.sea",
                "avatar": "",
                "locale": null,
                "status": "ACTIVE",
                "address": "",
                "channel": null,
                "lastname": "SquarePants",
                "birthdate": null,
                "firstname": "SpongeBob",
                "created_at": "2021-10-20T18:06:09+00:00",
                "postalcode": "9999YZ",
                "updated_at": "2023-11-13T14:37:00+00:00",
                "housenumber": 12,
                "phonenumber": "",
                "is_anonymous": false,
                "add_to_wallet": "https://leat.com/add-to-wallet/loyalty?uuid=123",
                "a_custom_attribute": null,
                "loyalty_balance": 2895,
                "prepaid_balance": 40,
                "custom_app_login_url": "https://leat.com/home?token=eyJpdiI6ImxTKzI5cXNMdlNXTnM0QXFpMUFVWHc9PSIsInZhbHVlIjoiWEFFK3JYb3lXVDlicC82SkJ0SWNQMUd6S0pUVDROY0ZiY2kvVWVxYzNNOTRoTmswSHcxSkZMOHZqTFRrdmsySm1HL0NJS3BybmNrNW50RkpyL2V2VndZUWVGTEcwK1ZXWWptcnp3MmE4M3kycmlleGRRY0VsaDZ3eXRGd1VkMHRlMGhzdWtic0U5c21Kbm5iTW9qWDcvU0pQSzNEUVRtYnhRWG9ucU1HR21JPSIsIm1hYyI6Ijc2MjY2M2YzNmY3NjNlODMwNWVhNDA2ZjIwZDAxMWExZDNjOWVkZDU4NDYwMGExMTJiYzBhODVkOGJlZGMyMTIiLCJ0YWciOiIifQ==",
                "favorite_color": null,
                "custom_app_login_code": 206820,
                "subscription_status_1": "UNSUBSCRIBED",
                "subscription_status_3": "UNSUBSCRIBED",
                "subscription_status_4": "UNSUBSCRIBED",
                "subscription_status_5": "UNSUBSCRIBED",
                "loyalty_associated_shops": "123123;5fd3322e-671e-430f-aa38-5ed02e600ff7",
                "previous_loyalty_balance": 2897,
                "default_contact_identifier": "123123",
                "subscription_preferences_url": "http://piggy.eu/subscription-preferences/123",
                "loyalty_last_transaction_date": "2023-11-13T14:37:04+00:00",
                "loyalty_first_transaction_date": "2023-01-09T15:03:37+00:00",
                "loyalty_number_of_transactions": 77,
                "loyalty_total_credits_received": 3014,
                "double_opt_in_confirmation_url_1": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=1",
                "double_opt_in_confirmation_url_3": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=3",
            },
            "current_display_values": {
                "age": "",
                "city": "",
                "dier": "False",
                "tier": "Gold",
                "uuid": "",
                "email": "spongebob@bikinibottom.sea",
                "avatar": "",
                "locale": "",
                "status": "Active",
                "address": "",
                "channel": "",
                "lastname": "SquarePants",
                "birthdate": "",
                "firstname": "SpongeBob",
                "created_at": "2021-10-20, 20:06",
                "postalcode": "",
                "updated_at": "2023-11-13, 15:37",
                "housenumber": "",
                "phonenumber": "",
                "is_anonymous": "False",
                "add_to_wallet": "https://leat.com/add-to-wallet/loyalty?uuid=123",
                "a_custom_attribute": "",
                "loyalty_balance": "2895",
                "prepaid_balance": "40",
                "custom_app_login_url": "https://leat.com/home?token=eyJpdiI6Ijh6SnNUM2hIL1lqTStaNFVSbEtPZWc9PSIsInZhbHVlIjoiM0o4K2x4ajlOazl2bW90UzRGbkJnbVNjbDFaall1cWhOL1ZaRjE2d0VhR1BsSll6OG43dTU1dHlMVkxQMnlmOWZ6TFZaWTI3enZOTVFiWmxrNldNUitEMHRvQjIvWjUrbE1UNmJPaFRBb3R4cUxuMzNPUjdEWFZmZFRxUlJOQUs2MEdIK0llR1BQd0dncGhKanZSd0JYYVB3VWplek9FdnpPSUlKczBBTmVzPSIsIm1hYyI6ImYzOTFhMjA0ODE0ZjY3YmExYTY2ODM0YzhkNzFlNjFhNmM2M2Q1MjFhNDA2NDcxMjEzOGI1MGZkYmE1YjdlZWEiLCJ0YWciOiIifQ==",
                "favorite_color": "",
                "custom_app_login_code": "206820",
                "subscription_status_1": "Unsubscribed",
                "subscription_status_3": "Unsubscribed",
                "subscription_status_4": "Unsubscribed",
                "subscription_status_5": "Unsubscribed",
                "loyalty_associated_shops": "Krusty Krab Downtown and Sesame Street",
                "previous_loyalty_balance": "2897",
                "default_contact_identifier": "123123",
                "subscription_preferences_url": "http://piggy.eu/subscription-preferences/123",
                "loyalty_last_transaction_date": "2023-11-13, 15:37",
                "loyalty_first_transaction_date": "2023-01-09, 16:03",
                "loyalty_number_of_transactions": "77",
                "loyalty_total_credits_received": "3014",
                "double_opt_in_confirmation_url_1": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=1",
                "double_opt_in_confirmation_url_3": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=3",
            }
        }
    ],
    "meta": {
        "page": 1,
        "limit": "2",
        "viewing_from": 1,
        "viewing_to": 2,
        "last_page": 31,
        "total": 62
    }
}

Create Contact

If a Contact needs to be created, only the email address is needed. To add any additional data to the Contact, a subsequent Update Contact API call can be used.

POST

https://api.piggy.eu/api//contacts

Headers

Authorization

Bearer {{ access_token | api_key }}

Accept

application/json

Body

email string

REQUIRED

The email address of the Contact to be created.

referral_code string

OPTIONAL

A referral code used for Piggy's referral programme.

Response Example

{
    "data": {
        "uuid": "cd183615-d1cb-402a-b618-6472d5e13890"
    },
    "meta": []
}

Code

Message

1003

Invalid input.

60005

Contact already exists.


Create Contact Async

If a Contact needs to be created quickly and any system values that are normally created upon creation aren't relevant, this function can be used. This API call is much faster than the 'regular' creation API call, focusing on basic Contact creation.

POST

https://api.piggy.eu/api//contacts/async

Headers

Authorization

Bearer {{ access_token | api_key }}

Accept

application/json

Body

email string

REQUIRED

The email address of the Contact to be created.

referral_code string

OPTIONAL

A referral code used for Piggy's referral programme.

Response Example

{
    "data": {
        "uuid": "cd183615-d1cb-402a-b618-6472d5e13890"
    },
    "meta": []
}

Code

Message

1003

Invalid input.

60005

Contact already exists.

60000

Usage limit reached.


Create Anonymous Contact

Creates an anonymous Contact with a fictitious email address. This can be used whenever a new Contact cannot (yet) be identified by their email address, but some actions are already desired (e.g. creation of Credit Receptions). The Contact in question can later create a Contact with their actual email address, and subsequently 'claim' the anonymous Contact, which is then merged with the new Contact.

POST

https://api.piggy.eu/api//contacts/anonymous

Headers

Authorization

Bearer {{ access_token | api_key }}

Accept

application/json

Body

contact_identifier_value string

OPTIONAL

The unique value for the Contact Identifier, which will serve as the identifier

Response Example

{
    "data": {
        "uuid": "cd183615-d1cb-402a-b618-6472d5e13890"
    },
    "meta": []
}

Code

Message

1003

Invalid input.

60005

Contact already exists.

60014

Contact identifier is already linked.

60003

Contact identifier not found.

60000

Usage limit reached.


Find Contact

Find a Contact by email address. To find a Contact using an identifier, see Contact Identifiers.

Please note: the attributes array is now deprecated.

GET

https://api.piggy.eu/api//contacts/find-one-by

Headers

Authorization

Bearer {{ access_token | api_key }}

Accept

application/json

Params

email string

REQUIRED

The Contact's email address

Response Example

{
    "data": {
        "id": 22,
        "uuid": "123",
        "email": "spongebob@bikinibottom.sea",
        "tier": {
            "uuid": "ea77edd4-5a5e-4a6e-aeda-55038c43c839",
            "name": "Krusty Krew",
            "description": "Krusty Krew Members only",
            "position": 1,
            "media": null
        },
        "subscriptions": [
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Marketing",
                    "description": "Subscribe here for marketing purposes",
                    "active": true,
                    "strategy": "DOUBLE_OPT_IN",
                    "uuid": "123123123",
                    "id": 1
                }
            },
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Bikini Bottom Deals",
                    "description": "A monthly email blast with our best offers!",
                    "active": true,
                    "strategy": "DOUBLE_OPT_IN",
                    "uuid": null,
                    "id": 3
                }
            },
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Events",
                    "description": "Stay in the loop for all our special events",
                    "active": true,
                    "strategy": "OPT_IN",
                    "uuid": null,
                    "id": 4
                }
            },
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Krusty Krab News",
                    "description": "Never miss out on any of our newest features",
                    "active": true,
                    "strategy": "OPT_OUT",
                    "uuid": null,
                    "id": 5
                }
            }
        ],
        "credit_balance": {
            "balance": 1612,
        },
        "prepaid_balance": {
            "balance_in_cents": 2000
        },
        "current_values": {
            "age": null,
            "city": "Bikini Bottom",
            "dier": null,
            "tier": "1",
            "uuid": "123",
            "email": "spongebob@bikinibottom.sea",
            "avatar": "",
            "locale": null,
            "status": "ACTIVE",
            "address": "",
            "channel": null,
            "lastname": "",
            "birthdate": null,
            "firstname": "",
            "created_at": "2021-10-20T18:06:09+00:00",
            "postalcode": "9999YZ",
            "updated_at": "2023-11-06T16:47:00+00:00",
            "housenumber": 12,
            "phonenumber": "",
            "is_anonymous": false,
            "add_to_wallet": "https://leat.com/add-to-wallet/loyalty?uuid=123",
            "a_custom_attribute": null,
            "loyalty_balance": 1612,
            "prepaid_balance": 20,
            "custom_app_login_url": "https://leat.com/home?token=eyJpdiI6Ikh3ZW8yRW9pSU9Gc25SYmxRUFVVWUE9PSIsInZhbHVlIjoianhuYncxVHBlK0dqMTN4RHhXNzdZNVJ3aGJqcERFdmVWQlcxYjFNZVZYSVdoWVVMWk54K1UvQ2lFek1nMmtGaTJZNGRNOG1rUUxwRGNnU25JcitpN0d5RWVKN21kS1gvSmMvNTA2bmxqU0Z0cmxoR2pPT0Ewc1hXeEJsMkVJNGFDQlNlSWpHRXVpWndyd3g3eTVXck90Z0tlL3J2RHNRKzRjRkNGb0tmVmVzPSIsIm1hYyI6ImZlMzc0ZDYzZDVjNTNjOTc3YTc1ZTMxN2RmMzM4MDFkZWQ2YWI2MDkwNDY4OWQ1MDk0ZWRkN2Y2ZTdhZjY5ZmEiLCJ0YWciOiIifQ==",
            "custom_app_login_code": 198169,
            "subscription_status_1": "UNSUBSCRIBED",
            "subscription_status_3": "UNSUBSCRIBED",
            "subscription_status_4": "UNSUBSCRIBED",
            "subscription_status_5": "UNSUBSCRIBED",
            "loyalty_associated_shops": "123123;5fd3322e-671e-430f-aa38-5ed02e600ff7",
            "previous_loyalty_balance": 1617,
            "default_contact_identifier": "hash123456",
            "subscription_preferences_url": "http://piggy.eu/subscription-preferences/123",
            "loyalty_last_transaction_date": "2023-11-06T11:32:00+00:00",
            "loyalty_first_transaction_date": "2023-01-09T15:03:37+00:00",
            "loyalty_number_of_transactions": 55,
            "loyalty_total_credits_received": 1697,
            "double_opt_in_confirmation_url_1": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=1",
            "double_opt_in_confirmation_url_3": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=3"
        },
        "current_display_values": {
            "age": "",
            "city": "",
            "dier": "False",
            "tier": "Gold",
            "uuid": "",
            "email": "spongebob@bikinibottom.sea",
            "avatar": "",
            "locale": "",
            "status": "Active",
            "address": "",
            "channel": "",
            "lastname": "",
            "birthdate": "",
            "firstname": "",
            "created_at": "2021-10-20, 20:06",
            "postalcode": "",
            "updated_at": "2023-11-06, 17:47",
            "housenumber": "",
            "phonenumber": "",
            "is_anonymous": "False",
            "add_to_wallet": "https://leat.com/add-to-wallet/loyalty?uuid=123",
            "a_custom_attribute": "",
            "loyalty_balance": "1612",
            "prepaid_balance": "20",
            "custom_app_login_url": "https://leat.com/home?token=eyJpdiI6Imx6TzJVV1ZwNlBRd3VkQmV1NnhKbnc9PSIsInZhbHVlIjoiVnlKZWM4OG5Vdjl0QmNEY242YmZ3OFNpWjQwQXkwRThmMCttWHlwQmNSTFluNzdpVkQwY0ZEcVo5TktvUXRHSVBYUE43S2dscFpyMUJnazFrWWZWVHI3cDNLTVJsZDcwWU9zQWdIejh5YjRQOGx4RjV6aDJjR3FTWlI1RTNlQlRrZEVNcURZeFlaZlYvQ2R2STdSU1RDdFdZT0RRdkxNN01vOXhLQnhaZkNVPSIsIm1hYyI6ImJjMzczNWQ2NGEwNzZlNjZhZTU0OTk3MzIxOTczODYzZjMxZjYwNzM2MjY5ZWJkODRkMTEzODU0NmQxMDU4OTQiLCJ0YWciOiIifQ==",
            "custom_app_login_code": "198169",
            "subscription_status_1": "Unsubscribed",
            "subscription_status_3": "Unsubscribed",
            "subscription_status_4": "Unsubscribed",
            "subscription_status_5": "Unsubscribed",
            "loyalty_associated_shops": "Krusty Krab Downtown and Sesame Street",
            "previous_loyalty_balance": "1617",
            "default_contact_identifier": "hash123456",
            "subscription_preferences_url": "http://piggy.eu/subscription-preferences/123",
            "loyalty_last_transaction_date": "2023-11-06, 12:32",
            "loyalty_first_transaction_date": "2023-01-09, 16:03",
            "loyalty_number_of_transactions": "55",
            "loyalty_total_credits_received": "1697",
            "double_opt_in_confirmation_url_1": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=1",
            "double_opt_in_confirmation_url_3": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=3"
        }
    },
    "meta": []
}

Code

Message

1003

Invalid input.

55031

Contact not found.


Find or Create Contact

Find Contact by email address or – if no Contact exists yet for this email address – our API creates a new Contact for the email address you just supplied and returns the newly created Contact in the response.

GET

https://api.piggy.eu/api//contacts/find-or-create

Headers

Authorization

Bearer {{ access_token | api_key }}

Accept

application/json

Params

email string

REQUIRED

The Contact's email address.

Response Example

{
    "data": {
        "id": 22,
        "uuid": "123",
        "email": "spongebob@bikinibottom.sea",
        "tier": {
            "uuid": "ea77edd4-5a5e-4a6e-aeda-55038c43c839",
            "name": "Krusty Krew",
            "description": "Krusty Krew Members only",
            "position": 1,
            "media": null
        },
        "subscriptions": [
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Marketing",
                    "description": "Subscribe here for marketing purposes",
                    "active": true,
                    "strategy": "DOUBLE_OPT_IN",
                    "uuid": "123123123",
                    "id": 1
                }
            },
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Bikini Bottom Deals",
                    "description": "A monthly email blast with our best offers!",
                    "active": true,
                    "strategy": "DOUBLE_OPT_IN",
                    "uuid": null,
                    "id": 3
                }
            },
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Events",
                    "description": "Stay in the loop for all our special events",
                    "active": true,
                    "strategy": "OPT_IN",
                    "uuid": null,
                    "id": 4
                }
            },
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Krusty Krab News",
                    "description": "Never miss out on any of our newest features",
                    "active": true,
                    "strategy": "OPT_OUT",
                    "uuid": null,
                    "id": 5
                }
            }
        ],
        "credit_balance": {
            "balance": 1612,
        },
        "prepaid_balance": {
            "balance_in_cents": 2000
        },
        "current_values": {
            "age": null,
            "city": "Bikini Bottom",
            "dier": null,
            "tier": "1",
            "uuid": "123",
            "email": "spongebob@bikinibottom.sea",
            "avatar": "",
            "locale": null,
            "status": "ACTIVE",
            "address": "",
            "channel": null,
            "lastname": "",
            "birthdate": null,
            "firstname": "",
            "created_at": "2021-10-20T18:06:09+00:00",
            "postalcode": "9999YZ",
            "updated_at": "2023-11-06T16:47:00+00:00",
            "housenumber": 12,
            "phonenumber": "",
            "is_anonymous": false,
            "add_to_wallet": "https://leat.com/add-to-wallet/loyalty?uuid=123",
            "a_custom_attribute": null,
            "loyalty_balance": 1612,
            "prepaid_balance": 20,
            "custom_app_login_url": "https://leat.com/home?token=eyJpdiI6Ikh3ZW8yRW9pSU9Gc25SYmxRUFVVWUE9PSIsInZhbHVlIjoianhuYncxVHBlK0dqMTN4RHhXNzdZNVJ3aGJqcERFdmVWQlcxYjFNZVZYSVdoWVVMWk54K1UvQ2lFek1nMmtGaTJZNGRNOG1rUUxwRGNnU25JcitpN0d5RWVKN21kS1gvSmMvNTA2bmxqU0Z0cmxoR2pPT0Ewc1hXeEJsMkVJNGFDQlNlSWpHRXVpWndyd3g3eTVXck90Z0tlL3J2RHNRKzRjRkNGb0tmVmVzPSIsIm1hYyI6ImZlMzc0ZDYzZDVjNTNjOTc3YTc1ZTMxN2RmMzM4MDFkZWQ2YWI2MDkwNDY4OWQ1MDk0ZWRkN2Y2ZTdhZjY5ZmEiLCJ0YWciOiIifQ==",
            "custom_app_login_code": 198169,
            "subscription_status_1": "UNSUBSCRIBED",
            "subscription_status_3": "UNSUBSCRIBED",
            "subscription_status_4": "UNSUBSCRIBED",
            "subscription_status_5": "UNSUBSCRIBED",
            "loyalty_associated_shops": "123123;5fd3322e-671e-430f-aa38-5ed02e600ff7",
            "previous_loyalty_balance": 1617,
            "default_contact_identifier": "hash123456",
            "subscription_preferences_url": "http://piggy.eu/subscription-preferences/123",
            "loyalty_last_transaction_date": "2023-11-06T11:32:00+00:00",
            "loyalty_first_transaction_date": "2023-01-09T15:03:37+00:00",
            "loyalty_number_of_transactions": 55,
            "loyalty_total_credits_received": 1697,
            "double_opt_in_confirmation_url_1": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=1",
            "double_opt_in_confirmation_url_3": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=3"
        },
        "current_display_values": {
            "age": "",
            "city": "",
            "dier": "False",
            "tier": "Gold",
            "uuid": "",
            "email": "spongebob@bikinibottom.sea",
            "avatar": "",
            "locale": "",
            "status": "Active",
            "address": "",
            "channel": "",
            "lastname": "",
            "birthdate": "",
            "firstname": "",
            "created_at": "2021-10-20, 20:06",
            "postalcode": "",
            "updated_at": "2023-11-06, 17:47",
            "housenumber": "",
            "phonenumber": "",
            "is_anonymous": "False",
            "add_to_wallet": "https://leat.com/add-to-wallet/loyalty?uuid=123",
            "a_custom_attribute": "",
            "loyalty_balance": "1612",
            "prepaid_balance": "20",
            "custom_app_login_url": "https://leat.com/home?token=eyJpdiI6Imx6TzJVV1ZwNlBRd3VkQmV1NnhKbnc9PSIsInZhbHVlIjoiVnlKZWM4OG5Vdjl0QmNEY242YmZ3OFNpWjQwQXkwRThmMCttWHlwQmNSTFluNzdpVkQwY0ZEcVo5TktvUXRHSVBYUE43S2dscFpyMUJnazFrWWZWVHI3cDNLTVJsZDcwWU9zQWdIejh5YjRQOGx4RjV6aDJjR3FTWlI1RTNlQlRrZEVNcURZeFlaZlYvQ2R2STdSU1RDdFdZT0RRdkxNN01vOXhLQnhaZkNVPSIsIm1hYyI6ImJjMzczNWQ2NGEwNzZlNjZhZTU0OTk3MzIxOTczODYzZjMxZjYwNzM2MjY5ZWJkODRkMTEzODU0NmQxMDU4OTQiLCJ0YWciOiIifQ==",
            "custom_app_login_code": "198169",
            "subscription_status_1": "Unsubscribed",
            "subscription_status_3": "Unsubscribed",
            "subscription_status_4": "Unsubscribed",
            "subscription_status_5": "Unsubscribed",
            "loyalty_associated_shops": "Krusty Krab Downtown and Sesame Street",
            "previous_loyalty_balance": "1617",
            "default_contact_identifier": "hash123456",
            "subscription_preferences_url": "http://piggy.eu/subscription-preferences/123",
            "loyalty_last_transaction_date": "2023-11-06, 12:32",
            "loyalty_first_transaction_date": "2023-01-09, 16:03",
            "loyalty_number_of_transactions": "55",
            "loyalty_total_credits_received": "1697",
            "double_opt_in_confirmation_url_1": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=1",
            "double_opt_in_confirmation_url_3": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=3"
        }
    },
    "meta": []
}

Code

Message

1003

Invalid input.

60000

Usage limit reached.


Find or Create Contact Async

If a Contact needs to be retrieved or created quickly and any system values that are normally created upon contact creation aren't relevant, this can be used. This API call is much faster than the 'regular' find or create API call; only the Contact's UUID will be returned on the response in this instance.

GET

https://api.piggy.eu/api//contacts/find-or-create/async

Headers

Authorization

Bearer {{ access_token | api_key }}

Accept

application/json

Body

email string

REQUIRED

The email address of the Contact to be created or to be found.

Response Example

{
    "data": {
        "uuid": "cd183615-d1cb-402a-b618-6472d5e13890"
    },
    "meta": []
}

Code

Message

1003

Invalid input.

60000

Usage limit reached.


Get Contact

Retrieve a specific Contact with the the using its UUID.

Please note: the attributes array is now deprecated.

GET

https://api.piggy.eu/api//contacts/{{contact_uuid}}

Headers

Authorization

Bearer {{ access_token | api_key }}

Accept

application/json

Params

contact_uuid string

REQUIRED

The Contact's UUID

Response Example

{
    "data": {
        "id": 22,
        "uuid": "123",
        "email": "spongebob@bikinibottom.sea",
        "tier": {
            "uuid": "ea77edd4-5a5e-4a6e-aeda-55038c43c839",
            "name": "Krusty Krew",
            "description": "Krusty Krew Members only",
            "position": 1,
            "media": null
        },
        "subscriptions": [
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Marketing",
                    "description": "Subscribe here for marketing purposes",
                    "active": true,
                    "strategy": "DOUBLE_OPT_IN",
                    "uuid": "123123123",
                    "id": 1
                }
            },
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Bikini Bottom Deals",
                    "description": "A monthly email blast with our best offers!",
                    "active": true,
                    "strategy": "DOUBLE_OPT_IN",
                    "uuid": null,
                    "id": 3
                }
            },
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Events",
                    "description": "Stay in the loop for all our special events",
                    "active": true,
                    "strategy": "OPT_IN",
                    "uuid": null,
                    "id": 4
                }
            },
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Krusty Krab News",
                    "description": "Never miss out on any of our newest features",
                    "active": true,
                    "strategy": "OPT_OUT",
                    "uuid": null,
                    "id": 5
                }
            }
        ],
        "credit_balance": {
            "balance": 1612,
        },
        "prepaid_balance": {
            "balance_in_cents": 2000
        },
        "current_values": {
            "age": null,
            "city": "Bikini Bottom",
            "dier": null,
            "tier": "1",
            "uuid": "123",
            "email": "spongebob@bikinibottom.sea",
            "avatar": "",
            "locale": null,
            "status": "ACTIVE",
            "address": "",
            "channel": null,
            "lastname": "",
            "birthdate": null,
            "firstname": "",
            "created_at": "2021-10-20T18:06:09+00:00",
            "postalcode": "9999YZ",
            "updated_at": "2023-11-06T16:47:00+00:00",
            "housenumber": 12,
            "phonenumber": "",
            "is_anonymous": false,
            "add_to_wallet": "https://leat.com/add-to-wallet/loyalty?uuid=123",
            "a_custom_attribute": null,
            "loyalty_balance": 1612,
            "prepaid_balance": 20,
            "custom_app_login_url": "https://leat.com/home?token=eyJpdiI6Ikh3ZW8yRW9pSU9Gc25SYmxRUFVVWUE9PSIsInZhbHVlIjoianhuYncxVHBlK0dqMTN4RHhXNzdZNVJ3aGJqcERFdmVWQlcxYjFNZVZYSVdoWVVMWk54K1UvQ2lFek1nMmtGaTJZNGRNOG1rUUxwRGNnU25JcitpN0d5RWVKN21kS1gvSmMvNTA2bmxqU0Z0cmxoR2pPT0Ewc1hXeEJsMkVJNGFDQlNlSWpHRXVpWndyd3g3eTVXck90Z0tlL3J2RHNRKzRjRkNGb0tmVmVzPSIsIm1hYyI6ImZlMzc0ZDYzZDVjNTNjOTc3YTc1ZTMxN2RmMzM4MDFkZWQ2YWI2MDkwNDY4OWQ1MDk0ZWRkN2Y2ZTdhZjY5ZmEiLCJ0YWciOiIifQ==",
            "custom_app_login_code": 198169,
            "subscription_status_1": "UNSUBSCRIBED",
            "subscription_status_3": "UNSUBSCRIBED",
            "subscription_status_4": "UNSUBSCRIBED",
            "subscription_status_5": "UNSUBSCRIBED",
            "loyalty_associated_shops": "123123;5fd3322e-671e-430f-aa38-5ed02e600ff7",
            "previous_loyalty_balance": 1617,
            "default_contact_identifier": "hash123456",
            "subscription_preferences_url": "http://piggy.eu/subscription-preferences/123",
            "loyalty_last_transaction_date": "2023-11-06T11:32:00+00:00",
            "loyalty_first_transaction_date": "2023-01-09T15:03:37+00:00",
            "loyalty_number_of_transactions": 55,
            "loyalty_total_credits_received": 1697,
            "double_opt_in_confirmation_url_1": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=1",
            "double_opt_in_confirmation_url_3": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=3"
        },
        "current_display_values": {
            "age": "",
            "city": "",
            "dier": "False",
            "tier": "Gold",
            "uuid": "",
            "email": "spongebob@bikinibottom.sea",
            "avatar": "",
            "locale": "",
            "status": "Active",
            "address": "",
            "channel": "",
            "lastname": "",
            "birthdate": "",
            "firstname": "",
            "created_at": "2021-10-20, 20:06",
            "postalcode": "",
            "updated_at": "2023-11-06, 17:47",
            "housenumber": "",
            "phonenumber": "",
            "is_anonymous": "False",
            "add_to_wallet": "https://leat.com/add-to-wallet/loyalty?uuid=123",
            "a_custom_attribute": "",
            "loyalty_balance": "1612",
            "prepaid_balance": "20",
            "custom_app_login_url": "https://leat.com/home?token=eyJpdiI6Imx6TzJVV1ZwNlBRd3VkQmV1NnhKbnc9PSIsInZhbHVlIjoiVnlKZWM4OG5Vdjl0QmNEY242YmZ3OFNpWjQwQXkwRThmMCttWHlwQmNSTFluNzdpVkQwY0ZEcVo5TktvUXRHSVBYUE43S2dscFpyMUJnazFrWWZWVHI3cDNLTVJsZDcwWU9zQWdIejh5YjRQOGx4RjV6aDJjR3FTWlI1RTNlQlRrZEVNcURZeFlaZlYvQ2R2STdSU1RDdFdZT0RRdkxNN01vOXhLQnhaZkNVPSIsIm1hYyI6ImJjMzczNWQ2NGEwNzZlNjZhZTU0OTk3MzIxOTczODYzZjMxZjYwNzM2MjY5ZWJkODRkMTEzODU0NmQxMDU4OTQiLCJ0YWciOiIifQ==",
            "custom_app_login_code": "198169",
            "subscription_status_1": "Unsubscribed",
            "subscription_status_3": "Unsubscribed",
            "subscription_status_4": "Unsubscribed",
            "subscription_status_5": "Unsubscribed",
            "loyalty_associated_shops": "Krusty Krab Downtown and Sesame Street",
            "previous_loyalty_balance": "1617",
            "default_contact_identifier": "hash123456",
            "subscription_preferences_url": "http://piggy.eu/subscription-preferences/123",
            "loyalty_last_transaction_date": "2023-11-06, 12:32",
            "loyalty_first_transaction_date": "2023-01-09, 16:03",
            "loyalty_number_of_transactions": "55",
            "loyalty_total_credits_received": "1697",
            "double_opt_in_confirmation_url_1": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=1",
            "double_opt_in_confirmation_url_3": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=3"
        }
    },
    "meta": []
}

Code

Message

1003

Invalid input.

55031

Contact not found.


Update Contact

Contact's attributes. Please note that system values or system defined attributes, such as 'credit balance' or 'created at', cannot be updated.

Example payload:

{
    "attributes": {
        "firstname": "John",
        "lastname": "Doe",
        "example_custom_attribute": "Hello",
    }
}

PUT

https://api.piggy.eu/api//contacts/{{contact_uuid}}

Headers

Authorization

Bearer {{ access_token | api_key }}

Accept

application/json

Params

contact_uuid string

REQUIRED

The Contact's UUID

Body

attributes array

REQUIRED

An array of the attributes to be updated.

Response Example

{
    "data": {
        "id": 22,
        "uuid": "123",
        "email": "spongebob@bikinibottom.sea",
        "tier": {
            "uuid": "ea77edd4-5a5e-4a6e-aeda-55038c43c839",
            "name": "Krusty Krew",
            "description": "Krusty Krew Members only",
            "position": 1,
            "media": null
        },
        "subscriptions": [
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Marketing",
                    "description": "Subscribe here for marketing purposes",
                    "active": true,
                    "strategy": "DOUBLE_OPT_IN",
                    "uuid": "123123123",
                    "id": 1
                }
            },
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Bikini Bottom Deals",
                    "description": "A monthly email blast with our best offers!",
                    "active": true,
                    "strategy": "DOUBLE_OPT_IN",
                    "uuid": null,
                    "id": 3
                }
            },
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Events",
                    "description": "Stay in the loop for all our special events",
                    "active": true,
                    "strategy": "OPT_IN",
                    "uuid": null,
                    "id": 4
                }
            },
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Krusty Krab News",
                    "description": "Never miss out on any of our newest features",
                    "active": true,
                    "strategy": "OPT_OUT",
                    "uuid": null,
                    "id": 5
                }
            }
        ],
        "credit_balance": {
            "balance": 1612,
        },
        "prepaid_balance": {
            "balance_in_cents": 2000
        },
        "current_values": {
            "age": null,
            "city": "Bikini Bottom",
            "dier": null,
            "tier": "1",
            "uuid": "123",
            "email": "spongebob@bikinibottom.sea",
            "avatar": "",
            "locale": null,
            "status": "ACTIVE",
            "address": "",
            "channel": null,
            "lastname": "",
            "birthdate": null,
            "firstname": "",
            "created_at": "2021-10-20T18:06:09+00:00",
            "postalcode": "9999YZ",
            "updated_at": "2023-11-06T16:47:00+00:00",
            "housenumber": 12,
            "phonenumber": "",
            "is_anonymous": false,
            "add_to_wallet": "https://leat.com/add-to-wallet/loyalty?uuid=123",
            "a_custom_attribute": null,
            "loyalty_balance": 1612,
            "prepaid_balance": 20,
            "custom_app_login_url": "https://leat.com/home?token=eyJpdiI6Ikh3ZW8yRW9pSU9Gc25SYmxRUFVVWUE9PSIsInZhbHVlIjoianhuYncxVHBlK0dqMTN4RHhXNzdZNVJ3aGJqcERFdmVWQlcxYjFNZVZYSVdoWVVMWk54K1UvQ2lFek1nMmtGaTJZNGRNOG1rUUxwRGNnU25JcitpN0d5RWVKN21kS1gvSmMvNTA2bmxqU0Z0cmxoR2pPT0Ewc1hXeEJsMkVJNGFDQlNlSWpHRXVpWndyd3g3eTVXck90Z0tlL3J2RHNRKzRjRkNGb0tmVmVzPSIsIm1hYyI6ImZlMzc0ZDYzZDVjNTNjOTc3YTc1ZTMxN2RmMzM4MDFkZWQ2YWI2MDkwNDY4OWQ1MDk0ZWRkN2Y2ZTdhZjY5ZmEiLCJ0YWciOiIifQ==",
            "custom_app_login_code": 198169,
            "subscription_status_1": "UNSUBSCRIBED",
            "subscription_status_3": "UNSUBSCRIBED",
            "subscription_status_4": "UNSUBSCRIBED",
            "subscription_status_5": "UNSUBSCRIBED",
            "loyalty_associated_shops": "123123;5fd3322e-671e-430f-aa38-5ed02e600ff7",
            "previous_loyalty_balance": 1617,
            "default_contact_identifier": "hash123456",
            "subscription_preferences_url": "http://piggy.eu/subscription-preferences/123",
            "loyalty_last_transaction_date": "2023-11-06T11:32:00+00:00",
            "loyalty_first_transaction_date": "2023-01-09T15:03:37+00:00",
            "loyalty_number_of_transactions": 55,
            "loyalty_total_credits_received": 1697,
            "double_opt_in_confirmation_url_1": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=1",
            "double_opt_in_confirmation_url_3": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=3"
        },
        "current_display_values": {
            "age": "",
            "city": "",
            "dier": "False",
            "tier": "Gold",
            "uuid": "",
            "email": "spongebob@bikinibottom.sea",
            "avatar": "",
            "locale": "",
            "status": "Active",
            "address": "",
            "channel": "",
            "lastname": "",
            "birthdate": "",
            "firstname": "",
            "created_at": "2021-10-20, 20:06",
            "postalcode": "",
            "updated_at": "2023-11-06, 17:47",
            "housenumber": "",
            "phonenumber": "",
            "is_anonymous": "False",
            "add_to_wallet": "https://leat.com/add-to-wallet/loyalty?uuid=123",
            "a_custom_attribute": "",
            "loyalty_balance": "1612",
            "prepaid_balance": "20",
            "custom_app_login_url": "https://leat.com/home?token=eyJpdiI6Imx6TzJVV1ZwNlBRd3VkQmV1NnhKbnc9PSIsInZhbHVlIjoiVnlKZWM4OG5Vdjl0QmNEY242YmZ3OFNpWjQwQXkwRThmMCttWHlwQmNSTFluNzdpVkQwY0ZEcVo5TktvUXRHSVBYUE43S2dscFpyMUJnazFrWWZWVHI3cDNLTVJsZDcwWU9zQWdIejh5YjRQOGx4RjV6aDJjR3FTWlI1RTNlQlRrZEVNcURZeFlaZlYvQ2R2STdSU1RDdFdZT0RRdkxNN01vOXhLQnhaZkNVPSIsIm1hYyI6ImJjMzczNWQ2NGEwNzZlNjZhZTU0OTk3MzIxOTczODYzZjMxZjYwNzM2MjY5ZWJkODRkMTEzODU0NmQxMDU4OTQiLCJ0YWciOiIifQ==",
            "custom_app_login_code": "198169",
            "subscription_status_1": "Unsubscribed",
            "subscription_status_3": "Unsubscribed",
            "subscription_status_4": "Unsubscribed",
            "subscription_status_5": "Unsubscribed",
            "loyalty_associated_shops": "Krusty Krab Downtown and Sesame Street",
            "previous_loyalty_balance": "1617",
            "default_contact_identifier": "hash123456",
            "subscription_preferences_url": "http://piggy.eu/subscription-preferences/123",
            "loyalty_last_transaction_date": "2023-11-06, 12:32",
            "loyalty_first_transaction_date": "2023-01-09, 16:03",
            "loyalty_number_of_transactions": "55",
            "loyalty_total_credits_received": "1697",
            "double_opt_in_confirmation_url_1": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=1",
            "double_opt_in_confirmation_url_3": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=123&subscription_type=3"
        }
    },
    "meta": []
}

Code

Message

1003

Invalid input.

55031

Contact not found.


Delete Contact

Deletes a Contact. This action is irreversible, the Contact's Credit Balance and any relation to other entities within the system will be removed, although the entities themselves may remain. When using 'DEFAULT' as the deletion type, a log is created containing detailed information. If 'GDPR' is used as the deletion type, any reference to personal data is removed.

Note: This API call schedules the removal of the Contact, this may take a few minutes.

POST

https://api.piggy.eu/api//contacts/{{contact_uuid}}/delete

Headers

Authorization

Bearer {{ access_token | api_key }}

Accept

application/json

Params

contact_uuid string

REQUIRED

The Contact's UUID.

Body

type string

REQUIRED

The deletion type. Options are DEFAULT and GDPR.

Response Example

{
    "data": null,
    "meta": {}
}

Code

Message

55031

Contact not found.


Claim Anonymous Contact

This function enables the conversion of an anonymous Contact (registered with a fictional email address) into a recognized Contact with a real email address. If a Contact already exists with the provided real email address, the anonymous and existing Contacts will be merged.

PUT

https://api.piggy.eu/api//contacts/{{anonymous_contact_uuid}}/claim

Headers

Authorization

Bearer {{ access_token | api_key }}

Accept

application/json

Params

anonymous_contact_uuid string

OPTIONAL

The anonymous Contact's UUID that contains a fictional email address

Body

email string

OPTIONAL

The real email address for the Contact that is about to be not anonymous anymore.

Response Example

{
    "data": {
        "id": 45842,
        "uuid": "999",
        "email": "patrick@bikinibottom.sea",
        "tier": null,
        "subscriptions": [
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Marketing",
                    "description": "Subscribe here for marketing purposes",
                    "active": true,
                    "strategy": "DOUBLE_OPT_IN",
                    "uuid": "123123123",
                    "id": 1
                }
            },
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Bikini Bottom Deals",
                    "description": "A monthly email blast with our best offers!",
                    "active": true,
                    "strategy": "DOUBLE_OPT_IN",
                    "uuid": null,
                    "id": 3
                }
            },
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Events",
                    "description": "Stay in the loop for all our special events",
                    "active": true,
                    "strategy": "OPT_IN",
                    "uuid": null,
                    "id": 4
                }
            },
            {
                "is_subscribed": false,
                "status": "UNSUBSCRIBED",
                "subscription_type": {
                    "name": "Krusty Krab News",
                    "description": "Never miss out on any of our newest features",
                    "active": true,
                    "strategy": "OPT_OUT",
                    "uuid": null,
                    "id": 5
                }
            }
        ],
        "credit_balance": {
            "balance": 0,
            "id": 2625795
        },
        "prepaid_balance": {
            "balance_in_cents": 0
        },
        "current_values": {
            "age": null,
            "city": "Bikini Bottom",
            "dier": "false",
            "tier": null,
            "uuid": "3a685add-1711-425d-9184-fc6db18e0e1d",
            "email": "plankton@bikinibottom.sea",
            "avatar": "",
            "locale": null,
            "status": "ACTIVE",
            "address": "",
            "channel": "OAUTH_API",
            "lastname": "",
            "birthdate": null,
            "firstname": "",
            "created_at": "2023-11-01T14:59:14+00:00",
            "postalcode": "9999YZ",
            "updated_at": "2023-11-01T15:05:00+00:00",
            "housenumber": 12,
            "phonenumber": "",
            "is_anonymous": true,
            "add_to_wallet": "https://leat.com/add-to-wallet/loyalty?uuid=3a685add-1711-425d-9184-fc6db18e0e1d",
            "a_custom_attribute": null,
            "loyalty_balance": 0,
            "prepaid_balance": 0,
            "custom_app_login_url": "https://leat.com/home?token=eyJpdiI6Ikx2dDRqSTF4U3phV21PL1BIcG1STWc9PSIsInZhbHVlIjoiVnc0dUdhblAzZDdod29NQnhmVDlqbFdxYkF3S041WnhlN3hJQ3hrYklaa3BVVzhGbkIrM2R3citUWDVRQnRFL0IrSFJtY1JoQ09WRmR4N3hrZGFzdXBUL2pQVDF4aW9nWFEwQTFUcmliQk5EYXVBaEVpODZiMzh6Qm9Kb0E5QjZaOXM4bjQ3bFhIVEY3SVovRzRnejJZZlVYZUp0ZnA2RUNlUHVYYWlYNytucER5QndxYVNUSnRYVm9na1FrempOTDBmRFE0QkhJOFFIYTM2SnMvcTJ2QT09IiwibWFjIjoiN2JiZTQ5ZDVjMjgyMjY3NDkzYjE2ZTQ0ZTc5M2UyNjUyZWU3ODdiYmFlNzg2N2FjZjJjMDg3MDcxMGUzNTcxNSIsInRhZyI6IiJ9",
            "custom_app_login_code": 184014,
            "subscription_status_1": "UNSUBSCRIBED",
            "subscription_status_3": "UNSUBSCRIBED",
            "subscription_status_4": "UNSUBSCRIBED",
            "subscription_status_5": "UNSUBSCRIBED",
            "loyalty_associated_shops": "",
            "previous_loyalty_balance": 0,
            "default_contact_identifier": null,
            "subscription_preferences_url": "http://piggy.eu/subscription-preferences/3a685add-1711-425d-9184-fc6db18e0e1d",
            "loyalty_last_transaction_date": null,
            "loyalty_first_transaction_date": null,
            "loyalty_number_of_transactions": 0,
            "loyalty_total_credits_received": 0,
            "double_opt_in_confirmation_url_1": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=3a685add-1711-425d-9184-fc6db18e0e1d&subscription_type=1",
            "double_opt_in_confirmation_url_3": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=3a685add-1711-425d-9184-fc6db18e0e1d&subscription_type=3"
        },
        "current_display_values": {
            "age": "",
            "city": "",
            "dier": "False",
            "tier": "",
            "uuid": "",
            "email": "plankton@bikinibottom.sea",
            "avatar": "",
            "locale": "",
            "status": "Active",
            "address": "",
            "channel": "Oauth API",
            "lastname": "",
            "birthdate": "",
            "firstname": "",
            "created_at": "2023-11-01, 15:59",
            "postalcode": "",
            "updated_at": "2023-11-01, 16:05",
            "housenumber": "",
            "phonenumber": "",
            "is_anonymous": "True",
            "add_to_wallet": "https://leat.com/add-to-wallet/loyalty?uuid=3a685add-1711-425d-9184-fc6db18e0e1d",
            "a_custom_attribute": "",
            "loyalty_balance": "0",
            "prepaid_balance": "0",
            "custom_app_login_url": "https://leat.com/home?token=eyJpdiI6ImhWRlZWek8vUDBFWHpGUFRqaXVuQ1E9PSIsInZhbHVlIjoiRFU4WHF4bitIOFVuMHZvdEdFcjZYSlJOZFFxMHJ6bVpNVW4yZVRCZktna3ZXTExZb3d5RnRYNEVIU2FWM3RrMThOamZlUWRXRTdhdCtxazgvQjRyVEJrREwrNDFsSkhpUERWTTJLTTRkbDMrd1kzM3d5KzdLMXMvbVFZcGVFaHFSR0p4aG5WMUJlRHg0UFB6NllINTdYMURhMzMxY1FuVVZZeGdrcmRGaWIrQytxdXBveVZHampsbUdpUlowWktDbEpzbFlHTzBQSWFyWHo0N2ErbWFzZz09IiwibWFjIjoiOTQ4ZmExZGM2YWU4NTAwYjIxZTY4ZmI5YzhhZDFiYTQzMDQ5ZTdmNWNlNGQyNmU3Yjk3MmZkNDI5ZjJmYzE3NSIsInRhZyI6IiJ9",
            "custom_app_login_code": "184014",
            "subscription_status_1": "Unsubscribed",
            "subscription_status_3": "Unsubscribed",
            "subscription_status_4": "Unsubscribed",
            "subscription_status_5": "Unsubscribed",
            "loyalty_associated_shops": "",
            "previous_loyalty_balance": "0",
            "default_contact_identifier": "",
            "subscription_preferences_url": "http://piggy.eu/subscription-preferences/3a685add-1711-425d-9184-fc6db18e0e1d",
            "loyalty_last_transaction_date": "",
            "loyalty_first_transaction_date": "",
            "loyalty_number_of_transactions": "0",
            "loyalty_total_credits_received": "0",
            "double_opt_in_confirmation_url_1": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=3a685add-1711-425d-9184-fc6db18e0e1d&subscription_type=1",
            "double_opt_in_confirmation_url_3": "http://piggy.eu/double-opt-in-confirmation?contact_uuid=3a685add-1711-425d-9184-fc6db18e0e1d&subscription_type=3"
        }
    },
    "meta": []
}

Code

Message

1003

Invalid input.

55031

Contact not found.

60016

Contact not anonymous.


Merge Contact

WARNING: Use at your own risk and with consent from your clients. Before using, ensure both email addresses belong to the same person.

Merges a 'source' Contact into a 'destination' Contact. The 'destination' Contact will be the resulting Contact, whilst the 'source' Contact will be removed. Note: This cannot be undone, so use with care. Only use after verifying the person in question has access to both email addresses.

Note: This API call schedules the merge of the Contacts, this may take a few minutes.

POST

https://api.piggy.eu/api//contacts/merge

Headers

Authorization

Bearer {{ access_token | api_key }}

Accept

application/json

Body

source_contact_uuid string

REQUIRED

The UUID of the Source Contact which will cease to exist.

destination_contact_uuid string

REQUIRED

The UUID of the Destination Contact which remain.

Code

Message

55031

Contact not found.


Get Contact Identifiers

Use this endpoint to retrieve a Contact's Contact Identifiers.

GET

https://api.piggy.eu/api//contacts/{{contact_uuid}}/contact-identifiers

Headers

Authorization

Bearer {{ access_token | api_key }}

Accept

application/json

Params

contact_uuid string

REQUIRED

The Contact's UUID from whom you want to retrieve the Contact Identifiers.

Response Example

{
    "data": {
        [
            "name": "Main Loyalty Card",
            "value": "ABCDE12356-90",
            "active": true,
            "default": true,
            "contact": {
                "uuid": "123abc-def789-qwerty-34567",
            }
        ],
        [
            "name": "Gary Card",
            "value": "QWERTY-7890",
            "active": true,
            "default": false,
            "contact": {
                "uuid": "123abc-def789-qwerty-34567",
            }
        ],
    },
    "meta": []
}

Code

Message

1003

Invalid input.

55031

Contact not found.


Get Credit Balance

Retrieve the current Credit Balance of a specific Contact, identified through their UUID.

GET

https://api.piggy.eu/api//contacts/{{contact_uuid}}/credit-balance

Headers

Authorization

Bearer {{ access_token | api_key }}

Accept

application/json

Params

contact_uuid string

REQUIRED

The Contact's UUID

Response Example

{
    "data": {
        "balance": 49
    },
    "meta": []
}

Code

Message

1003

Invalid input.

55031

Contact not found.


Get Prepaid Balance

Use this function to retrieve the Prepaid Balance of a particular Contact, identified by their UUID.

GET

https://api.piggy.eu/api//contacts/{{contact_uuid}}/prepaid-balance

Headers

Authorization

Bearer {{ access_token | api_key }}

Accept

application/json

Params

contact_uuid string

REQUIRED

The Contact's UUID

Response Example

{
    "data": {
        "balance_in_cents": 5000,
        "balance": "€50.00"
    },
    "meta": []
}

Code

Message

1003

Invalid input.

55031

Contact not found.


Get Tier

Use this endpoint to retrieve the current loyalty Tier of a specific Contact. It’s useful for understanding a Contact's loyalty status and offering them tailored Rewards based on their Tier.

GET

https://api.piggy.eu/api//contacts/{{contact_uuid}}/tier

Headers

Authorization

Bearer {{ access_token | api_key }}

Accept

application/json

Params

contact_uuid string

REQUIRED

The Contact's UUID from whom you want to retrieve the Tier.

Response Example

{
    "data": {
        "name": "Krusty Krew",
        "description": "Krusty Krew Members only",
        "position": 1,
        "media": null,
        "uuid": "ea77edd4-5a5e-4a6e-aeda-55038c43c839"
    },
    "meta": []
}

Code

Message

1003

Invalid input.

55031

Contact not found.

On this page