Logo
Getting started
    • Overview
    • Authentication
    • Testing
    • Error handling
    • Webhooks
    • Loyalty Tokens
    • Register API
Tutorials
API Reference

Custom Attributes

Custom Attributes are flexible, tailored attributes that allow you to extend the entities in the Piggy system.

Currently, Custom Attributes can be created for the following entities:

business_profilesFor entity: Business Profile (or Shop)
contactFor entity: Contact
rewardFor entity: Reward
promotionFor entity: Promotion (note: use this one when working with Vouchers)
voucherFor entity: Voucher (note: this is for individual vouchers, you'll likely need Promotion instead
giftcardFor entity: Giftcard
giftcard_transactionFor entity: Giftcard Transaction
prepaidFor entity: Prepaid Transaction
bookingFor entity: Booking
visitFor entity: Visit
shiftFor entity: Shift

If you're missing any entity here, please reach out so we can see if we can make it happen on short notice.

List Custom Attributes

Get a list of Custom Attributes for a specified entity.

GET
https://api.piggy.eu/api//custom-attributes
Headers
Authorization
Bearer {{ api_key }}
Accept
application/json
Params
entitystring
REQUIRED
The entity of the Custom Attributes you want to retrieve.
Response Example
Show more
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 { "data": [ { "id": 2234, "entity": "voucher", "name": "rens_123", "label": "Rens123", "type": "select", "group_name": null, "group": { "id": 141, "name": "General", "created_by_user": null, "position": 1 }, "is_piggy_defined": false, "is_soft_read_only": false, "is_hard_read_only": false, "field_type": null, "has_unique_value": false, "description": "some description", "options": [ { "value": "100", "label": "Blue", "description": null, "media": null }, { "value": "200", "label": "Red", "description": null, "media": null }, { "value": "300", "label": "Yellow", "description": null, "media": null } ], "position": 1, "created_at": "2023-11-13T16:04:14+00:00", "meta": [], "can_be_deleted": true, "last_used_date": null, "created_by_user": null } ] }

Create Custom Attribute

Creates a new Custom Attribute for a specified entity. You need to provide essential details like the entity type, name, label, and data type of the attribute. There's also the option to add a description and, for select attributes, an array of options.

POST
https://api.piggy.eu/api//custom-attributes
Headers
Authorization
Bearer {{ api_key }}
Accept
application/json

Body

entitystring
REQUIRED
The entity that you want to create the Custom Attributes for.
namestring
REQUIRED
The unique value for the Custom Attribute, used for internal purposes.
labelstring
REQUIRED
The label for the attribute, which is outputted.
typestring
REQUIRED
The data type of the attribute, possible options: url, text, date, phone, float, color, email, number, select, boolean, rich_text, date_time, long_text, date_range, time_range, identifier, birth_date, file_upload, media_upload, multi_select or license_plate.
optionsarray
OPTIONAL
Applicable for (multi)selects only. Array consisting of name and value arrays.
descriptionstring
OPTIONAL
A description for the attribute.
group_namestring
OPTIONAL
Name of the Group to which the attribute belongs.
Response Example
Show more
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 { "data": { "entity": "promotion", "name": "discount_type", "label": "Discount Type", "type": "select", "group": { "name": "General", }, "is_piggy_defined": false, "is_soft_read_only": false, "is_hard_read_only": false, "has_unique_value": false, "description": "Type of discount for this Voucher", "options": [ { "value": "percentage", "label": "Percentage", }, { "value": "fixed", "label": "Fixed", }, ], "created_at": "2023-11-13T16:04:14+00:00", }, "meta": [] }

Update Custom Attribute

Updates the properties of a Custom Attribute. Note that only the label, description, options for selects and multiselects, group can be updated. Attributes defined by the system cannot be updated.

PUT
https://api.piggy.eu/api//custom-attributes/{{custom_attribute_name}}
Headers
Authorization
Bearer {{ api_key }}
Accept
application/json

Body

entitystring
REQUIRED
The entity that you want to create the Custom Attributes for.
labelstring
OPTIONAL
The label for the attribute, which is outputted.
optionsarray
OPTIONAL
Applicable for (multi)selects only. Array consisting of name and value arrays.
descriptionstring
OPTIONAL
A description for the attribute.
group_namestring
OPTIONAL
Name of the Group to which the attribute belongs.
Response Example
Show more
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 { "data": { "entity": "promotion", "name": "discount_type", "label": "Discount Type", "type": "select", "group": { "name": "General", }, "is_piggy_defined": false, "is_soft_read_only": false, "is_hard_read_only": false, "has_unique_value": false, "description": "Type of discount for this Voucher", "options": [ { "value": "percentage", "label": "Percentage", }, { "value": "fixed", "label": "Fixed", }, ], "created_at": "2023-11-13T16:04:14+00:00", }, "meta": [] }