blue·auth
Signature API

API documentation

Send documents for signature, sign your own documents without email, and receive every step in real time via webhook. Ready to automate in N8N.

Get started

The API is REST over HTTPS, with JSON. The base URL is:

https://blueauth.co/api/v1

You need an API key. Create one at Conta · Developer · API Keys. Use a ba_test_… key for tests (sandbox, no cost, no legal effect) or ba_live_… in production. You can try everything in the Playground.

Choose the flow before coding

I already have a PDF

POST /signature-requests

Send pdfBase64 or storagePath, signers and zones.

I have data and a model

POST /template-runs

Choose a template and send values and participants. BlueAuth generates and locks the document.

I want a visual test

Playground

Fill the same API fields, inspect the payload and copy cURL/N8N.

Free local tools and the API

Anonymization and PDF Tools are public browser-based utilities. They require no API key, card, or plan documents, and files are not sent to the blue·auth API.

Local · no endpoint

PDF anonymization

Mark and remove sensitive information directly on the device. Use the tool for private manual work.

Open anonymization →
Local · no endpoint

Merge, split, and compress PDFs

Prepare documents in the browser before sending them for signature, templates, or custody.

Open PDF Tools →

Enable test or live API: step by step

1Open API Keys inside the app

Sign in and open Developers → API Keys. Name one specific integration, such as “n8n sandbox” or “Production ERP”.

2Start with ba_test

Keep test mode selected. Enable only the required scopes. For the full template and signature flow: signatures:read, signatures:write, templates:read, templates:write and template-data:read.

3Copy the full key once

The value begins with ba_test_ or ba_live_. The short key ID does not authenticate requests. Store the full value in a secret manager or n8n/Make credentials.

4Validate and promote to live

Run the full flow in test, including webhook and document retrieval. Then create a separate ba_live key, change only the environment variable and execute one controlled real document.

# Nunca coloque a chave diretamente no código
BLUEAUTH_API_KEY=ba_test_...
BLUEAUTH_API_BASE=https://blueauth.co/api/v1

Authentication

Every call authenticates with the Authorization: Bearer header using your API key.

curl https://blueauth.co/api/v1/signature-requests/REQUEST_ID \
  -H "Authorization: Bearer ba_live_xxx"

Webhooks are verified independently via HMAC (see Webhook events).

Sandbox vs Production

Use a test key (ba_test) while integrating and automating — free and with no legal effect. Switch to production (ba_live) only for real signatures. Just swap the key in the Authorization header; the rest of the flow is the same.

Sandbox · ba_testProduction · ba_live
CostFree (uses no documents)1 document per request (current plans, trial and free plan)
Legal validityNone (demo)Yes (eIDAS, ICP-Brasil, …)
PDF"SANDBOX · not legally binding" bannerClean, no banner
BlockchainNot anchoredAnchored
When to useIntegrate, test, demos, QAReal documents with clients

How per-document usage is calculated

In sandbox (ba_test), validate the whole flow with no usage and no legal effect. In production (ba_live), the server applies the rule of the paying account’s plan:

# Current plans (Start, Pro, Scale), 30-day trial (up to 20 docs) and free plan (3 docs/month)
usage = 1 document per request (regardless of PDF size, signer count, or WhatsApp delivery)

# Legacy paid plans from before November 2026 (Starter, Professional, Business), while active (REST/MCP API)
legacyCost = 1 + (whatsappEnabled ? 1 : 0)

PDF 4 MB · email

Current plans, trial or free = 1 document

Legacy (API/MCP) = 1 token

PDF 4 MB · WhatsApp

Current plans, trial or free = 1 document

Legacy (API/MCP) = 2 tokens

Multiple signers · email

Current plans, trial or free = 1 document

Legacy (API/MCP) = 1 token

Emails, automatic reminders, and multiple signers do not multiply usage. On legacy plans from before November 2026, the REST/MCP API charges 1 token per request plus +1 token when WhatsApp delivery is enabled, with no PDF size tiers. Qualified signing with Chave Móvel Digital (CMD) requires an active paid plan: it counts as 1 document on current plans (Start, Pro, Scale) and follows the plan’s legacy cost on legacy plans, with no extra multiplier. Always confirm the estimate in the Playground or the operation response.

Use the Playground without knowing the API

The Playground is a visual builder for the same HTTP request. It is not a separate API: every field becomes JSON, cURL and n8n configuration you can move into your system.

1Paste a ba_test key

The progress bar confirms the environment and keeps the key only in page memory.

2Choose Free PDF or Template + data

Free PDF is for completed files. Template creates fields from the schema and supports validation without sending.

3Enter participants and placement

Each participant needs an email. For PDFs, click or drag zones on the page. For templates, participant roles are predefined.

