ChatCoat App Icon
ChatCoat PlatformREST API Reference

Official Developer & Integration Specification

Version: 1.0.0Protocol: REST / HTTPS

ChatCoat REST API Documentation

Welcome to the official ChatCoat REST API documentation. ChatCoat provides a secure, scalable API for social marketing campaigns, lead capture workflows, content publishing, and multi-tenant workspace automation.

1. Overview & Production Architecture

Production Base URLhttps://social-automation-api-8a9h.onrender.com
AuthenticationOAuth 2.0 (Authorization Code Grant with Refresh Tokens)
Data Transport / FormatJSON (application/json, UTF-8)
Timestamp RepresentationISO-8601 UTC with "Z" terminator (e.g., 2026-09-14T14:15:30.123456Z)
Primary KeysCanonical UUID v4 strings (36-character hexadecimal)
Multi-Tenant IsolationCryptographically bound to authorized workspace (organization_id)

2. Platform Integrations & Automation

ChatCoat maintains pre-built, verified integrations for major workflow automation platforms. For platform-specific setup guides, consult our dedicated integration references:

3. Authentication & OAuth 2.0

All API endpoints require a valid Bearer token issued through ChatCoat's OAuth 2.0 Authorization Server.

1Authorization Request

Send users to /oauth/authorize with your client ID, redirect URI, and desired scopes. Users authenticate securely and pick their target workspace.

2Token Exchange

Exchange the single-use authorization code (cca_code_...) at POST /oauth/token for an access token and refresh token.

3API Request Authorization

Attach the access token in the standard HTTP header:
Authorization: Bearer cca_...

4Rolling Token Refresh

Access tokens expire after 24 hours. When providing offline_access, use your refresh token at POST /oauth/token to obtain a new token pair.

Supported OAuth 2.0 Scopes

Scope KeyDescriptionGrant Permissions
leads:readView captured leads and lead commentaryRead-only
leads:writeCreate, tag, and modify lead recordsRead / Write
campaigns:readList marketing campaigns and post schedulesRead-only
campaigns:writeCreate, schedule, or publish social campaignsRead / Write
comments:readView incoming social comments and AI intentsRead-only
messages:readRead WhatsApp and live customer conversationsRead-only
messages:writeSend outbound chat and WhatsApp messagesWrite
offline_accessIssue 180-day rolling refresh tokensBackground Access

4. Identity & Workspace Verification (GET /oauth/me)

Used to inspect the active token, confirm authorized workspace binding, and verify connection health.

GEThttps://social-automation-api-8a9h.onrender.com/oauth/me
Example Response (200 OK)
{
  "user_id": "user_2t1aBcDeFgHiJkLmNoPq",
  "organization_id": "org_2t1aBcDeFgHiJkLmNoPq",
  "organization_name": "Acme Growth Marketing",
  "client_id": "cca_client_01827492",
  "scopes": [
    "leads:read",
    "leads:write",
    "campaigns:read",
    "offline_access"
  ]
}

5. Leads API

Retrieve captured leads or record new prospect inquiries generated across social media and marketing campaigns.

GET/api/leads
Requires: leads:read

Returns an array of captured leads for the authenticated organization. Records are sorted newest-first by creation date (created_at DESC, id DESC).

Query Parameters

ParameterTypeDescription
limitintegerNumber of records to return (default: 100, max: 500)
offsetintegerNumber of records to skip for pagination (default: 0)
campaign_idstring (UUID)Optional campaign filter
platformstringFilter by platform (e.g., instagram, facebook, whatsapp, custom)
statusstringFilter by status (new, contacted, qualified, converted, unqualified)
Example Response (200 OK)
[
  {
    "id": "b34bb0eb-c8b5-4cda-85a7-46216da69808",
    "organization_id": "org_2t1aBcDeFgHiJkLmNoPq",
    "campaign_id": "9bf2345e-88c9-4a41-b843-982136e09312",
    "campaign_post_id": null,
    "platform": "instagram",
    "platform_user_id": "17841400000000000",
    "username": "sarah_growth",
    "display_name": "Sarah Miller",
    "source_comment_id": null,
    "source_comment_text": "I am interested in pricing and plans!",
    "intent": "purchase_intent",
    "status": "new",
    "tags": ["pricing-inquiry", "q3-promo"],
    "created_at": "2026-09-12T16:48:46.893869Z",
    "updated_at": "2026-09-12T16:48:46.893869Z"
  }
]
POST/api/leads
Requires: leads:write

Creates a new lead in the authorized workspace. Returns the full LeadResponse entity.

Example Request Body
{
  "platform": "custom",
  "username": "inbound_lead_102",
  "display_name": "Alex Taylor",
  "source_comment_text": "Inquired via marketing website contact form",
  "intent": "demo_request",
  "status": "new",
  "tags": ["web-inbound", "enterprise"],
  "campaign_id": "9bf2345e-88c9-4a41-b843-982136e09312"
}
Example Response (200 OK)
{
  "id": "e9b2c3d4-1234-5678-9abc-def012345678",
  "organization_id": "org_2t1aBcDeFgHiJkLmNoPq",
  "campaign_id": "9bf2345e-88c9-4a41-b843-982136e09312",
  "campaign_post_id": null,
  "platform": "custom",
  "platform_user_id": null,
  "username": "inbound_lead_102",
  "display_name": "Alex Taylor",
  "source_comment_id": null,
  "source_comment_text": "Inquired via marketing website contact form",
  "intent": "demo_request",
  "status": "new",
  "tags": ["web-inbound", "enterprise"],
  "created_at": "2026-09-14T14:15:30.123456Z",
  "updated_at": "2026-09-14T14:15:30.123456Z"
}

6. Campaigns API (GET /api/campaigns)

Retrieve social marketing campaigns configured in the workspace.

GEThttps://social-automation-api-8a9h.onrender.com/api/campaigns
Example Response (200 OK)
[
  {
    "id": "9bf2345e-88c9-4a41-b843-982136e09312",
    "organization_id": "org_2t1aBcDeFgHiJkLmNoPq",
    "name": "Summer Product Launch Campaign",
    "status": "published",
    "created_at": "2026-08-20T10:00:00.000000Z",
    "posts": [
      {
        "id": "post_7819234a-1294",
        "platform": "instagram",
        "caption": "Check out our newest release!",
        "status": "published"
      }
    ]
  }
]

7. Error Handling & HTTP Status Codes

ChatCoat returns standard HTTP status codes and structured JSON error responses.

Status CodeStatus NameDescription
400Bad RequestMissing required parameters or malformed payload.
401UnauthorizedMissing, invalid, or expired Bearer token.
403ForbiddenToken lacks required scope or workspace permissions.
404Not FoundTarget resource (e.g. campaign or lead ID) does not exist in workspace.
422Unprocessable EntityPayload validation failed (type error or schema mismatch).
429Rate Limit ExceededToo many requests; back off and retry using Exponential Backoff.
500Internal Server ErrorAn unexpected server error occurred.
Example Error Body
{
  "detail": "Invalid or expired authorization credentials."
}

Developer Support & Verification Assistance

If you need assistance with API access, custom integrations, or review team credentials, contact our engineering team at support@chatcoat.com.