עברית

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/businessThe business the key belongs tobusiness
GET/v1/customersList customerscustomers
POST/v1/customersCreate a customercustomers
GET/v1/customers/{id}Get a customercustomers
PATCH/v1/customers/{id}Update a customercustomers
DELETE/v1/customers/{id}Delete a customer with no documentscustomers
GET/v1/productsList itemsproducts
POST/v1/productsCreate an itemproducts
GET/v1/products/{id}Get an itemproducts
PATCH/v1/products/{id}Update an itemproducts
DELETE/v1/products/{id}Delete an itemproducts
GET/v1/documentsList documentsdocuments
POST/v1/documentsCreate a draft, or issue a documentdocuments
GET/v1/documents/{id}Get a documentdocuments
PATCH/v1/documents/{id}Update a draftdocuments
DELETE/v1/documents/{id}Delete a draftdocuments
POST/v1/documents/{id}/issueIssue a draftdocuments
GET/v1/documents/{id}/pdfDownload the PDF of an issued documentdocuments
POST/v1/documents/{id}/sendEmail the customer a link to an issued documentdocuments
POST/v1/documents/{id}/allocation/retryAsk the Tax Authority again for an allocation numberdocuments
POST/v1/documents/{id}/public-url/rotateReplace the public download linkdocuments
GET/v1/document-numberingNumbering per document typedocuments
PUT/v1/document-numbering/{type}Confirm the starting number for a document typedocuments
GET/v1/expensesList expensesexpenses
POST/v1/expensesRecord an expenseexpenses
GET/v1/expenses/{id}Get an expenseexpenses
GET/v1/expenses/{id}/receiptDownload the receipt fileexpenses
GET/v1/reports/vatVAT report for a periodreports
GET/v1/webhook-endpointsList webhook endpointswebhooks
POST/v1/webhook-endpointsRegister a webhook endpointwebhooks
DELETE/v1/webhook-endpoints/{id}Remove a webhook endpointwebhooks
GET/v1/eventsEvents from the last 30 dayswebhooks
GET/v1/partner/businessesBusinesses you openedpartner
POST/v1/partner/businessesOpen a business for one of your userspartner
GET/v1/partner/businesses/{id}One business you openedpartner
GET/v1/partner/businesses/{id}/keysKeys you created for the businesspartner
POST/v1/partner/businesses/{id}/keysCreate another key for the businesspartner
DELETE/v1/partner/businesses/{id}/keys/{keyId}Revoke a key you createdpartner

Files

OpenAPI · Postman