4Execute, inspect and copy

Start with Validate without sending when available. After creation, store requestId or runId: they identify the operation throughout its lifecycle.

Send for signature

POST /signature-requests. Send the PDF (as pdfBase64 or a storagePath uploaded earlier), the name and the list of signers. Each signer can carry its zones. Zones use PDF points (top-left origin), page starts at 1. Optionally pass idNumber (e.g. tax ID) per signer — it shows on the stamp as "Signed by · ID · Date".

curl -X POST https://blueauth.co/api/v1/signature-requests \
  -H "Authorization: Bearer ba_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "documentName": "Contract.pdf",
    "pdfBase64": "data:application/pdf;base64,JVBERi0xLj...",
    "webhookUrl": "https://your-system.com/webhooks/blueauth",
    "signers": [
      {
        "email": "me@company.com",
        "fullName": "My Company, Ltd.",
        "idNumber": "517610833",
        "selfSign": true,
        "signatureMethod": "traditional",
        "zones": [{ "page": 1, "x": 60, "y": 700, "width": 180, "height": 60, "type": "signature" }]
      },
      {
        "email": "client@example.com",
        "fullName": "Final Client",
        "phone": "+351912345678",
        "useWhatsapp": true,
        "signatureMethod": "traditional",
        "zones": [{ "page": 1, "x": 330, "y": 700, "width": 180, "height": 60, "type": "signature" }]
      }
    ]
  }'

Response (201):

{
  "requestId": "AXrTcjz...",
  "status": "pending",
  "webhookSecret": "whsig_...",
  "signers": [ { "email": "...", "status": "pending", "signingUrl": "https://blueauth.co/sign/..." } ]
}

Save webhookSecret: it only appears now and is used to verify webhooks. Signers without selfSign receive email; phone + useWhatsapp also delivers the Meta sing_document_v1 invitation. With selfSign: true they receive no invitation (they sign via API, see below).

You can include a verification QR in the signed PDF. Choose the corner and pages:

"qr": {
  "enabled": true,
  "placement": "bottom-right",
  "pages": "first"
}

Validity and reminders can be set per request:

"validityDays": 7,
"notificationPolicy": {
  "automaticReminderCount": 2
}

If automaticReminderCount is omitted, BlueAuth automatically schedules up to 5 reminders, never more than one per day: 3 days creates 2 reminders; 7 days creates 5. Send 0 to disable or a lower number to reduce them.

Templates, variables and pre/post-signature data

Templates are DOCX files configured inside BlueAuth. The API does not need to know the layout: it reads the schema first and then sends values using the keys defined by the template.

1List and select a template

curl "https://blueauth.co/api/v1/templates?useTarget=signature" \
  -H "Authorization: Bearer ba_test_xxx"

The response includes templateId, version, signerRoles and fields[]. Each field describes key, label, type, required and signerRole.

2Validate without creating or sending email

curl -X POST https://blueauth.co/api/v1/templates/TEMPLATE_ID/validate \
  -H "Authorization: Bearer ba_test_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "values": { "valor": "1250,00" },
    "participants": [
      {
        "role": "Cliente",
        "name": "Ana Silva",
        "email": "ana@example.com",
        "collectData": false,
        "values": { "cliente_nome": "Ana Silva", "cliente_nif": "245716890" }
      }
    ],
    "completionMode": "fill_and_sign"
  }'

If valid=false, fix errors[].path before continuing. Validation sends no invitation and starts no workflow.

3Create the template run

curl -X POST https://blueauth.co/api/v1/template-runs \
  -H "Authorization: Bearer ba_test_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "templateId": "TEMPLATE_ID",
    "values": { "valor": "1250,00" },
    "participants": [
      {
        "role": "Cliente",
        "name": "Ana Silva",
        "email": "ana@example.com",
        "collectData": false,
        "values": { "cliente_nome": "Ana Silva", "cliente_nif": "245716890" }
      }
    ],
    "completionMode": "fill_and_sign",
    "validityDays": 7,
    "notificationPolicy": { "automaticReminderCount": 2 },
    "lang": "pt"
  }'

Store runId. Use collectData=true to send a fill link (values become editable initial values). Use collectData=false with every required value for an existing customer: BlueAuth skips data collection and sends only the signature.

4Read data by stage

GET /api/v1/template-runs/RUN_ID/data?stage=current
GET /api/v1/template-runs/RUN_ID/data?stage=pre_signature
GET /api/v1/template-runs/RUN_ID/data?stage=signed
  • current — current values while input is still in progress.
  • pre_signature — immutable snapshot used to generate the pre-signature PDF; includes snapshotHash.
  • signed — the same locked data, now associated with the completed signature and signedAt.

Self-sign (no email)

