> ## Documentation Index
> Fetch the complete documentation index at: https://docs.posttu.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> How to authenticate with the Posttu API using Developer API Keys and OAuth 2.1 / Model Context Protocol (MCP).

Posttu supports two methods for authenticating programmatic and third-party integrations:

1. **Developer API Keys**: Simple, long-lived credentials issued directly from the dashboard for custom scripts, CRON jobs, and server-to-server integrations.
2. **OAuth 2.1 / Model Context Protocol (MCP)**: Secure, delegated authentication using standard token-based flows for external agents, AI clients, and third-party integrations.

***

## Developer API keys

Developer API keys are scoped to a single organization. All resources created or accessed using a key belong exclusively to that workspace.

### Key features

* **Fine-grained scopes**: Limit keys to specific resources and actions (e.g., `posts:read`, `posts:write`, `channels:read`, etc.).
* **Expiration periods**: Configure keys to expire automatically after 7 days, 30 days, 90 days, or remain permanent.
* **Instant rotation**: Cycle keys immediately from the dashboard settings. The existing key is instantly revoked and a fresh replacement is issued with identical permissions.

### Key management

Manage your organization's API keys directly in the dashboard:

| Action | Path |
| - | - |
| **Issue a key** | Dashboard → Settings → API Keys → **Create New Key** |
| **Rotate a key** | Dashboard → Settings → API Keys → Click the **Rotate** icon |
| **Revoke a key** | Dashboard → Settings → API Keys → Click the **Delete** icon |

> [!WARNING]
>
> Treat API keys like passwords. Do not commit them to version control or expose them in client-side code.

***

## OAuth 2.1 & Model Context Protocol (MCP)

Posttu acts as an RFC-compliant OAuth 2.1 and OpenID Connect (OIDC) provider, allowing external clients—including Model Context Protocol (MCP) servers and AI assistants—to interact with your workspace securely without exposing your raw passwords or long-lived API keys.

### Discovery endpoints

OAuth and MCP clients can auto-discover Posttu's auth capabilities, metadata, and token endpoints using these public discovery urls:

* **OpenID Configuration**: `/api/auth/.well-known/openid-configuration`
* **OAuth Authorization Server**: `/.well-known/oauth-authorization-server/api/auth`
* **OAuth Protected Resource (MCP)**: `/.well-known/oauth-protected-resource/api/v1/mcp` (also mirrored at `/.well-known/oauth-protected-resource`)

### Authentication flow

**1. Authorization Request**

The MCP or OAuth client redirects you to the Posttu authorization endpoint to initiate the login flow.

**2. Interactive Consent**

If you are not logged in, you will be prompted to sign in. Once signed in, you will see a secure consent screen listing the precise, fine-grained scopes requested by the external client.

**3. Token Exchange**

Upon granting approval, you are redirected back to the client with an authorization code, which the client exchanges for a secure, short-lived JWT access token.

**4. Request Authentication**

The client accesses the Posttu API by passing this JWT access token in the `Authorization` header on every request.

### First-party MCP server

Posttu exposes a first-party, secure Model Context Protocol (MCP) Server endpoint built directly into the application:

* **Endpoint URL**: `https://posttu.com/api/v1/mcp`
* **Transport Standard**: **Stateless Streamable HTTP** supporting MCP protocol versions **`2026-07-28`** (modern stateless core) and **`2025-11-25`** (backwards-compatible stateless Streamable HTTP).

This unified endpoint exposes your Posttu `v1` workspace tools, connected platform channel APIs, and public scrapers as scope-filtered, cursor-paginated MCP tools alongside native MCP Skills (`posttu`, `posttu-platform`, `posttu-scraper`).

#### How clients connect

To connect MCP clients (such as Claude Desktop, Cursor, or automated agent frameworks):

1. **Authentication**: Provide credentials via either a **Developer API Key** from your workspace dashboard (recommended for IDEs and desktop apps) or an **OAuth 2.1 access token** acquired through our RFC 9728 discovery endpoint (`/.well-known/oauth-protected-resource/api/v1/mcp`).
2. **Streamable HTTP (`2026-07-28` & `2025-11-25`)**: Clients send stateless JSON-RPC HTTP `POST` requests directly to `https://posttu.com/api/v1/mcp` with `Authorization: Bearer <key_or_token>` and `Accept: application/json, text/event-stream`.

***

## Passing credentials

Whether using a Developer API Key or an OAuth 2.1 Access Token, authenticate every API request by sending the credential in the HTTP header:

> [tab] Authorization header (recommended)
>
> ```bash theme={null}
> curl -X POST "https://posttu.com/api/v1/posts" \
>   -H "Authorization: Bearer <your_key_or_token>" \
>   -H "Content-Type: application/json" \
>   -d '{}'
> ```

> [tab] x-api-key header
>
> ```bash theme={null}
> curl -X POST "https://posttu.com/api/v1/posts" \
>   -H "x-api-key: <your_key_or_token>" \
>   -H "Content-Type: application/json" \
>   -d '{}'
> ```

If both headers are present, the `x-api-key` header takes priority.

***

## Error responses

Requests without a valid credential or with insufficient permissions return `401 Unauthorized`:

```json theme={null}
{
	"error": "Unauthorized"
}
```

***

## Rate limits

Rate limits are enforced on a per-minute basis and scale depending on your subscription tier. These limits apply globally across all API endpoints to ensure optimal performance and platform stability.

### Per-Plan Sub-Limits

| Plan | Rate Limit |
| :- | :- |
| **Starter** | 10 requests / min |
| **Growth** | 30 requests / min |
| **Scale** | 60 requests / min |

### Scrape Credit Quotas

While the per-minute rate limits apply to all endpoints universally, **Base Scrape Credits** are uniquely metered:

* **Unmetered Endpoints:** Standard API endpoints (such as authentication, account management, or utility routes) do not consume credits.
* **Metered Endpoints:** Scraping endpoints deduct from your monthly base credit allocation:
  * **Starter:** 1,000 credits / month
  * **Growth:** 3,000 credits / month
  * **Scale:** 5,000 credits / month

> **Top-up Pricing:** If you exceed your monthly base scrape credits, you can purchase additional top-up credits at a flat rate of **\$5 per 1,000 credits** to avoid service interruption.

### Handling 429 Errors

If your application exceeds your plan's per-minute sub-limit, the API gateway will return a `429 Too Many Requests` status code. We recommend implementing an exponential backoff strategy based on the standard rate limit headers returned in the response.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.