API quickstart

Make your first API call in five minutes, from a new key to the rows of a register.

Guide
About 5 minutes

What you'll do

Create a key that can read registers, list what it may call, and read the first rows of a register.

Before you start

  • You are a workspace Owner or Admin on the Pro or Enterprise plan.
  • The workspace has at least one list register with a few rows.
  • You can run curl in a terminal.

Steps

  1. Select your name at the bottom of the sidebar, then Settings, then API keys.
  2. Select Create API key.
  3. Type Quickstart as the Name, tick the registers:rows:read permission, and select Create API key.
  4. Select Copy and close, and keep the key somewhere safe.
  5. In a terminal, list the actions the key may call.
bash
curl https://app.alchex.com/api/v1/tools \  -H "Authorization: Bearer EXAMPLE_API_KEY"
  1. List your registers.
bash
curl -X POST https://app.alchex.com/api/v1/tools/read_document/list_registers \  -H "Authorization: Bearer EXAMPLE_API_KEY"
  1. Read the first five rows of one register, using its name from the last answer.
bash
curl -X POST https://app.alchex.com/api/v1/tools/read_document/rows \  -H "Authorization: Bearer EXAMPLE_API_KEY" \  -H "Content-Type: application/json" \  -d '{ "register": "Suppliers", "limit": 5 }'

What happens next

The last answer holds the register's columns, its total row count and its rows, each with an id and its cells:

json
{  "register": { "id": "…", "name": "Suppliers", "kind": "sheet", "code": "LST-OPS-001" },  "columns": [ { "name": "Name", "type": "text" }, { "name": "Risk", "type": "choice", "choices": ["Low", "Medium", "High"] } ],  "total": 12,  "rows": [ { "id": "…", "cells": { "Name": "Acme", "Risk": "High" } } ]}

The answer is shortened here. Use the row ids to change rows, as Rows shows.

If something goes wrong

401 missing_key or 401 invalid_key. Check the header reads Authorization: Bearer followed by the whole key.

403 missing_permission. The key lacks the permission the message names. Create a new key with it.

402 AI_ALLOWANCE_EXCEEDED. The workspace has no AI credit left. See Add AI credit.

404 not_found. No register has that name. Copy the name or code from the list.