Flag the signer with selfSign: true on create, then call:

curl -X POST https://blueauth.co/api/v1/signature-requests/REQUEST_ID/self-sign \
  -H "Authorization: Bearer ba_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{ "signerEmail": "me@company.com", "idNumber": "517610833" }'

Signs with an electronic signature (b· stamp with hash, timestamp and blockchain record). No OTP, fully automatable.

When this is the last signer, the response includes status=completed, isFinalSigner=true and completedDocumentUrl to open the completed document page.

The qualified CMD signature requires PIN and SMS code, so it is not automatable via this endpoint.

CMD batch (2–100 documents)

In the simplified flow, send temporary HTTPS URLs for the PDFs. BlueAuth validates each file, calculates SHA-256, creates the auditable units without separate invitations, and returns one link. If you already calculate the hash at source, send documentHash for an additional integrity check:

curl -X POST https://blueauth.co/api/v1/cmd-batches   -H "Authorization: Bearer ba_live_xxx"   -H "Content-Type: application/json"   -d '{
    "documents": [
      { "pdfName": "contrato-1.pdf", "pdfUrl": "https://storage.example/contrato-1.pdf" },
      { "pdfName": "contrato-2.pdf", "pdfUrl": "https://storage.example/contrato-2.pdf" }
    ],
    "signerEmail": "titular@example.pt",
    "signerName": "Ana Silva",
    "idempotencyKey": "erp-lote-2026-07-31-001",
    "webhookUrl": "https://n8n.example.pt/webhook/cmd-events",
    "webhookSecret": "whsig_..."
  }'

The response returns batchId and signingUrl. Give the link to the citizen: they review the PDFs and enter phone, PIN and OTP directly in BlueAuth. Those values never pass through the API or n8n.

  • GET /cmd-batches/{id} — per-document status and result.
  • POST /cmd-batches/{id}/retry — resumes pending processing only, without a new already-consumed OTP.
  • POST /cmd-batches/{id}/rotate-link — invalidates the previous link and creates another one.

The documentation and workflow are public. Standard and batch CMD are available to authenticated accounts; only SCAP operations require additional authorization.

Resend

POST /signature-requests/:id/resend. Renews the deadline and resends the invite to a pending signer.

curl -X POST https://blueauth.co/api/v1/signature-requests/REQUEST_ID/resend \
  -H "Authorization: Bearer ba_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{ "email": "client@example.com" }'

Get status

GET /signature-requests/:id. Returns the request and per-signer status. For the signed document: GET /signature-requests/:id/document (returns signedPdfUrl).

curl https://blueauth.co/api/v1/signature-requests/REQUEST_ID \
  -H "Authorization: Bearer ba_live_xxx"

To list/search: GET /signature-requests?status=pending or ?status=completed&q=Contract.

Webhook events

Provide a webhookUrl on create (or set up company webhooks) and receive a POST at every step:

  • signature.sent · the request was created
  • signature.signed · a signer signed
  • signature.declined · a signer declined
  • signature.cancelled · the request was cancelled
  • signature.expired · the request expired
  • signature.completed · all signed and the document was sealed

Each delivery carries headers and a JSON body:

X-BlueAuth-Event: signature.completed
X-BlueAuth-Signature: hex(HMAC-SHA256(webhookSecret, body))
X-BlueAuth-Delivery: <uuid>

{
  "event": "signature.completed",
  "requestId": "AXrTcjz...",
  "status": "completed",
  "completedDocumentUrl": "https://blueauth.co/baSing/<hash>",
  "signedPdfUrl": "https://.../signed.pdf",
  "timestamp": 1780336200000
}

Verify the HMAC signature before trusting the event:

import crypto from 'crypto';
function verify(rawBody, signatureHeader, webhookSecret) {
  const expected = crypto.createHmac('sha256', webhookSecret).update(rawBody, 'utf8').digest('hex');
  return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signatureHeader));
}

Connect ChatGPT, Claude, Gemini, n8n or your own app

The Connected Apps screen brings together two integration types. Do not mix their credentials:

OAuth / MCP

The user authorizes the app without copying an API key. Access appears under OAuth authorizations and can be revoked individually.

API Key / Webhook

Create a different key for n8n, Make, Zapier, ERP or each agent. This lets you inspect last use, rotate or revoke without affecting others.

1ChatGPT

Open the BlueAuth GPT, choose connect and complete OAuth consent. Do not paste an API key into the conversation. Confirm access under Developers → Connected Apps.

2Claude / MCP

In a client that supports remote MCP servers, use the URL below and complete the authorization opened by the client:

https://blueauth.co/api/mcp-server/mcp

The server publishes 20 tools. See the JSON catalogue for names, categories, and read/write classification. mcp-tools.json

