API v1

Papo API for integrations

Connect a CRM, n8n, ERPs, or your backend. Each account has a stable public key and secret keys you generate in the dashboard.

Public key

Identifies the account. Safe for the frontend.

Secret key

Authenticates requests. Server-side only.

JSON REST

HTTPS, Bearer token, CORS enabled.

Authentication

Every route except GET /api/v1 requires the secret key. The public key is optional, but if sent it must match the secret.

HeaderValue
AuthorizationBearer sk_live_…
X-Papo-Secret-KeyAlternative to Bearer
X-Papo-Public-Keypk_live_… (optional)

Base URL: https://app.papo.global/api/v1

Public and secret keys

  • pk_live_… stable per account, always visible in the dashboard.
  • sk_live_… shown once at creation. SHA-256 hashed at rest. Revoke if leaked.
  • Create named keys per environment (n8n, CRM, staging).

Endpoints

GET/api/v1/me

Account

Returns the authenticated account, public key, and email.

curl https://app.papo.global/api/v1/me \
  -H "Authorization: Bearer sk_live_…" \
  -H "X-Papo-Public-Key: pk_live_…"
GET/api/v1/instances

WhatsApp instances

Lists WhatsApp connections for the account (status, number, profile).

curl https://app.papo.global/api/v1/instances \
  -H "Authorization: Bearer sk_live_…"
GET/api/v1/instances/{id}

Instance

Fetches one instance by internal ID or name.

curl https://app.papo.global/api/v1/instances/user_100001_principal \
  -H "Authorization: Bearer sk_live_…"
GET/api/v1/assistants

AI assistants

Lists the main prompt and sub-assistants for the account.

curl https://app.papo.global/api/v1/assistants \
  -H "Authorization: Bearer sk_live_…"
GET/api/v1/contacts

Extractor contacts

Lists extracted leads, paginated.

  • page Page (default 1)
  • per_page Items per page (1–100, default 20)
  • q Search by company, phone, or email
curl "https://app.papo.global/api/v1/contacts?page=1&per_page=20" \
  -H "Authorization: Bearer sk_live_…"
POST/api/v1/messages

Send a message

Sends a WhatsApp text message from the account.

{
  "to": "5511999999999",
  "text": "Olá! Mensagem via API Papo.",
  "instance_id": "opcional — ID ou nome da instância"
}
curl -X POST https://app.papo.global/api/v1/messages \
  -H "Authorization: Bearer sk_live_…" \
  -H "Content-Type: application/json" \
  -d '{"to":"5511999999999","text":"Olá pela API Papo"}'
POST/api/ai/v1/complete

AI complete

Generates an AI reply using the account prompt (OpenRouter). Same keys.

{
  "text": "Quanto custa o plano Gold?",
  "use_client_prompt": true
}
curl -X POST https://app.papo.global/api/ai/v1/complete \
  -H "Authorization: Bearer sk_live_…" \
  -H "Content-Type: application/json" \
  -d '{"text":"Quanto custa o plano Gold?","use_client_prompt":true}'
GET/api/v1/ai/logs

AI — logs

Lists AI calls for this account (tokens, model, media, status).

  • limit Max items (1–100)
  • contact_key Filter by contact
curl "https://app.papo.global/api/v1/ai/logs?limit=20" \
  -H "Authorization: Bearer sk_live_…"

Errors

Error responses follow the shape below. Success always includes success: true and data.

{
  "success": false,
  "error": { "code": "unauthorized", "message": "…" }
}
HTTPcodeWhen
401unauthorizedMissing, invalid, or revoked key
400invalid_requestIncomplete payload
404not_foundUnknown resource

Examples

JavaScript

const res = await fetch("https://app.papo.global/api/v1/me", {
  headers: {
    Authorization: "Bearer " + process.env.PAPO_SECRET_KEY,
    "X-Papo-Public-Key": process.env.PAPO_PUBLIC_KEY,
  },
});
const json = await res.json();
console.log(json.data);

Python

import os, requests

r = requests.get(
    "https://app.papo.global/api/v1/me",
    headers={
        "Authorization": f"Bearer {os.environ['PAPO_SECRET_KEY']}",
        "X-Papo-Public-Key": os.environ["PAPO_PUBLIC_KEY"],
    },
)
print(r.json())