-
Notifications
You must be signed in to change notification settings - Fork 157
Expand file tree
/
Copy pathxero-webhooks.yaml
More file actions
278 lines (278 loc) · 10.7 KB
/
xero-webhooks.yaml
File metadata and controls
278 lines (278 loc) · 10.7 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
openapi: 3.1.1
info:
description: The Xero Webhooks API exposes event notifications relating to entities in the Xero Public API and can be used for a variety of purposes
title: Xero Webhooks API
version: 12.0.2
termsOfService: https://developer.xero.com/xero-developer-platform-terms-conditions/
contact:
name: Xero Platform Team
email: api@xero.com
url: https://developer.xero.com
servers:
- description: The Xero Webhooks API exposes event notifications relating to entities in the Xero Public API and can be used for a variety of purposes
url: https://api.xero.com
security: []
webhooks:
invoices:
post:
summary: Invoices Webhook Endpoint
description: Invoice (Create, Update)
operationId: publishInvoiceEvent
tags:
- Events
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/WebhookEvent"
responses:
"200":
$ref: "#/components/responses/200WebhookDataReceivedOk"
"401":
$ref: "#/components/responses/401InvalidWebhookData"
subscriptions:
post:
summary: Subscriptions Webhook Endpoint
description: Subscription (Create, Update)
operationId: publishSubscriptionEvent
tags:
- Events
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/WebhookEvent"
responses:
"200":
$ref: "#/components/responses/200WebhookDataReceivedOk"
"401":
$ref: "#/components/responses/401InvalidWebhookData"
contacts:
post:
summary: Contacts Webhook Endpoint
description: Contact (Create, Update)
operationId: publishContactEvent
tags:
- Events
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/WebhookEvent"
responses:
"200":
$ref: "#/components/responses/200WebhookDataReceivedOk"
"401":
$ref: "#/components/responses/401InvalidWebhookData"
creditNotes:
post:
summary: Credit Notes Webhook Endpoint
description: Credit Note (Create, Update)
operationId: publishCreditNoteEvent
tags:
- Events
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/CreditNoteWebhookEvent"
examples:
creditNoteCreate:
summary: Credit Note Create Event
value:
events:
- resourceUrl: https://api.xero.com/api.xro/2.0/CreditNotes/55d84274-a3da-4829-a7c0-0cab601b95cc
resourceId: 55d84274-a3da-4829-a7c0-0cab601b95cc
tenantId: aef86862-2015-4b6b-88bc-d89032cecc50
tenantType: ORGANISATION
eventCategory: CREDITNOTE
eventType: CREATE
eventDateUtc: 2025-12-02T00:44:09.923
data:
Type: ACCPAYCREDIT
Status: DRAFT
firstEventSequence: 76
lastEventSequence: 76
entropy: FXNGWLCCGVANWHKILRUB
responses:
"200":
$ref: "#/components/responses/200WebhookDataReceivedOk"
"401":
$ref: "#/components/responses/401InvalidWebhookData"
components:
headers:
x-xero-signature:
description: A hashed signature of the payload is passed along in the headers of each request as x-xero-signature
schema:
type: string
example: "<Base_64_HMAC_SHA_256>"
schemas:
WebhookEvent:
required:
- events
- lastEventSequence
- firstEventSequence
- entropy
properties:
events:
type: array
items:
type: object
properties:
resourceUrl:
type: string
format: uri
description: The URL to retrieve the resource that has changed
resourceId:
type: string
format: uuid
description: The ID of the resource that has changed (e.g. ContactID)
eventDateUtc:
type: string
format: date-time
description: The date and time that event occurred (UTC time)
eventType:
type: string
description: The type of event of that occurred (e.g. UPDATE)
oneOf:
- type: string
const: CREATE
description: When a new resource is created
- type: string
const: UPDATE
description: When an existing resource is updated (including when they are archived)
eventCategory:
type: string
description: The category of event that occurred (e.g. CONTACT). You will only retrieve events from categories that your webhook is subscribed to
oneOf:
- type: string
const: CONTACT
description: For organisation contact-related events
- type: string
const: INVOICE
description: For organisation invoice-related events
- type: string
const: SUBSCRIPTION
description: For application subscription-related events
- type: string
const: CREDITNOTE
description: For organisation credit note-related events
tenantId:
type: string
format: uuid
description: The ID of the tenant that the event happened in relation to (OrganisationID or ApplicationID)
tenantType:
type: string
description: The type of tenant
oneOf:
- type: string
const: ORGANISATION
description: Represents a Xero organisation (for non-Subscription events)
- type: string
const: APPLICATION
description: Represents a Xero application (for Subscription events)
required:
- resourceUrl
- resourceId
- eventDateUtc
- eventType
- eventCategory
- tenantId
- tenantType
description: A list of events that have occurred
lastEventSequence:
type: integer
minimum: 1
maximum: 2147483647
description: The sequence number of the last event in the list
firstEventSequence:
type: integer
minimum: 1
maximum: 2147483647
description: The sequence number of the first event in the list
entropy:
type: string
description: A random string used for security or validation purposes
CreditNoteWebhookEvent:
allOf:
- $ref: "#/components/schemas/WebhookEvent"
- type: object
properties:
events:
type: array
items:
allOf:
- $ref: "#/components/schemas/WebhookEvent/properties/events/items"
- type: object
properties:
eventCategory:
const: CREDITNOTE
data:
type: object
description: Additional data for credit note events
required:
- Type
- Status
properties:
Type:
type: string
description: The type of credit note
externalDocs:
url: https://developer.xero.com/documentation/api/accounting/types#credit-notes
oneOf:
- type: string
const: ACCPAYCREDIT
description: An Accounts Payable(supplier) Credit Note
- type: string
const: ACCRECCREDIT
description: An Account Receivable(customer) Credit Note
Status:
type: string
description: The status of the credit note
externalDocs:
url: https://developer.xero.com/documentation/api/accounting/types#invoice-status-codes
oneOf:
- type: string
const: DRAFT
description: Draft credit note
- type: string
const: SUBMITTED
description: Submitted credit note
- type: string
const: DELETED
description: Deleted credit note
- type: string
const: AUTHORISED
description: Authorised credit note
- type: string
const: PAID
description: Paid credit note
- type: string
const: VOIDED
description: Voided credit note
required:
- data
responses:
401InvalidWebhookData:
description: Return a 401 status to indicate that the webhook subscription failed
200WebhookDataReceivedOk:
description: Return a 200 status to indicate that the webhook subscription succeeded
headers:
x-xero-signature:
$ref: "#/components/headers/x-xero-signature"
content:
application/json:
schema:
$ref: "#/components/schemas/WebhookEvent"
example:
events:
- resourceUrl: https://api.xero.com/api.xro/2.0/Contacts/717f2bfc-c6d4-41fd-b238-3f2f0c0cf777
resourceId: 717f2bfc-c6d4-41fd-b238-3f2f0c0cf777
eventDateUtc: 2024-06-21T01:15:39.902
eventType: UPDATE
eventCategory: CONTACT
tenantId: c2cc9b6e-9458-4c7d-93cc-f02b81b0594f
tenantType: ORGANISATION
lastEventSequence: 1
firstEventSequence: 1
entropy: S0m3r4Nd0mt3xt