# SignTurn API Machine-to-machine interface for `https://signturn.com`. Written for software driving it on someone's behalf — issuing a notice, asking a counterparty for a completed form, sending an agreement for signature. Everything below was exercised against the live API, not read off the source. --- ## Quickstart Create a key on the dashboard (**API keys → + New key**), then: ```bash export SIGNTURN_KEY=dsp_your_key_here # 1. Does the key work, and whose is it? curl -H "X-API-Key: $SIGNTURN_KEY" https://signturn.com/api/v1/auth/me # 2. Upload something to sign. curl -H "X-API-Key: $SIGNTURN_KEY" \ -F "pdf=@agreement.pdf" \ https://signturn.com/api/v1/documents/upload # → { "document": { "id": 42, "status": "pending", ... } } # 3. Who else is on it. curl -H "X-API-Key: $SIGNTURN_KEY" -H "Content-Type: application/json" \ -d '{"name":"Dana Okafor","email":"dana@example.com","routingOrder":2}' \ https://signturn.com/api/v1/documents/42/recipients # → { "recipient": { "id": 77, ... } } # 4. Where they sign. Coordinates are fractions of the page, 0 to 1. curl -H "X-API-Key: $SIGNTURN_KEY" -H "Content-Type: application/json" \ -d '{"field_type":"signature","recipient_id":77,"page_number":1, "position_x":0.1,"position_y":0.6}' \ https://signturn.com/api/v1/fields/documents/42/fields # 5. Send it. curl -H "X-API-Key: $SIGNTURN_KEY" -H "Content-Type: application/json" \ -d '{"recipients":[{"email":"dana@example.com","routingOrder":2}]}' \ https://signturn.com/api/v1/documents/42/send # → { "status": "pending", "recipients": [ { "signingLink": "https://..." } ] } # 6. Later: has it been signed? curl -H "X-API-Key: $SIGNTURN_KEY" https://signturn.com/api/v1/documents/42 ``` Step 3 adds a second person because **uploading already added you** as a signer at routing order 1 — see the rule below. --- ## Authentication One header on every request: ``` X-API-Key: dsp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` ### Getting one Sign in, and on the dashboard find **API keys → + New key**. Name it after whatever will use it, so you know which one to revoke later. **The key is shown once.** Only its SHA-256 is stored, so it cannot be looked up again — if it is lost, revoke it and make another. Store it where you keep passwords, not in a repository. ### What it can do **A key is the account holder.** It can upload, place fields, add recipients, **sign on their behalf**, send, and delete. It is not read-only. It is scoped to that one account and sees nothing belonging to anyone else. ### Revoking Same card, **Revoke**. It stops working immediately; documents already signed with it are unaffected, and the key's record is kept because it is what explains a signature made with it. ### Rotating one There is no "regenerate" that keeps the same key alive — that would mean two valid keys with one name, and no way to tell which one leaked. Rotate in this order so nothing is down in between: 1. **Create** the new key. Name it so you can tell them apart (`Scheduling system (2026-10)`). 2. **Deploy** it to whatever uses it. 3. **Check** the old key's *Last used* on the dashboard. Once it stops moving, nothing is still on it. 4. **Revoke** the old one. Do it on a schedule, and immediately if a key has been pasted anywhere it should not have been — a chat, a ticket, a screenshot, a repository. ### Key management is not in this API Creating and revoking keys require a signed-in session, not a key. A key cannot mint another key — otherwise one leak is permanent: whoever holds it issues a replacement before you revoke the first, and revoking never catches up. `POST /keys` with `X-API-Key` is `403`, deliberately. An operator with shell access can also mint one directly, which is how the first key on a fresh install is made: ```bash node bin/create-api-key.js "