|
| 1 | +openapi: 3.1.1 |
| 2 | +info: |
| 3 | + 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. |
| 4 | + title: Xero Webhooks API |
| 5 | + version: 9.1.1 |
| 6 | + termsOfService: https://developer.xero.com/xero-developer-platform-terms-conditions/ |
| 7 | + contact: |
| 8 | + name: Xero Platform Team |
| 9 | + email: api@xero.com |
| 10 | + url: https://developer.xero.com |
| 11 | +servers: |
| 12 | + - 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. |
| 13 | + url: https://api.xero.com |
| 14 | +webhooks: |
| 15 | + invoices: |
| 16 | + post: |
| 17 | + summary: Invoices Webhook Endpoint |
| 18 | + description: Invoice (Create, Update) |
| 19 | + operationId: publishInvoiceEvent |
| 20 | + tags: |
| 21 | + - Events |
| 22 | + requestBody: |
| 23 | + content: |
| 24 | + application/json: |
| 25 | + schema: |
| 26 | + $ref: '#/components/schemas/WebhookEvent' |
| 27 | + responses: |
| 28 | + "200": |
| 29 | + $ref: '#/components/responses/200WebhookDataReceivedOk' |
| 30 | + "401": |
| 31 | + $ref: '#/components/responses/401InvalidWebhookData' |
| 32 | + |
| 33 | + subscriptions: |
| 34 | + post: |
| 35 | + summary: Subscriptions Webhook Endpoint |
| 36 | + description: Subscription (Create, Update) |
| 37 | + operationId: publishSubscriptionEvent |
| 38 | + tags: |
| 39 | + - Events |
| 40 | + requestBody: |
| 41 | + content: |
| 42 | + application/json: |
| 43 | + schema: |
| 44 | + $ref: '#/components/schemas/WebhookEvent' |
| 45 | + responses: |
| 46 | + "200": |
| 47 | + $ref: '#/components/responses/200WebhookDataReceivedOk' |
| 48 | + "401": |
| 49 | + $ref: '#/components/responses/401InvalidWebhookData' |
| 50 | + |
| 51 | + contacts: |
| 52 | + post: |
| 53 | + summary: Contacts Webhook Endpoint |
| 54 | + description: Contact (Create, Update) |
| 55 | + operationId: publishContactEvent |
| 56 | + tags: |
| 57 | + - Events |
| 58 | + requestBody: |
| 59 | + content: |
| 60 | + application/json: |
| 61 | + schema: |
| 62 | + $ref: '#/components/schemas/WebhookEvent' |
| 63 | + responses: |
| 64 | + "200": |
| 65 | + $ref: '#/components/responses/200WebhookDataReceivedOk' |
| 66 | + "401": |
| 67 | + $ref: '#/components/responses/401InvalidWebhookData' |
| 68 | + |
| 69 | +components: |
| 70 | + headers: |
| 71 | + x-xero-signature: |
| 72 | + description: A hashed signature of the payload is passed along in the headers of each request as x-xero-signature |
| 73 | + schema: |
| 74 | + type: string |
| 75 | + example: "<Base_64_HMAC_SHA_256>" |
| 76 | + |
| 77 | + schemas: |
| 78 | + WebhookEvent: |
| 79 | + required: |
| 80 | + - events |
| 81 | + - lastEventSequence |
| 82 | + - firstEventSequence |
| 83 | + - entropy |
| 84 | + properties: |
| 85 | + events: |
| 86 | + type: array |
| 87 | + items: |
| 88 | + type: object |
| 89 | + properties: |
| 90 | + resourceUrl: |
| 91 | + type: string |
| 92 | + format: uri |
| 93 | + description: The URL to retrieve the resource that has changed |
| 94 | + resourceId: |
| 95 | + type: string |
| 96 | + format: uuid |
| 97 | + description: The ID of the resource that has changed (e.g. ContactID) |
| 98 | + eventDateUtc: |
| 99 | + type: string |
| 100 | + format: date-time |
| 101 | + description: The date and time that event occurred (UTC time) |
| 102 | + eventType: |
| 103 | + type: string |
| 104 | + description: The type of event of that occurred (e.g. Update) |
| 105 | + eventCategory: |
| 106 | + type: string |
| 107 | + description: The category of event that occurred (e.g. CONTACT). You will only retrieve events from categories that your webhook is subscribed to. |
| 108 | + tenantId: |
| 109 | + type: string |
| 110 | + format: uuid |
| 111 | + description: The ID of the tenant that the event happened in relation to (OrganisationID or ApplicationID) |
| 112 | + tenantType: |
| 113 | + type: string |
| 114 | + description: The type of tenant, depending on the type of event it will be one of ORGANISATION (for Contact or Invoice events), or APPLICATION (for Subscription events) |
| 115 | + required: |
| 116 | + - resourceUrl |
| 117 | + - resourceId |
| 118 | + - eventDateUtc |
| 119 | + - eventType |
| 120 | + - eventCategory |
| 121 | + - tenantId |
| 122 | + - tenantType |
| 123 | + description: A list of events that have occurred. |
| 124 | + lastEventSequence: |
| 125 | + type: integer |
| 126 | + minimum: 1 |
| 127 | + maximum: 2147483647 |
| 128 | + description: The sequence number of the last event in the list. |
| 129 | + firstEventSequence: |
| 130 | + type: integer |
| 131 | + minimum: 1 |
| 132 | + maximum: 2147483647 |
| 133 | + description: The sequence number of the first event in the list. |
| 134 | + entropy: |
| 135 | + type: string |
| 136 | + description: A random string used for security or validation purposes. |
| 137 | + responses: |
| 138 | + 401InvalidWebhookData: |
| 139 | + description: Return a 401 status to indicate that the webhook subscription failed |
| 140 | + |
| 141 | + 200WebhookDataReceivedOk: |
| 142 | + description: Return a 200 status to indicate that the webhook subscription succeeded |
| 143 | + headers: |
| 144 | + x-xero-signature: |
| 145 | + $ref: '#/components/headers/x-xero-signature' |
| 146 | + content: |
| 147 | + application/json: |
| 148 | + schema: |
| 149 | + $ref: '#/components/schemas/WebhookEvent' |
| 150 | + example: |
| 151 | + { |
| 152 | + "events": [ |
| 153 | + { |
| 154 | + "resourceUrl": "https://api.xero.com/api.xro/2.0/Contacts/717f2bfc-c6d4-41fd-b238-3f2f0c0cf777", |
| 155 | + "resourceId": "717f2bfc-c6d4-41fd-b238-3f2f0c0cf777", |
| 156 | + "eventDateUtc": "2024-06-21T01:15:39.902", |
| 157 | + "eventType": "UPDATE", |
| 158 | + "eventCategory": "CONTACT", |
| 159 | + "tenantId": "c2cc9b6e-9458-4c7d-93cc-f02b81b0594f", |
| 160 | + "tenantType": "ORGANISATION" |
| 161 | + } |
| 162 | + ], |
| 163 | + "lastEventSequence": 1, |
| 164 | + "firstEventSequence": 1, |
| 165 | + "entropy": "S0m3r4Nd0mt3xt" |
| 166 | + } |
0 commit comments