The SIBI public API is a GraphQL API. You can use any GraphQL client to make requests to our API. The examples below use curl & fetch
Endpoint
Our API is available at: https://graphql.sibipro.com
This endpoint also hosts a GraphQL playground where you can explore the API and test your queries.
Authentication
The SIBI public API uses API keys to authenticate requests. You can create an API key in the SIBI developer dashboard. The API expects the key to be included in all requests in the Authorization
header, prefixed by Bearer
.
curl \
--request POST \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{"query": "<YOUR_QUERY>"}' \
https://graphql.sibipro.com
# => {"data": {...}}
const response = await fetch('https://graphql.sibipro.com, {
method: 'POST',
headers: { 'Authorization': `Bearer ${yourApiKey}` },
body: JSON.stringify({ query: '<YOUR_QUERY>'}),
});
const body = await response.json();
const invoices = body.data.invoices.edges;
console.log(JSON.stringify(invoices, null, 2))
# => {"data": {...}}
Querying
All requests are made using the POST
method. The body of the request should be a JSON object with a query
key. The value of the query
key should be a GraphQL query. The following examples show how to ask for just the invoice number of all invoices.
curl \
--request POST \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{"query": "query Invoices() { invoices { edges { invoiceNumber } } }"}' \
https://graphql.sibipro.com
const query = `# graphql
query Invoices() {
invoices {
edges {
invoiceNumber
}
}
}
`;
const response = await fetch('https://graphql.sibipro.com', {
method: 'POST',
headers: { 'Authorization': `Bearer ${yourApiKey}` },
body: JSON.stringify({ query }),
});
const body = await response.json();
const invoices = body.data.invoices.edges;
console.log(JSON.stringify(invoices, null, 2))
The API will return a JSON response:
{
"data": {
"invoices": {
"edges": [
{ "invoiceNumber": "INV-0001" },
{ "invoiceNumber": "INV-0002" }
]
}
}
}
Projections
The GraphQL API will only return the specific fields requested in the query. This is called a projection. The following example query shows how to ask for the invoice date and total of all invoices.
query Invoices() {
invoices {
edges {
invoiceDate
total
}
}
}
To request every property available, you can use this query:
query Invoices() {
invoices {
page
hasNextPage
hasPreviousPage
totalHits
totalPageCount
edges {
accountNumber
invoiceNumber
invoiceDate
orderIdentifier
total
tax
partner
partnerName
partnerIconImageUrl
poNumber
propertyAddress {
line1
line2
city
stateOrProvince
postalCode
}
lineItems {
description
quantity
unitPriceAmount
sku
serialNumber
}
}
}
}
For a description list of each of the fields, see the Invoice Schema.
The SIBI public API uses page-based pagination (as opposed to cursor-based). By default, the API returns the first page of results. If included in the query projection, the reponse will include pagination information including the current page and whether or not there is a next page:
query InvoicesPage {
invoices(page: 0) {
currentPage
hasNextPage
}
}
Will return:
{
"data": {
"invoices": {
"currentPage": 1,
"hasNextPage": true
}
}
}