Login

Authentication & Scopes

All /v1 API requests must be authenticated with an external API key sent in the Authorization: Bearer {token} header over HTTPS.

Key Types: Site-Scoped vs. Organization-Scoped

BlogHunch supports two types of API keys under Settings » API:

  • Site-Scoped Keys: Bound to a single publication (publication_id). You do not need to pass any site identifier in requests—the API automatically resolves your publication and blocks attempts to target another site (403 TENANT_MISMATCH).
  • Organization-Scoped Keys (Agency & Enterprise): Bound to your entire Organization. Ideal for agencies managing 5–20+ client publications or enterprise platforms provisioning sites programmatically. For site-level endpoints (/v1/posts, /v1/subscribers, etc.), pass X-Publication-Id: {id} or X-Publication-Subdomain: {subdomain}.
Targeting a site with an Organization key
curl https://api.bloghunch.com/v1/posts \
  -H "Authorization: Bearer {org_token}" \
  -H "X-Publication-Id: 3696"
await fetch('https://api.bloghunch.com/v1/posts', {
  headers: {
    Authorization: `Bearer ${ORG_TOKEN}`,
    'X-Publication-Id': '3696',
  },
})

Every key records last_used_at and last_used_ip for security auditing. You can rotate compromised keys cleanly from the dashboard or via POST /v1/api-keys/{id}/rotate.


Introspect Current Key

GET/v1/me

Returns metadata about the authenticated API key, granted scopes, effective rate limit, user, organization, and resolved publication.

GETRequest
curl https://api.bloghunch.com/v1/me \
  -H "Authorization: Bearer {token}"
{
  "data": {
    "token": {
      "id": 14,
      "name": "Agency Automation",
      "key_prefix": "MTQ.9f2a1c8b0e",
      "scope_type": "organization",
      "scopes": ["organizations:read", "posts:read", "posts:write"],
      "rate_limit_rpm": 300,
      "expires_at": null,
      "last_used_at": "2026-11-24T14:10:00.000Z"
    },
    "user": {
      "id": 1,
      "name": "Subham Mitra",
      "email": "subham@bloghunch.com"
    },
    "organization": {
      "id": 8,
      "name": "Acme Agency",
      "plan": "studio"
    },
    "publication": null,
    "role": "owner",
    "access_scope": "all_sites"
  }
}

Available Scopes

GET/v1/scopes

Every endpoint enforces explicit OAuth-style scopes. Missing a required scope returns 403 INSUFFICIENT_SCOPE detailing both required and granted scopes.

  • Name
    Content
    Type
    scopes
    Description

    publication:read, publication:write, posts:read, posts:write, posts:delete, pages:read, pages:write, pages:delete, tags:read, tags:write, categories:read, categories:write, media:read, media:write, media:delete, comments:read, comments:write, comments:moderate

  • Name
    Audience & Commerce
    Type
    scopes
    Description

    subscribers:read, subscribers:write, segments:read, segments:write, newsletters:read, newsletters:write, newsletters:send, orders:read

  • Name
    Workflows & Analytics
    Type
    scopes
    Description

    webhooks:read, webhooks:write, approvals:read, approvals:write, analytics:read

  • Name
    AI & Brand Memory
    Type
    scopes
    Description

    ai:studio, brain:read, brain:write, automations:read, automations:write, automations:run

  • Name
    Organization & Enterprise
    Type
    scopes
    Description

    organizations:read, organizations:write, audit_logs:read

Was this page helpful?