Webhooks API Documentation BETA
Get Started
Follow these simple steps to register your app and get started with the Pike13 Webhooks API. Only OAuth2 tokens registered to those with the role of owner or higher can access the Webhooks API.
API Description
The purpose of the Webhooks API is to automatically notify you and your services of changes within your business. Remember, only staff members with the role of owner or higher have access to the API. For example, when a new client signs up for your business, we'll automatically send you a JSON payload.
Interaction with the Webhooks API is two parts: subscribing to topics and receiving notifications.
Subscribing
Subscribe using the REST API endpoint. Note that it conforms to JSON API version 1.0. Choose what kinds of notifications should be sent based on available topics.
Receiving
Receive notifications through POST requests. The payload is automatically POSTed to the target server when a change corresponding to a webhook happens.
Example Flow
Once you have an OAuth2 token for an owner of your business, you can subscribe to an available topic.
Let's create a webhook that triggers whenever a new person is created in your business:
SUBSCRIPTION REQUEST
curl -X POST https://mybiz.pike13.com/api/v3/webhooks \
-H 'Authorization: Bearer XXXXXX' \
-H 'Content-Type: application/vnd.api+json' \
-d '{
"data": {
"type": "webhooks",
"attributes": {
"target": "https://target.example.com",
"topic": "person.created"
}
}
}'
The
SUBSCRIPTION RESPONSE
HTTP/1.1 201 Created
Content-Type: application/vnd.api+json
{
"data": {
"id": "1",
"type": "webhooks",
"links": {
"self": "https://subdomain.pike13.com/api/v3/webhooks/1"
},
"attributes": {
"account_id": 1,
"business_id": 1,
"topic": "person.created",
"target": "https://target.example.com/",
"name": null,
"description": null
}
}
}
After this successful subscription, if a person is created for the business, a server on
NOTIFICATION PAYLOAD
POST https://target.example.com/
Content-Type: application/json
{
"topic": "person.created",
"webhook_id": 1,
"business_id": 1,
"data": {
"people": [
{
"id": 10,
"address": null,
"birthdate": null,
"business_id": 1,
"deleted_at": null,
"dependents": [
],
"email": null,
"pronoun": null,
"first_name": "John",
"guardian_email": null,
"guardian_name": "Nathan Doe",
"hidden_at": null,
"is_member": false,
"joined_at": "2019-02-19T23:24:02Z",
"last_name": "Doe",
"location": {
"id": 30742,
"name": "Example Business",
"slug": "example-business"
},
"middle_name": null,
"name": "John Doe",
"phone": "123 456 7890",
"primary_staff_member": {
"id": 2,
"name": "Joseph Cremin"
},
"providers": [
],
"secondary_info_field": "No Membership",
"timezone": "America/Los_Angeles",
"updated_at": "2019-02-19T23:24:02Z"
}
]
}
}
Once you have received this payload, you must respond with a 200 status code within 10 seconds, or else it is considered an error on our end.
The If you require more fields about a person, access the corresponding Core API endpoint upon receiving a webhook:
/api/v2/desk/people/:id
Event occurrence
Core API resource payload url:
Resource Attributes
data.event_occurrences[0] | ||||||||
---|---|---|---|---|---|---|---|---|
id | integer | Event occurrence's ID. | ||||||
event_id | integer | Event's ID. | ||||||
name | string | Event's name. | ||||||
description | string | Event's description. | ||||||
duration_in_minutes | string | Event occurrence's length of duration in minutes. | ||||||
service_id | integer | Service's ID. | ||||||
service_type | string | Service's Type. One of [GroupClass, Appointment, Course]. | ||||||
service_name | string | Service's Name. | ||||||
location_id | integer | Location's ID. | ||||||
room_id | integer | Event's Room ID. | ||||||
room_name | string | Event's Room Name. | ||||||
start_at | timestamp | Timestamp for when the event occurrence starts. | ||||||
end_at | timestamp | Timestamp for when the event occurrence ends. | ||||||
created_at | timestamp | Timestamp for when the event occurrence was created. | ||||||
updated_at | timestamp | Timestamp for when the event occurrence was last updated. | ||||||
updating | boolean | Boolean value of whether event is in the process of updating its underlying iCal object. | ||||||
timezone | string | Event occurrence's timezone. | ||||||
attendance_complete | boolean | Boolean value of whether event occurrence has had its attendance confirmed. | ||||||
visits_count | integer | Integer value of the total amount of clients enrolled. | ||||||
state | string | Event occurrence's state. One of [active, canceled, deleted, reserved]. | ||||||
full | boolean | Boolean value of whether event occurrence is at max capacity. | ||||||
visitors_can_view | boolean | Boolean value of whether visitors (without an account) can see the event. | ||||||
clients_can_view | boolean | Boolean value of whether clients can see the event. | ||||||
members_can_view | boolean | Boolean value of whether members can see the event. | ||||||
clients_can_book | boolean | Boolean value of whether clients can enroll online for the event. | ||||||
members_can_book | boolean | Boolean value of whether members can enroll online for the event. | ||||||
capacity_remaining | integer | Event occurrence's remaining capacity. | ||||||
anonymous_staff | boolean | Boolean value of whether the names of instructors are shown in the event. | ||||||
staff_members | array | Array of people objects who are instructing this event occurrence. Empty if no instructor is currently assigned.
| ||||||
people | array | Array of people objects who are attending this event occurrence. Empty if no person is currently enrolled.
|
event_occurrence.upcoming
Triggers services.reminder_period_in_hours + 1 hours before event starts. If reminder_period_in_hours is not set, then this triggers 24 hours before event starts.
Payload Example
event_occurrence.created
Triggers whenever a new event occurrence is created.
Payload Example
event_occurrence.updated
Triggers whenever an event occurrence is updated.
The specifc list of fields that trigger an update are:
Changes to these fields trigger a notification |
---|
location_id |
start_at |
end_at |
attendance_complete |
visits_count |
state |
This topic supports
data | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
event_occurrences | array | Array of one event occurrence. | ||||||||||||||||||
previous | object | Previous values of the resource. The following are supported:
|
Payload Example
event_occurrence.staff_member_updated
Triggers whenever an instructor is added, removed or changed.
This topic supports
data | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event_occurrences | array | Array of one event occurrence. | |||||||||
previous | object | Previous values of the resource. The following are supported:
|
Payload Example
Invoice
Core API resource payload url:
Resource Attributes
data.invoices[0] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | integer | The ID of the invoice. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
invoice_number | string | A unique bill identifier for this business, a.k.a. bill number. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
invoice_date | string | This invoice's due date. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
total_cents | integer | The amount total in cents for this invoice. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
total | string | The amount total in localized currency for this invoice. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
outstanding_amount_cents | integer | The amount outstanding in cents. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
outstanding_amount | string | The amount outstanding in localized currency. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
discount_total_cents | integer | The sum of all discounts in cents. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
discount_total | string | The sum of all discounts in localized currency. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
adjustment_total_cents | integer | The sum of all adjustments in cents. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
adjustment_total | string | The sum of all adjustments in localized currency. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
included_tax_total_cents | integer | The sum of all included taxes in cents. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
included_tax_total | string | The sum of all included taxes in localized currency. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
additional_tax_total_cents | integer | The sum of all additional taxes in cents. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
additional_tax_total | string | The sum of all additional taxes in localized currency. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
currency | string | The currency ISO code. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
state | string | The current state of the invoice. Either 'open', 'closed', 'canceled', 'cart', 'cart_hidden', or 'on_hold.' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
state_events | array | An array of strings containing the valid state events when calling to update the invoice. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
invoice_items | object | Information regarding the item the invoice is about
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
payments | array | The payments that have already been made on the invoice
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
person | object | Optional. Information regarding the person who the invoice is for
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
coupon | object | Optional. Information regarding a coupon for the invoice, if there is any
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
previous | object | Optional. If this an UPDATE payload - additional information about the changed attributes
|
A Special Note about Invoice Topics
The webhook topic 'invoice.new' is suggested for most uses instead of 'invoice.created'.
The 'invoice.new' topic shields users from being exposed to some of the internal state changes that invoices go through during their lifecycle. For instance, a new invoice object is created every time a shopping cart is created - but most people aren't really interested in an invoice until it is in a billable or paid state.
invoice.new
The 'invoice.new' webhook topic is recommended as the best way to get invoices when they are created from an end user's perspective. It will trigger whenever an invoice is created or updated so long as the state the invoice is entering is NOT CART. The possible states for an invoice are: OPEN, CLOSED, CANCELLED, CART, CART_HIDDEN, ON_HOLD.
Payload Example
invoice.created
The 'invoice.created' webhook topic is not recommended for most users. It triggers every time an internal invoice record is created. For example, if someone starts shopping you would get a notification even if the shopping cart is later abandoned and what we call an "invoice" is never actually created in a billable state. Instead we recommend you use the 'invoice.new' trigger.
Payload Example
invoice.updated
Changes to these fields trigger an "invoice.updated" notification. Payment changes are handled by the Transactions webhook topic. | ||
---|---|---|
state | string | Possible values: open, closed, cancelled, cart, cart_hidden, on_hold |
person | person | The assigned person { id, name, email } |
receipt_email | string | email@example.com |
location | object | { id, name, slug } |
commission_recipient | person | { id, name, email } |
tip_recipient | person | { id, name, email } |
Previous values supported by the "invoice.updated" topic | ||
---|---|---|
state | string | Possible values: open, closed, cancelled, cart, cart_hidden, on_hold |
person | person | The assigned person { id, name, email } |
receipt_email | string | email@example.com |
location | object | { id, name, slug } |
commission_recipient | person | { id, name, email } |
tip_recipient | person | { id, name, email } |
Payload Example
Person
Core API resource payload url:
Resource Attributes
data.people[0] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | integer | Person's ID. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
pronoun | string | Person's preferred pronouns. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
first_name | string | Person's first name. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
middle_name | string | Person's middle name. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
last_name | string | Person's last name. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name | string | Person's full name. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
string | Person's email address. Email address formatting is enforced. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
is_member | boolean | Whether person is a member of the business. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
address | string | Person's physical address. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
phone | string | Person's phone number. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
birthdate | date | Person's date of birth. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
guardian_name | string | Full name of person's guardian. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
guardian_email | string | Email address of person's guardian. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
timezone | integer | Timezone of a person. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
business_id | integer | ID of the business to which a person belongs. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
updated_at | timestamp | Timestamp for when the person was last updated in the business. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
deleted_at | timestamp | Timestamp for when the person was deleted from the business. Null if not deleted. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
hidden_at | timestamp | Timestamp for when the person was hidden in the business. Null if not hidden. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
joined_at | timestamp | Timestamp for when the person joined the business. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
secondary_info_field | string | Client info that appears below this person's name when listing clients. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
primary_staff_member | object | Optional. Staff information for this person.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
location | object | Optional. Location information for this person.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dependents | array | Not supported on person.created. Array of people objects who are managed by the person. Empty if no such people are managed.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
providers | array | Not supported on person.created. Array of people objects who are account managers of the person. Empty if no account managers exist. Same JSON structure as dependents. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
profile_photo | object | Not supported on person.created. Optional. Shows url of profile photo if one is available.
|
person.created
Triggers when a new person is added to a business.
Payload Example
person.updated
Triggers when a specific fields of a person are updated.
The specifc list of fields that trigger an update are:
Changes to these fields trigger a notification | ||||||||
---|---|---|---|---|---|---|---|---|
pronoun | string | Person's preferred pronouns. | ||||||
first_name | string | Person's first name. | ||||||
middle_name | string | Person's middle name. | ||||||
last_name | string | Person's last name. | ||||||
string | Person's email address. Email address formatting is enforced. | |||||||
address | string | Person's physical address. | ||||||
phone | string | Person's phone number. | ||||||
birthdate | date | Person's date of birth. | ||||||
guardian_name | string | Full name of person's guardian. | ||||||
guardian_email | string | Email address of person's guardian. | ||||||
joined_at | timestamp | Timestamp for when the person joined the business. | ||||||
is_member | boolean | Whether person is a member of the business. | ||||||
custom_fields | object |
A notification will be sent whenever an individual
|
This topic supports
data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
people | array | Array of one person updated in the business. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
previous | object | Previous values of the resource. The following are supported:
|
Payload Example
Person.deleted
Triggers when a person is deleted.
Payload Example
Person Plan
Resource Attributes
data.person_plans[0] | |||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | integer | ID of the person_plan association. | |||||||||||||||||||||||||||||||||||||||||||||
created_at | timestamp | Timestamp for when this person became associated with this plan. | |||||||||||||||||||||||||||||||||||||||||||||
deactivated_at | timestamp | Timestamp for when this person was removed from this plan, if applicable. | |||||||||||||||||||||||||||||||||||||||||||||
exhausted_at | timestamp | Timestamp for when this person_plan was exhausted, if applicable. | |||||||||||||||||||||||||||||||||||||||||||||
updated_at | timestamp | Timestamp for when this person_plan was updated, if applicable. | |||||||||||||||||||||||||||||||||||||||||||||
person | object | Details of the person for this person_plan.
| |||||||||||||||||||||||||||||||||||||||||||||
plan | object | Details of the plan for this person_plan.
| |||||||||||||||||||||||||||||||||||||||||||||
plan_product | object | Details of the plan product for this person_plan.
|
person_plan.created
Triggers whenever a new person_plan is created.
Payload Example
person_plan.updated
Triggers whenever a person_plan is updated.
The specifc list of fields that trigger an update are:
Changes to these fields trigger a notification | ||
---|---|---|
person_id | integer | The person on the plan |
deactivated_at | timestamp | The date this plan was deactivated |
exhausted_at | string | The date the person plan was exhausted |
This topic supports
data | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
person_plans | array | Array of one person plan updated in the business. | ||||||||||||
previous | object | Previous values of the resource. The following are supported:
|
Payload Example
Plan
Resource Attributes
data.plans[0] | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
id | integer | ID for this plan. | |||||||||
description | string | Description of this plan. | |||||||||
type | string | Type of this plan. One of ['Pack', 'Prepaid', 'Membership']. | |||||||||
plan_product_id | integer | ID of product associated with this plan. | |||||||||
count | integer | Maximium count (limit) for the number of punches for this plan during the 'limit_period'. | |||||||||
staff_member_id | integer | Staff Member ID for this plan. | |||||||||
location_id | integer | Location ID for this plan. | |||||||||
price | string | Price formatted in currency units for this plan. | |||||||||
price_cents | integer | Price in cents for this plan. | |||||||||
limit_period | string | Limit period for this plan if any. One of ['weekly', 'monthly']. | |||||||||
start_date | date | Start date for this plan. | |||||||||
end_date | date | End date for this plan. | |||||||||
cancelled_at | timestamp | Timestamp for when this plan was cancelled, if applicable. | |||||||||
updated_at | timestamp | Timestamp for when this plan was updated. | |||||||||
created_at | timestamp | Timestamp for when this plan was created. | |||||||||
people | array | Array of people objects who are on this plan. Empty if there are none.
|
plan.updated
Triggers when specific fields of a plan are updated.
The specifc list of fields that trigger an update are:
Changes to these fields trigger a notification |
---|
description |
price_cents |
count |
staff_member_id |
limit_period |
start_date |
end_date |
cancelled_at |
This topic supports
data | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
plans | array | Array of one plan updated in the business. | ||||||||||||||||||||||||||||||
previous | object | Previous values of the resource. The following are supported:
|
Payload Example
plan.ended
Triggers when a plan is cancelled or when its end date has passed.
Payload Example
Plan Hold
Resource Attributes
data.plan_holds[0] | ||
---|---|---|
id | integer | ID of the plan hold. |
start_date | date | Date the plan hold starts. |
end_date | date | Date the plan hold ends. |
plan_id | integer | ID of the associated plan. |
created_at | timestamp | Timestamp for when the plan hold was created. |
updated_at | timestamp | Timestamp for when the plan hold was last updated. |
plan_hold.created
Triggers whenever a new plan hold is created.
Payload Example
plan_hold.updated
Triggers whenever a plan hold is updated.
Payload Example
plan_hold.deleted
Triggers whenever a plan hold is deleted.
Payload Example
Punchcard
Punchcards track the amount of event occurrences the people associated with the punchcard can attend. A new punchcard starts every week if the plan is a weekly plan, every month if the plan is a monthly plan, etc.
Resource Attributes
data.punchcards[0] | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | integer | The punchcard's ID. | |||||||||||||||
count | integer | The number of punches provided by the punchcard. | |||||||||||||||
remaining | integer | The number of punches remaining on the punchcard. | |||||||||||||||
start_date | date | The first day the punchcard is active. | |||||||||||||||
end_date | date | The last day the punchcard is active. | |||||||||||||||
people | object |
| |||||||||||||||
plan | object | Details of the associated plan.
| |||||||||||||||
updated_at | timestamp | Timestamp for when the punchcard was last updated. |
punchcard.started
Triggers when a punchcard becomes active for the current limit period.
Payload Example
punchcard.updated
Triggers when a certain properties of a punchcard are updated.
The specific list of fields that trigger an update are:
Changes to these fields trigger a notification |
---|
count |
remaining |
start_date |
end_date |
data | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
people | array | Array of one updated punchcard. | |||||||||||||||
previous | object | Previous values of the resource. The following are supported:
|
punchcard.updated
Triggers when a punchcard is updated.
Payload Example
punchcard.deleted
Triggers when a punchcard is deleted.
Payload Example
Transaction
By subscribing to a transaction topic, you will be notified of two transaction types: payments and refunds. Check the
Resource Attributes
data.transactions[0] | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | integer | The transaction's ID. | ||||||||||||||||||||||||
invoice_id | integer | ID of the associated invoice. | ||||||||||||||||||||||||
currency_code | string | The currency ISO code. | ||||||||||||||||||||||||
amount_cents | integer | The amount in cents of the transaction. | ||||||||||||||||||||||||
amount | string | The amount in localized currency of the transaction. | ||||||||||||||||||||||||
error_message | string | The error message for the transaction if it failed. | ||||||||||||||||||||||||
description | string | The description of the transaction. | ||||||||||||||||||||||||
voided_at | timestamp | The date the transaction was voided. | ||||||||||||||||||||||||
payment_type_id | integer | The type id of the available payment method. | ||||||||||||||||||||||||
type | string | Type is one of ['Payment', 'Refund']. | ||||||||||||||||||||||||
settled | boolean | Whether transaction has settled according to the payment gateway. Settled transactions cannot be voided. | ||||||||||||||||||||||||
state | string | One of ['failed', 'processing', 'completed', 'checkout'] | ||||||||||||||||||||||||
uuid | uuid | UUID of the transaction. | ||||||||||||||||||||||||
autobill | boolean | Whether or not this transaction is on autobill. | ||||||||||||||||||||||||
payment_id | integer | ID of the payment. Only included if the transaction is a Refund. | ||||||||||||||||||||||||
external_transaction_id | integer | ID of the transaction according to the external transaction processor. | ||||||||||||||||||||||||
payment_type | string | Type of payment. One of ['cash', 'check', 'creditcard', 'ach', 'comp', 'free', 'external_creditcard', 'square', 'paypal', 'external', 'credit']. | ||||||||||||||||||||||||
created_at | timestamp | Timestamp for when transaction was created. | ||||||||||||||||||||||||
updated_at | timestamp | Timestamp for when transaction was last updated. | ||||||||||||||||||||||||
invoice | object | Details of the associated invoice.
|
transaction.created
Triggers when a new transaction is created.
Payload Example
transaction.updated
Triggers when a certain properties of a transaction are updated.
The specific list of fields that trigger an update are:
Changes to these fields trigger a notification |
---|
invoice_id |
currency_code |
amount_cents |
error_message |
description |
voided_at |
payment_type_id |
type |
settled |
state |
uuid |
autobill |
payment_id |
external_transaction_id |
payment_type |
data | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
people | array | Array of one updated transaction. | ||||||||||||||||||||||||||||||||||||||||||||||||
previous | object | Previous values of the resource. The following are supported:
|
Payload Example
Visit
Core API resource payload url:
Resource Attributes
data.visits[0] | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | integer | The visit's ID. | ||||||||||||||||||||||||||||||||||||
person_id | integer | ID of the associated person. | ||||||||||||||||||||||||||||||||||||
event_occurrence_id | integer | ID of the associated event occurrence. | ||||||||||||||||||||||||||||||||||||
state | string | Status of the visit. One of ['registered', 'reserved', 'noshowed', 'late_canceled', or 'completed'] | ||||||||||||||||||||||||||||||||||||
registered_at | timestamp | Timestamp for when visit was registered. Typically, this is when the visit was created. | ||||||||||||||||||||||||||||||||||||
completed_at | timestamp | Timestamp for when visit was marked as complete by a staff member. | ||||||||||||||||||||||||||||||||||||
noshow_at | timestamp | Timestamp for when visit was marked as no-show by a staff member. | ||||||||||||||||||||||||||||||||||||
cancelled_at | timestamp | Timestamp for when visit was marked as a late cancel by a staff member. | ||||||||||||||||||||||||||||||||||||
created_at | timestamp | Timestamp for when visit was created. | ||||||||||||||||||||||||||||||||||||
updated_at | timestamp | Timestamp for when visit was last updated. | ||||||||||||||||||||||||||||||||||||
paid | boolean | True if this visit has been paid for. | ||||||||||||||||||||||||||||||||||||
paid_for_by | string | Description of the plan used to pay for the visit. | ||||||||||||||||||||||||||||||||||||
punch_id | integer | The id of the punch if present. | ||||||||||||||||||||||||||||||||||||
only_staff_can_cancel | boolean | True if only staff can cancel this visit. | ||||||||||||||||||||||||||||||||||||
event_occurrence | object | Details of the associated event_occurrence.
| ||||||||||||||||||||||||||||||||||||
person | object | Details of the associated person.
|
A Special Note about Visit Topics
The webhook topic 'visit.new' is suggested for most uses instead of 'visit.created'.
The 'visit.new' topic shields users from being exposed to some of the internal state changes that visits go through during their lifecycle. For instance, a new visit object is created in a "reserved" state before the user has paid for their registration. Most users will be interested in a visit once it's been "booked."
visit.new
Triggers when a new visit is created in a state other than "reserved." Also triggers when a visit transitions from "reserved" to "registered", "completed", "noshowed", or "late_cancel."
Payload Example
visit.created
Triggers whenever a new visit is created, including those in a pre-booked "reserved" state.
Payload Example
visit.deleted
Triggers when a visit is deleted.
Payload Example
visit.updated
Triggers when specific fields of a visit are updated.
The specifc list of fields that trigger an update are:
Changes to these fields trigger a notification | ||
---|---|---|
state | string | Status of the visit. One of ['registered', 'reserved', 'noshowed', 'late_canceled', or 'completed'] |
completed_at | timestamp | Timestamp for when visit was marked as complete by a staff member. |
noshow_at | timestamp | Timestamp for when visit was marked as no-show by a staff member. |
cancelled_at | timestamp | Timestamp for when visit was marked as a late cancel by a staff member. |
punch_id | integer | The id of the punch if present. |
This topic supports
data | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
visits | array | Array of one visit updated in the business. | ||||||||||||||||||
previous | object | Previous values of the resource. The following are supported:
|
Payload Example
Webhook
Represents a subscription to a topic for changes within a business. Franchises will be automatically notified of changes in all franchisees provided the franchise has created a webhook with a relevant topic. Every
The subscription endpoint conforms to JSON API version 1.0.
GET /api/v3/webhooks
Returns all webhooks created by an account and scoped by the subdomain.
GET /api/v3/webhooks/:id
Returns a specific webhook.
POST /api/v3/webhooks
Create a webhook.
Required Attributes | ||
---|---|---|
topic | string | Must be a valid topic. |
target | https url | An endpoint for Pike13 servers to POST a payload to. |
Optional Attributes | ||
---|---|---|
name | string | A name for the webhook. |
description | string | Description. |
PATCH /api/v3/webhooks/:id
Update a specific webhook.
DELETE /api/v3/webhooks/:id
Deletes a specific webhook.
POST bodies
Notifications are sent within HTTP POST bodies. The common format for notifications hitting target servers is
NOTIFICATION PAYLOAD
POST https://target.example.com/
Content-Type: application/json
{
"topic": "person.created",
"data": { <topic fields> },
"target_url": "https://target.example.com",
"webhook_id": 1
}
Where the supported fields are documented for each topic. If the webhook is a <resource>.updated topic:
TOPIC FIELDS (changed exists only on *.updated topics)
{
...Supported fields for the topic,
"changed": {<previous states of the corresponding field>}
}
EXAMPLE: person.updated payload
{
"topic": "person.updated",
"data": {
"people": [
{
"id": 1,
"first_name": "Gary",
"middle_name": null,
"last_name": "Turcotte",
"email": "turcotte_raegan@pike13.com",
"account_id": null,
"created_at": "2012-09-03T09:05:00.468-07:00",
"updated_at": "2012-09-03T09:08:53.337-07:00",
"business_id": 1,
"is_client": true,
"address": null,
"phone": "(534)052-5044",
"location_id": null,
... (truncated for clarity)
}
],
"previous": {
"first_name": "John",
"updated_at": "2012-09-03T09:08:53.337-07:00"
}
},
"webhook_id": 1,
"business_id": 1
}
The indicated
Requirements
- The target url specified when creating a webhook must be be https.
- Servers must respond with a 200 (Success) status code upon receiving a notification within 10 seconds.
- Opening a connection to servers will timeout if it takes longer than 10 seconds.
- If a target url server responds with a 410 (Gone) status code the webhook will be deleted.
Notification Lifetime
Generally, a notification will reach target servers within minutes and likely sooner. In the event that notification destinations are unavailable when POSTing, the notification will be retried based on the response status code returned. However, notifications may expire if the target server does not respond with a 200 after 20 retries.
Retry Status Codes |
---|
429 |
500-599 |
All other status codes returned by servers will result in the dropping the notification immediately. To help with debugging, use the trigger sample notification endpoint to receive a notification.
Retry Intervals
Retries are done with jittered exponential backoff. We will retry sending a notification 20 times over the next 4 days.
Automated Unsubscription
By default a webhook will continue to receive notifications indefinitely. However, when the user who created the webhook is no longer an owner of the business or the user has been removed from the business, all of their webhooks are unsubscribed automatically. Additionally, when the business has chosen to disable the webhooks feature, all of its webhooks will be unsubscribed automatically.
Debugging Notifications
Trigger sample notification.
POST /api/v3/webhooks/:webhook_id/trigger_sample_notification
Sends a sample notification to a webhook's target URL. Does not make a real data change.