Webhooks in Space Invoices enable you to subscribe to changes on most data models within the platform. When an event associated with a webhook subscription is triggered, a POST request is sent to the registered URL.
If the request receives a 2** status code, the process is considered complete.
However, if a non 2** status code is returned, the system will make three additional attempts to resend the request. These retries will be made after 2 minutes, 4 minutes, and finally, 8 minutes from the time of the initial request. This ensures that your application has multiple opportunities to receive and process the webhook events.
Endpoints:
- GET /v1/Webhooks/:id
- POST /v1/Organizations/:id/webhooks
- GET /v1/Organizations/:id/webhooks
- GET /v1/Organizations/:id/webhooks/count
- PUT /v1/Webhooks/:id
- PATCH /v1/Webhooks/:id
- DELETE /v1/Webhooks/:id
The Webhook object
Parameters
-
id string readonly
-
events array[object]
-
url string
-
enabled boolean
-
organizationId string
-
deletedAt date readonly
-
_isDeleted boolean readonly
-
deletedId string readonly
-
createdAt date readonly
-
updatedAt date readonly
Additional propertiesExpand all
{
"events": [{}],
"url": "string",
"enabled": true,
"id": "string",
"organizationId": "string",
"deletedAt": "2022-04-20T10:10:30+00:00Z",
"_isDeleted": false,
"deletedId": "string",
"createdAt": "2022-04-20T10:10:30+00:00Z",
"updatedAt": "2022-04-20T10:10:30+00:00Z"
}
Get Webhook
GET /v1/Webhooks/:id
Parameters
Path
-
id string required
Model id
Query
-
filter string optional
Filter defining fields and include - must be a JSON-encoded string ({"something":"value"})
const response = await fetch('https://api.spaceinvoices.com/v1/Webhooks/{id}', {
method: 'GET',
headers: {
'Authorization': 'ACCESS_TOKEN',
'content-type': 'application/json'
}
});
Login to auto-populate your access token.
Your access token is displayed in examples.
Prerequisite: npm install node-fetch
curl -X GET https://api.spaceinvoices.com/v1/Webhooks/{id} \
-H 'Authorization: ACCESS_TOKEN' \
-H 'Content-Type: application/json'
Login to auto-insert your own access token.
Your access token displayed in examples.
import requests
url = 'https://api.spaceinvoices.com/v1/Webhooks/{id}'
headers = {
'Authorization': 'ACCESS_TOKEN',
'content-type': 'application/json',
}
response = requests.get(url, params={}, headers=headers)
Login to auto-insert your own access token.
Your access token displayed in examples.
Response:
{
"events": [{}],
"url": "string",
"enabled": true,
"id": "string",
"organizationId": "string",
"deletedAt": "2022-04-20T10:10:30+00:00Z",
"_isDeleted": false,
"deletedId": "string",
"createdAt": "2022-04-20T10:10:30+00:00Z",
"updatedAt": "2022-04-20T10:10:30+00:00Z"
}
Create Webhook
POST /v1/Organizations/:id/webhooks
Parameters
Path
-
id string required
Organization id
Properties
-
url string required
-
events array[object] optional
-
enabled boolean optional
Default is: true
-
organizationId string optional
const response = await fetch('https://api.spaceinvoices.com/v1/Organizations/{id}/webhooks', {
method: 'POST',
headers: {
'Authorization': 'ACCESS_TOKEN',
'content-type': 'application/json'
},
body: JSON.stringify({
events: [{}],
url: 'string',
enabled: true,
organizationId: 'string'
})
});
Login to auto-populate your access token.
Your access token is displayed in examples.
Prerequisite: npm install node-fetch
curl -X POST https://api.spaceinvoices.com/v1/Organizations/{id}/webhooks \
-H 'Authorization: ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"events": [{}], \
"url": "string", \
"enabled": true, \
"organizationId": "string"
}'
Login to auto-insert your own access token.
Your access token displayed in examples.
import requests
url = 'https://api.spaceinvoices.com/v1/Organizations/{id}/webhooks'
headers = {
'Authorization': 'ACCESS_TOKEN',
'content-type': 'application/json',
}
params = {
'events': [{}],
'url': 'string',
'enabled': True,
'organizationId': 'string'
}
response = requests.post(url, json=params, headers=headers)
Login to auto-insert your own access token.
Your access token displayed in examples.
Response:
{
"events": [{}],
"url": "string",
"enabled": true,
"id": "string",
"organizationId": "string",
"deletedAt": "2022-04-20T10:10:30+00:00Z",
"_isDeleted": false,
"deletedId": "string",
"createdAt": "2022-04-20T10:10:30+00:00Z",
"updatedAt": "2022-04-20T10:10:30+00:00Z"
}
Find Webhooks
GET /v1/Organizations/:id/webhooks
Parameters
Path
-
id string required
Organization id
Query
-
filter string optional
const response = await fetch('https://api.spaceinvoices.com/v1/Organizations/{id}/webhooks', {
method: 'GET',
headers: {
'Authorization': 'ACCESS_TOKEN',
'content-type': 'application/json'
}
});
Login to auto-populate your access token.
Your access token is displayed in examples.
Prerequisite: npm install node-fetch
curl -X GET https://api.spaceinvoices.com/v1/Organizations/{id}/webhooks \
-H 'Authorization: ACCESS_TOKEN' \
-H 'Content-Type: application/json'
Login to auto-insert your own access token.
Your access token displayed in examples.
import requests
url = 'https://api.spaceinvoices.com/v1/Organizations/{id}/webhooks'
headers = {
'Authorization': 'ACCESS_TOKEN',
'content-type': 'application/json',
}
response = requests.get(url, params={}, headers=headers)
Login to auto-insert your own access token.
Your access token displayed in examples.
Response:
[
{
"events": [{}],
"url": "string",
"enabled": true,
"id": "string",
"organizationId": "string",
"deletedAt": "2022-04-20T10:10:30+00:00Z",
"_isDeleted": false,
"deletedId": "string",
"createdAt": "2022-04-20T10:10:30+00:00Z",
"updatedAt": "2022-04-20T10:10:30+00:00Z"
}
]
Count Webhooks
GET /v1/Organizations/:id/webhooks/count
Parameters
Path
-
id string required
Organization id
Query
-
where string optional
Criteria to match model instances
const response = await fetch('https://api.spaceinvoices.com/v1/Organizations/{id}/webhooks/count', {
method: 'GET',
headers: {
'Authorization': 'ACCESS_TOKEN',
'content-type': 'application/json'
}
});
Login to auto-populate your access token.
Your access token is displayed in examples.
Prerequisite: npm install node-fetch
curl -X GET https://api.spaceinvoices.com/v1/Organizations/{id}/webhooks/count \
-H 'Authorization: ACCESS_TOKEN' \
-H 'Content-Type: application/json'
Login to auto-insert your own access token.
Your access token displayed in examples.
import requests
url = 'https://api.spaceinvoices.com/v1/Organizations/{id}/webhooks/count'
headers = {
'Authorization': 'ACCESS_TOKEN',
'content-type': 'application/json',
}
response = requests.get(url, params={}, headers=headers)
Login to auto-insert your own access token.
Your access token displayed in examples.
Response:
{
"count": 42
}
Replace Webhook
PUT /v1/Webhooks/:id
Parameters
Path
-
id string required
Model id
Properties
-
url string required
-
events array[object] optional
-
enabled boolean optional
Default is: true
-
organizationId string optional
const response = await fetch('https://api.spaceinvoices.com/v1/Webhooks/{id}', {
method: 'PUT',
headers: {
'Authorization': 'ACCESS_TOKEN',
'content-type': 'application/json'
},
body: JSON.stringify({
events: [{}],
url: 'string',
enabled: true,
organizationId: 'string'
})
});
Login to auto-populate your access token.
Your access token is displayed in examples.
Prerequisite: npm install node-fetch
curl -X PUT https://api.spaceinvoices.com/v1/Webhooks/{id} \
-H 'Authorization: ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"events": [{}], \
"url": "string", \
"enabled": true, \
"organizationId": "string"
}'
Login to auto-insert your own access token.
Your access token displayed in examples.
import requests
url = 'https://api.spaceinvoices.com/v1/Webhooks/{id}'
headers = {
'Authorization': 'ACCESS_TOKEN',
'content-type': 'application/json',
}
params = {
'events': [{}],
'url': 'string',
'enabled': True,
'organizationId': 'string'
}
response = requests.put(url, json=params, headers=headers)
Login to auto-insert your own access token.
Your access token displayed in examples.
Response:
{
"events": [{}],
"url": "string",
"enabled": true,
"id": "string",
"organizationId": "string",
"deletedAt": "2022-04-20T10:10:30+00:00Z",
"_isDeleted": false,
"deletedId": "string",
"createdAt": "2022-04-20T10:10:30+00:00Z",
"updatedAt": "2022-04-20T10:10:30+00:00Z"
}
Patch Webhook
PATCH /v1/Webhooks/:id
Parameters
Path
-
id string required
Webhook id
Properties
-
url string required
-
events array[object] optional
-
enabled boolean optional
Default is: true
-
organizationId string optional
const response = await fetch('https://api.spaceinvoices.com/v1/Webhooks/{id}', {
method: 'PATCH',
headers: {
'Authorization': 'ACCESS_TOKEN',
'content-type': 'application/json'
},
body: JSON.stringify({
events: [{}],
url: 'string',
enabled: true,
organizationId: 'string'
})
});
Login to auto-populate your access token.
Your access token is displayed in examples.
Prerequisite: npm install node-fetch
curl -X PATCH https://api.spaceinvoices.com/v1/Webhooks/{id} \
-H 'Authorization: ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"events": [{}], \
"url": "string", \
"enabled": true, \
"organizationId": "string"
}'
Login to auto-insert your own access token.
Your access token displayed in examples.
import requests
url = 'https://api.spaceinvoices.com/v1/Webhooks/{id}'
headers = {
'Authorization': 'ACCESS_TOKEN',
'content-type': 'application/json',
}
params = {
'events': [{}],
'url': 'string',
'enabled': True,
'organizationId': 'string'
}
response = requests.patch(url, json=params, headers=headers)
Login to auto-insert your own access token.
Your access token displayed in examples.
Response:
{
"events": [{}],
"url": "string",
"enabled": true,
"id": "string",
"organizationId": "string",
"deletedAt": "2022-04-20T10:10:30+00:00Z",
"_isDeleted": false,
"deletedId": "string",
"createdAt": "2022-04-20T10:10:30+00:00Z",
"updatedAt": "2022-04-20T10:10:30+00:00Z"
}
const response = await fetch('https://api.spaceinvoices.com/v1/Webhooks/{id}', {
method: 'DELETE',
headers: {
'Authorization': 'ACCESS_TOKEN',
'content-type': 'application/json'
}
});
Login to auto-populate your access token.
Your access token is displayed in examples.
Prerequisite: npm install node-fetch
curl -X DELETE https://api.spaceinvoices.com/v1/Webhooks/{id} \
-H 'Authorization: ACCESS_TOKEN' \
-H 'Content-Type: application/json'
Login to auto-insert your own access token.
Your access token displayed in examples.
import requests
url = 'https://api.spaceinvoices.com/v1/Webhooks/{id}'
headers = {
'Authorization': 'ACCESS_TOKEN',
'content-type': 'application/json',
}
response = requests.delete(url, params={}, headers=headers)
Login to auto-insert your own access token.
Your access token displayed in examples.
Response:
{
"count": 1
}