TooliSign in

API quickstart: your first calls

Make a key

An owner or an admin opens Organisation → API and MCP in Tooli and chooses Make a key.

  1. Name it after what will use it ("Reporting", "Website form").
  2. Choose what it may do, area by area: Read, or Read and Change. Give it no more than it needs: a report only reads.
  3. Choose when it ends, or never.
  4. Copy the key. It is shown once.

Keep it out of code and out of the browser: put it in your program's secrets. Below it is $TOOLI_API_KEY.

Read your organisation

curl -H "Authorization: Bearer $TOOLI_API_KEY" https://app.tooli.dev/api/v1/organization

The answer is your organisation's name, its plan and what it has used this month. Every key may read it, whatever its areas.

Read a list, page by page

curl -H "Authorization: Bearer $TOOLI_API_KEY" \
  "https://app.tooli.dev/api/v1/emails?status=viewed&limit=25"

A list answers with rows and next. Pass next back as cursor, with the same filters, for the page after; on the last page next is null. Each list takes the filters its page in the app has: the API reference lists them.

A record is known by what its page's address uses: an email by its id, a link and a document by their code, a website by its key. So the views of one email are:

curl -H "Authorization: Bearer $TOOLI_API_KEY" \
  "https://app.tooli.dev/api/v1/emails/em_…/views"

Make a change, safely

A key that may change links makes one like this:

curl -X POST -H "Authorization: Bearer $TOOLI_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"destination": "https://www.example.com/spring", "slug": "spring-offer"}' \
  https://app.tooli.dev/api/v1/links

Every POST carries an Idempotency-Key, new for each change. If the answer is lost and you send the same request again with the same key, within 24 hours, you get the same answer and nothing is made twice. A link a key makes is named in the app as the key's.

Next