Slate API docs
Connect another system to Slate: customers, items, documents, expenses and webhooks.
https://api.slate.co.il/v1
Getting started
The business owner creates a key on the Integrations screen in the app. The key is shown once, and goes in the Authorization header of every request. A key starting slk_test_ works only on the sandbox, and slk_live_ only on live.
curl
curl https://api.slate.co.il/v1/documents \
-H "Authorization: Bearer $SLATE_KEY" \
-H "Idempotency-Key: order-1001" \
-H "Content-Type: application/json" \
-d '{"type":"tax-invoice-receipt","status":"issued","customerId":"cus_123","lineItems":[{"productName":"Consulting","quantity":1,"price":1000}],"receipts":[{"receiptType":"transfer","amount":1170}]}'Node
const res = await fetch('https://api.slate.co.il/v1/documents', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SLATE_KEY}`,
'Idempotency-Key': 'order-1001',
'Content-Type': 'application/json',
},
body: JSON.stringify({"type":"tax-invoice-receipt","status":"issued","customerId":"cus_123","lineItems":[{"productName":"Consulting","quantity":1,"price":1000}],"receipts":[{"receiptType":"transfer","amount":1170}]}),
});
const doc = await res.json();Python
import os, requests
res = requests.post(
"https://api.slate.co.il/v1/documents",
headers={"Authorization": f"Bearer {os.environ['SLATE_KEY']}", "Idempotency-Key": "order-1001"},
json={"type":"tax-invoice-receipt","status":"issued","customerId":"cus_123","lineItems":[{"productName":"Consulting","quantity":1,"price":1000}],"receipts":[{"receiptType":"transfer","amount":1170}]},
)
doc = res.json()PHP
$ch = curl_init('https://api.slate.co.il/v1/documents');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SLATE_KEY'),
'Idempotency-Key: order-1001',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => '{"type":"tax-invoice-receipt","status":"issued","customerId":"cus_123","lineItems":[{"productName":"Consulting","quantity":1,"price":1000}],"receipts":[{"receiptType":"transfer","amount":1170}]}',
]);
$doc = json_decode(curl_exec($ch), true);Verify webhook (Node)
import crypto from 'node:crypto';
function verify(header, rawBody, secret) {
const { t, v1 } = Object.fromEntries(header.split(',').map((p) => p.split('=')));
const expected = crypto.createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex');
const fresh = Math.abs(Date.now() / 1000 - Number(t)) < 300;
return fresh && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(v1));
}Issuing a document
A document is created as a draft (status: "draft") or issued at once (status: "issued"). One of the two is required. An issued document is a permanent record: it cannot be edited or deleted, and a correction is a credit invoice. Issuing needs a key with the issue permission and an Idempotency-Key header, so a request sent twice issues one document.
Opening a business from your app
An app that signs users up can open a Slate business for each of them, with no visit to our site. This takes a partner key (slk_partner_live_), issued by Slate. POST /v1/partner/businesses with the business details and the owner email address opens the business and returns its API key, shown once. Everything on that business is done with that key. The owner gets an email that the account exists, can sign in with a code sent to that address, and can revoke your access. An email or tax ID already registered with Slate is refused.
Errors
Every error has the same shape, with a fixed code your code can check and a request id for support.
{
"error": {
"type": "invalid_request",
"code": "status_required",
"message": "status is required: \"draft\" or \"issued\".",
"param": "status",
"requestId": "req_8f2c..."
}
}Pagination
Lists return up to 50 rows (limit up to 100). For the next page send startingAfter with the last id. modifiedSince returns only what changed since, for syncing.
Webhooks
Every delivery is signed in the Slate-Signature header. Compute HMAC-SHA256 of "t.body" with the secret you got when registering, and compare it to v1. A delivery not answered with a 2xx is retried after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, then once a day. After several days of failures the endpoint is disabled and the business owner gets an email.
Rate limits
Going over a limit returns 429 with a Retry-After header.
All endpoints
GET | /v1/business | The business the key belongs to | business |
GET | /v1/customers | List customers | customers |
POST | /v1/customers | Create a customer | customers |
GET | /v1/customers/{id} | Get a customer | customers |
PATCH | /v1/customers/{id} | Update a customer | customers |
DELETE | /v1/customers/{id} | Delete a customer with no documents | customers |
GET | /v1/products | List items | products |
POST | /v1/products | Create an item | products |
GET | /v1/products/{id} | Get an item | products |
PATCH | /v1/products/{id} | Update an item | products |
DELETE | /v1/products/{id} | Delete an item | products |
GET | /v1/documents | List documents | documents |
POST | /v1/documents | Create a draft, or issue a document | documents |
GET | /v1/documents/{id} | Get a document | documents |
PATCH | /v1/documents/{id} | Update a draft | documents |
DELETE | /v1/documents/{id} | Delete a draft | documents |
POST | /v1/documents/{id}/issue | Issue a draft | documents |
GET | /v1/documents/{id}/pdf | Download the PDF of an issued document | documents |
POST | /v1/documents/{id}/send | Email the customer a link to an issued document | documents |
POST | /v1/documents/{id}/allocation/retry | Ask the Tax Authority again for an allocation number | documents |
POST | /v1/documents/{id}/public-url/rotate | Replace the public download link | documents |
GET | /v1/document-numbering | Numbering per document type | documents |
PUT | /v1/document-numbering/{type} | Confirm the starting number for a document type | documents |
GET | /v1/expenses | List expenses | expenses |
POST | /v1/expenses | Record an expense | expenses |
GET | /v1/expenses/{id} | Get an expense | expenses |
GET | /v1/expenses/{id}/receipt | Download the receipt file | expenses |
GET | /v1/reports/vat | VAT report for a period | reports |
GET | /v1/webhook-endpoints | List webhook endpoints | webhooks |
POST | /v1/webhook-endpoints | Register a webhook endpoint | webhooks |
DELETE | /v1/webhook-endpoints/{id} | Remove a webhook endpoint | webhooks |
GET | /v1/events | Events from the last 30 days | webhooks |
GET | /v1/partner/businesses | Businesses you opened | partner |
POST | /v1/partner/businesses | Open a business for one of your users | partner |
GET | /v1/partner/businesses/{id} | One business you opened | partner |
GET | /v1/partner/businesses/{id}/keys | Keys you created for the business | partner |
POST | /v1/partner/businesses/{id}/keys | Create another key for the business | partner |
DELETE | /v1/partner/businesses/{id}/keys/{keyId} | Revoke a key you created | partner |