Official clients wrap the REST API with a typed method per endpoint. Their types are generated from the OpenAPI document, so they always describe what the API accepts and returns.
| TypeScript / JavaScript | Python | |
|---|---|---|
| Package | @pogton/connect | pogton-connect |
| Install | npm install @pogton/connect | pip install pogton-connect |
| Runtime | Node 18+, Deno, Bun, edge runtimes. No dependencies. | Python 3.9+, sync and async, on httpx |
| Methods | camelCase operation IDs: createPost | snake_case: create_post |
Both clients:
- read the key from
POGTON_API_KEYunless you pass one, - retry
429(afterRetry-After),5xxresponses and network errors, up to 2 times by default, and only requests that are safe to repeat, - send an
Idempotency-Keyon endpoints that accept one, so a retried request never publishes twice (pass your own to deduplicate across processes), - raise one error type with the API's error
code,messageanddetails, - verify webhook signatures.
Use them on your server only, like any API key.
TypeScript
import { PogtonConnect, PogtonError } from '@pogton/connect'
const pogton = new PogtonConnect({ apiKey: process.env.POGTON_API_KEY })
const { url } = await pogton.createConnectLink({ user_id: 'user_123' })
const { data: accounts } = await pogton.listAccounts({ user_id: 'user_123' })
try {
const post = await pogton.createPost({
account_ids: accounts.map((a) => a.id),
content: 'Hello from Pogton Connect',
scheduled_at: '2026-12-01T09:00:00+01:00',
})
console.log(post.id, post.targets.map((t) => t.status))
} catch (err) {
if (err instanceof PogtonError && err.code === 'validation_failed') console.error(err.details)
else throw err
}
Path parameters come first, then the body or query, then options such as { idempotencyKey, timeoutMs, signal }:
await pogton.getPost(postId)
await pogton.listPosts({ status: 'failed' })
await pogton.retryPost(postId, { account_ids: [accountId] })
await pogton.rollApiKey(keyId, { expires_in: 3600 })
Verify a webhook with the raw request body:
import { parseWebhookEvent } from '@pogton/connect'
const event = await parseWebhookEvent(rawBody, req.headers['x-pogton-signature-v2'], process.env.POGTON_WEBHOOK_SECRET!)
Python
from pogton_connect import PogtonConnect, PogtonError
pogton = PogtonConnect() # reads POGTON_API_KEY
url = pogton.create_connect_link({"user_id": "user_123"})["url"]
accounts = pogton.list_accounts(user_id="user_123")["data"]
try:
post = pogton.create_post({
"account_ids": [a["id"] for a in accounts],
"content": "Hello from Pogton Connect",
"scheduled_at": "2026-12-01T09:00:00+01:00",
})
except PogtonError as err:
print(err.code, err.details)
Bodies are dicts (typed as TypedDicts such as CreatePostRequest), query parameters are keyword arguments, and every method takes timeout=; methods that create something also take idempotency_key=. For asyncio, use AsyncPogtonConnect with the same methods:
from pogton_connect import AsyncPogtonConnect
async with AsyncPogtonConnect() as pogton:
posts = await pogton.list_posts(status="published", limit=10)
Verify a webhook:
from pogton_connect import parse_webhook_event
event = parse_webhook_event(raw_body, headers["X-Pogton-Signature-V2"], WEBHOOK_SECRET)
Other languages
Generate a client from the OpenAPI document with any OpenAPI 3.1 generator, or call the API with plain HTTP. AI assistants can use the MCP server instead.