3Gemini CLI / Code Assist

In Gemini environments that accept remote MCP, add the same URL using Streamable HTTP. Start with a ba_test_ key and keep it in the client credential store.

{
  "mcpServers": {
    "blueauth": {
      "httpUrl": "https://blueauth.co/api/mcp-server/mcp",
      "headers": { "x-api-key": "ba_test_REPLACE_WITH_YOUR_KEY" }
    }
  }
}

4n8n / Make / Zapier

Create a dedicated ba_test key. Configure Authorization = Bearer &lt;key&gt; in the HTTP module. To continue after signing, create a webhook in the automation tool and send that URL as webhookUrl.

5ERP, CRM, portal or custom agent

Keep the key in a backend, never in browser JavaScript or a mobile app. The backend calls the API and returns only required data to the frontend.

N8N guide

Automate everything in n8n. Five ready-to-import workflows (in n8n: ⋯ → Import from File, or paste the content onto the canvas — n8n cloud "Import from URL" may fail):

★Make it dynamic (production)

Instead of fixed values, swap them for expressions that read the incoming data. Use a Webhook input node: your system POSTs the document + signers, and the Create node uses expressions:

// HTTP "Criar" · JSON body (expressão):
={{ JSON.stringify({
  documentName: $json.body.documentName,
  pdfBase64:    $json.body.pdfBase64,
  webhookUrl:   $json.body.webhookUrl,
  signers:      $json.body.signers
}) }}

Your system calls the Webhook (POST) and gets back the requestId. The trigger can also be Google Drive, a Form, a database, etc. — only the data source changes.

1Send for signature

  • HTTP Request · POST /api/v1/signature-requests.
  • Header Auth: Authorization = Bearer ba_live_…
  • JSON body: documentName, pdfBase64, signers[] (with zones), webhookUrl.

2Self-sign (no email)

Set selfSign: true and add one HTTP node per slot, in sequence (keep the order):

POST /api/v1/signature-requests/{{ $('1 · Criar pedido').item.json.requestId }}/self-sign
Header Auth: Authorization = Bearer ba_live_…
Body: { "signerEmail": "me@company.com", "idNumber": "517610833" }

idNumber shows on the stamp (Signed by · ID · Date), just like a system-made signature.

3Receive events

  • Node Webhook → copy the Production URL (/webhook/…, not /webhook-test/…) and paste into webhookUrl.
  • Activate the workflow — only then does the Webhook receive.
  • Node Switch on X-BlueAuth-Event to branch (signed / completed / declined).

4Manage

  • Pending: GET /api/v1/signature-requests?status=pending
  • Search: GET ?status=completed&q=Contract
  • Document: GET /signature-requests/{id}/document

5CMD batch in one call

Import the CMD workflow above. Its input webhook receives batchKey, signer and documents[]; the node validates hashes and calls POST /cmd-batches directly. n8n does not need a separate HTTP request per PDF.

  • Use a dedicated Header Auth credential and never store the API key in the workflow.
  • Use a temporary HTTPS URL for each PDF. documentHash is optional and, when sent, must be the 64-character SHA-256.
  • Set a stable batchKey so retries do not create another batch.
  • Validate X-BlueAuth-Signature before archiving documents received through the webhook.

Common errors and troubleshooting

HTTPMeaningWhat to check
400Invalid payloadJSON, required fields, email, stage and coordinates.
401Missing/invalid keyAuthorization: Bearer ba_test_…
403Missing scopeKey scopes and request/template ownership.
404Resource not foundrequestId, runId, templateId and key environment.
409Stage not readyWait for input/signature or respect signer order.
429Temporary rate limitRetry-After and exponential backoff.

Interactive reference

Full OpenAPI spec, with "Try it out". Replaces the old /api-docs.

BlueAuth API
 1.3.0 
OAS 3.1

Assinaturas, CMD em lote, templates dinâmicos e dados preenchidos.

API REST pública e aditiva. Comece com uma chave ba_test e Authorization: Bearer. Use /signature-requests para um PDF pronto; para documentos orientados por dados, siga /templates → /templates/{id}/validate → /template-runs. As ferramentas públicas /anonymization e /pdf-tools são executadas localmente no navegador e não são endpoints REST. As rotas históricas continuam compatíveis e políticas de notificação são opcionais.

Servers

Assinaturas

Crie a partir de um PDF pronto e acompanhe cada signatário.

CMD em lote

Assine 2–100 PDFs independentes com uma única confirmação da Chave Móvel Digital.

Templates

Descubra schemas e valide variáveis sem iniciar o fluxo.

Execuções de template

Gere documentos com dados e consulte snapshots por etapa.

object
object
object
object
(boolean | array<any> | object)
object
object
object
object
object