# Adeli API > One REST API for your customers' Instagram, Facebook, TikTok, YouTube, X, and Bluesky accounts: > hosted OAuth connect, publishing, comments, message history, analytics, and Facebook ads. > Authenticate with `Authorization: Bearer rk_live_...`. A key belongs to your > organization; every request names a profile with profileId or an accountId. Base URL: https://app.tryadeli.com/api/v1 MCP server: https://app.tryadeli.com/mcp (Streamable HTTP, same Bearer key) Documentation: https://www.tryadeli.com/docs This file is the complete documentation corpus. Every page is also served on its own as markdown: append .md (or .txt) to its URL. --- # Getting started ## Introduction URL: https://www.tryadeli.com/docs Markdown: https://www.tryadeli.com/docs.md What Adeli is, which providers it covers, and how profiles model your customers. # Adeli API > What Adeli is, which providers it covers, and how profiles model your customers. Canonical: One REST API for your customers' social accounts. Connect an Instagram professional account, a Facebook Page, a TikTok account, or a YouTube channel once, then publish posts, manage comments, read message history, and pull analytics through a single normalized interface — without writing against Meta's Graph API, TikTok API for Business, and the YouTube Data API separately. Your first two profiles are free, with up to two connected accounts each. See [Pricing](https://www.tryadeli.com/docs/pricing). **cURL** ```bash curl https://app.tryadeli.com/api/v1/profiles \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/profiles", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}` }, }); const { profiles } = await response.json(); ``` **Python** ```python import os, requests response = requests.get( "https://app.tryadeli.com/api/v1/profiles", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) profiles = response.json()["profiles"] ``` New here? [The quickstart](https://www.tryadeli.com/docs/quickstart) takes you from a fresh API key to a published post in six steps. Using an AI agent? Connect it through the [MCP server](https://www.tryadeli.com/docs/mcp) with the same key, and it can call the whole API as tools. ## How it fits together A **profile** is one of your customers. Your profiles live in your **organization**, the workspace your team shares, and you issue an API key for the organization in the Adeli dashboard. One key reaches every profile, so every profile-scoped request names the one it acts on, with a `profileId` or with an `accountId` that belongs to it. Nothing defaults to a profile, so a request cannot quietly act on the wrong customer. `GET /api/v1/accounts` is the explicit exception: without a `profileId`, it lists accounts across the organization. Create profiles in the dashboard or with `POST /api/v1/profiles`. Inside a profile you connect **accounts** — one Instagram account, one TikTok account, one YouTube channel. You do that by sending your customer through [the connect flow](https://www.tryadeli.com/docs/api/connect), which hands you an authorization URL to open in their browser and a session to poll. Adeli stores and refreshes the provider tokens; you never handle them. From there, every endpoint takes an `accountId` and returns a normalized shape. The same `POST /api/v1/posts` call publishes to Instagram, Facebook, TikTok, YouTube, X, or Bluesky depending on the `platform` you pass. ## What each provider supports | | Instagram | TikTok | YouTube | | ----------------------------------------- | -------------------------- | ------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | | Connect via hosted OAuth | Yes | Yes | Yes, one channel per profile | | List posts | Yes | Yes, with views, shares, and reach | Yes, with views | | Publish a single image | Yes | Yes | No | | Publish a carousel | Yes, 2–10 images | Yes, 1–35 photos | No | | Publish a video | Yes, as a Reel or a Story | Yes, public or as a draft | Yes, public, unlisted, private, or scheduled; vertical videos up to 3 minutes become Shorts | | Read, reply to, hide, and delete comments | Yes | Yes, plus likes; deletes the account's own comments only | Yes; hiding holds a comment for review, and others' comments are rejected rather than deleted | | Read message history | Yes | No | No — YouTube has no messaging API | | Send a message | Yes, text | No | No | | Account analytics | Views, reach, interactions | Daily views, followers, and engagement; follower demographics | Daily views, watch time, and subscribers; viewer demographics | | Post analytics | No | Watch time, retention, impression sources | Views, watch time, average view percentage | > **Note: Not available in v1** > > WhatsApp sends approved templates only, and numbers are connected in the > dashboard. There is no post > editing or deletion. Instagram post listing follows > provider pagination on your behalf but exposes no cursors of its own — see > [Core concepts](https://www.tryadeli.com/docs/concepts) for the limits that apply to every read. ## Base URL All endpoints live under `/api/v1`, and every response is JSON. ```bash https://app.tryadeli.com/api/v1 ``` The whole API is also described as an OpenAPI 3.1 document at [`/docs/openapi.json`](https://www.tryadeli.com/docs/openapi.json). Import it into Insomnia or another client, generate a client from it, or hand it to an AI coding tool. To try the API in Postman, fork the [Adeli Postman collection](https://www.tryadeli.com/docs/postman). Running Adeli locally? Use `http://localhost:3000/api/v1` instead. The examples throughout these docs assume two environment variables: ```bash export ADELI_URL=https://app.tryadeli.com export ADELI_API_KEY='rk_live_...' ``` ## Next steps - **[Quickstart](https://www.tryadeli.com/docs/quickstart)** — connect an account and publish a post. - **[Authentication](https://www.tryadeli.com/docs/authentication)** — how API keys work and how to keep them safe. - **[Core concepts](https://www.tryadeli.com/docs/concepts)** — profiles, partial responses, and limits. - **[MCP server](https://www.tryadeli.com/docs/mcp)** — give an AI agent the whole API as tools, with the same key. - **[API reference](https://www.tryadeli.com/docs/api)** — every endpoint, parameter, and response. - **[OpenAPI spec](https://www.tryadeli.com/docs/openapi.json)** — the same reference as a machine-readable OpenAPI 3.1 document. ## Quickstart URL: https://www.tryadeli.com/docs/quickstart Markdown: https://www.tryadeli.com/docs/quickstart.md From a new API key to a published post in six steps. # Quickstart > From a new API key to a published post in six steps. Canonical: Six steps: create a key, pick a profile for your customer, connect their Instagram account to it, and publish an image. Everything here runs against a real account — there is no sandbox mode, so use an account you do not mind posting to. You will need an Instagram professional (Business or Creator) account. TikTok and YouTube follow the same shape; the differences are called out in [the Posts reference](https://www.tryadeli.com/docs/api/posts). > **Note: Prefer TypeScript?** > > Install the server-side SDK with `npm install @adeli/sdk` (Node.js 22+) and > call `adeli.getMe()` to check your key; see [the SDK page](https://www.tryadeli.com/docs/sdk). The > steps below use plain HTTP so they work from any language. > **Note: Prefer Postman?** > > Fork the [Adeli Postman collection](https://www.tryadeli.com/docs/postman) and run its **Start here** > folder. Once an Instagram account is connected, it checks your key, uploads > an image, and publishes it, with no code. ## 1. Create an API key Sign in at [`/sign-in`](https://app.tryadeli.com/sign-in) with Google. Any Google account works, and your first sign-in creates your account, an organization you own, and a default profile in it. Open **Settings → API keys** in the dashboard sidebar, or go straight to [`/settings/api-keys`](https://app.tryadeli.com/settings/api-keys). Give the key a label such as `Local testing` and select **Create key**. > **Warning: The secret is shown once** > > Copy it immediately — Adeli stores only a hash and cannot show it to you > again. A key belongs to your organization and can act on every profile in it, > and deleting a key revokes it instantly. Save it alongside the base URL: ```bash export ADELI_URL=https://app.tryadeli.com export ADELI_API_KEY='rk_live_...' ``` Still in the dashboard, open **Settings → OAuth** and register the exact client callback used below: `https://client.example/callback`. Use your real application URI; for local development, `http://localhost` and `http://127.0.0.1` are also accepted. See [OAuth setup](https://www.tryadeli.com/docs/oauth) for production, staging, and browser-return guidance. ## 2. List your profiles, or create one A profile is one of your customers. Every profile-scoped request names the profile it acts on, with a `profileId` or with an `accountId` that belongs to it, and nothing defaults to one. This call lists your organization's profiles, the default first, and confirms the key works. `GET /api/v1/accounts` is the organization-wide exception: omit `profileId` to discover accounts across all profiles. > **Note: Changed on 2026-10-08** > > Keys used to be bound to one profile, and requests without a `profileId` used > it. Keys now belong to the organization, and a profile-scoped request that > names no profile returns `400 profile_required`. Unscoped account listing is > organization-wide. See [Authentication](https://www.tryadeli.com/docs/authentication#breaking-change-2026-10-08). **cURL** ```bash curl "$ADELI_URL/api/v1/profiles" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const adeli = (path, init) => fetch(`${process.env.ADELI_URL}/api/v1${path}`, { ...init, headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", ...init?.headers, }, }).then((response) => response.json()); const { profiles } = await adeli("/profiles"); const profileId = profiles[0].id; ``` **Python** ```python import os, requests BASE = f"{os.environ['ADELI_URL']}/api/v1" HEADERS = {"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"} profiles = requests.get(f"{BASE}/profiles", headers=HEADERS).json()["profiles"] profile_id = profiles[0]["id"] ``` ```json { "profiles": [ { "id": "00000000-0000-4000-8000-000000000001", "name": "Client A", "externalId": "customer-123", "metadata": {}, "isDefault": true, "createdAt": "2026-09-08T20:00:00.000Z", "updatedAt": "2026-09-08T20:00:00.000Z" } ] } ``` To give a new customer their own profile instead, create one. The optional `Idempotency-Key` makes a retry return the same profile rather than a `409 profile_name_conflict`: ```bash curl -X POST "$ADELI_URL/api/v1/profiles" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: customer-123" \ -d '{"name":"Client A","externalId":"customer-123"}' ``` Save the profile's `id` — the next three calls need it. ```bash export PROFILE_ID=00000000-0000-4000-8000-000000000001 ``` ## 3. Start a connection This returns an `authUrl`. Open it in **your customer's browser** — they authorize Instagram directly with Meta, and Adeli never sees their credentials. **cURL** ```bash curl -X POST \ "$ADELI_URL/api/v1/profiles/$PROFILE_ID/connect" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{"platform":"instagram","redirectUrl":"https://client.example/callback"}' ``` **JavaScript** ```javascript const session = await adeli(`/profiles/${profileId}/connect`, { method: "POST", body: JSON.stringify({ platform: "instagram", redirectUrl: "https://client.example/callback", }), }); // Send the customer here. Do not fetch it from your backend. console.log(session.authUrl); ``` **Python** ```python session = requests.post( f"{BASE}/profiles/{profile_id}/connect", headers=HEADERS, json={ "platform": "instagram", "redirectUrl": "https://client.example/callback", }, ).json() print(session["authUrl"]) # Send the customer here. ``` ```json { "id": "00000000-0000-4000-8000-000000000002", "profileId": "00000000-0000-4000-8000-000000000001", "platform": "instagram", "status": "pending_authorization", "accountId": null, "expiresAt": "2026-09-08T20:10:00.000Z", "completedAt": null, "error": null, "authUrl": "https://www.instagram.com/oauth/authorize?..." } ``` > **Note: redirectUrl must be registered exactly** > > Register the complete URI under **Settings → OAuth** for the API key's > organization. Scheme, host, port, path, and fixed query string must match; > another path on the same origin is not accepted. Production URIs use HTTPS, > with HTTP allowed only for `localhost` and `127.0.0.1`. An invalid or > unregistered URI returns `400 invalid_redirect_uri`. You can omit > `redirectUrl` entirely and just poll instead. See [OAuth setup](https://www.tryadeli.com/docs/oauth). ## 4. Poll until the connection lands The session expires ten minutes after it is created. Poll it until `status` is one of the three terminal values: `connected`, `failed`, or `expired`. **cURL** ```bash curl \ "$ADELI_URL/api/v1/profiles/$PROFILE_ID/connect/$CONNECTION_SESSION_ID" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const TERMINAL = new Set(["connected", "failed", "expired"]); let state = session; while (!TERMINAL.has(state.status)) { await new Promise((resolve) => setTimeout(resolve, 2000)); state = await adeli(`/profiles/${profileId}/connect/${session.id}`); } if (state.status !== "connected") throw new Error(state.error?.code ?? state.status); const accountId = state.accountId; ``` **Python** ```python import time TERMINAL = {"connected", "failed", "expired"} state = session while state["status"] not in TERMINAL: time.sleep(2) state = requests.get( f"{BASE}/profiles/{profile_id}/connect/{session['id']}", headers=HEADERS, ).json() assert state["status"] == "connected", state["error"] account_id = state["accountId"] ``` If you supplied a `redirectUrl`, the browser comes back to it with `connectionSessionId`, `status`, and — on success — `accountId` in the query string. Treat those as a hint for your UI and poll the session for the authoritative answer. ## 5. List the connected accounts **cURL** ```bash curl "$ADELI_URL/api/v1/accounts" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const { accounts } = await adeli("/accounts"); ``` **Python** ```python accounts = requests.get(f"{BASE}/accounts", headers=HEADERS).json()["accounts"] ``` ```json { "status": "complete", "accounts": [ { "id": "00000000-0000-0000-0000-000000000000", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "platform": "instagram", "providerId": "17841400000000000", "displayName": "@adeli", "displayIdentifier": "adeli", "connectionStatus": "connected" } ], "errors": [] } ``` Use `accountId` — Adeli's UUID — in every later request. It belongs to exactly one profile, so a request that passes it needs no `profileId`. `providerId` is informational. ## 6. Publish an image Images are sent as base64 and must be JPEG, PNG, or WebP, decoding to no more than 8 MiB. Adeli normalizes them to JPEG before handing them to Instagram. **cURL** ```bash # Build the request body without putting base64 on the command line. node -e ' const fs = require("node:fs"); fs.writeFileSync("/tmp/adeli-post.json", JSON.stringify({ platform: "instagram", accountId: process.env.ACCOUNT_ID, caption: "Published through Adeli", image: { contentType: "image/png", base64: fs.readFileSync("./photo.png").toString("base64") }, })); ' curl -X POST "$ADELI_URL/api/v1/posts" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ --data-binary @/tmp/adeli-post.json ``` **JavaScript** ```javascript import { readFile } from "node:fs/promises"; const post = await adeli("/posts", { method: "POST", body: JSON.stringify({ platform: "instagram", accountId, caption: "Published through Adeli", image: { contentType: "image/png", base64: (await readFile("./photo.png")).toString("base64"), }, }), }); ``` **Python** ```python import base64, pathlib post = requests.post( f"{BASE}/posts", headers=HEADERS, json={ "platform": "instagram", "accountId": account_id, "caption": "Published through Adeli", "image": { "contentType": "image/png", "base64": base64.b64encode(pathlib.Path("photo.png").read_bytes()).decode(), }, }, ).json() ``` A successful publish returns `201` and the normalized post: ```json { "id": "instagram_post_00000000-0000-0000-0000-000000000000_17900000000000000", "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "providerId": "17900000000000000", "caption": "Published through Adeli", "media": [{ "type": "IMAGE", "url": "https://media.example/staging/key.jpg", "thumbnailUrl": "https://media.example/staging/key.jpg" }], "permalink": null, "engagement": { "likes": null, "comments": null }, "publishedAt": "2026-04-01T12:00:00.000Z" } ``` Pass `images` instead of `image` — an array of 2 to 10 — to publish a carousel. ## Where to go next - **[Authentication](https://www.tryadeli.com/docs/authentication)** — key scoping and how to keep keys out of the browser. - **[OAuth setup](https://www.tryadeli.com/docs/oauth)** — register callback URIs and handle the browser return. - **[Core concepts](https://www.tryadeli.com/docs/concepts)** — partial responses, and the limits on every read. - **[Posts](https://www.tryadeli.com/docs/api/posts)** — TikTok video, photo, and carousel publishing, and YouTube uploads. - **[Errors](https://www.tryadeli.com/docs/errors)** — every code the API can return. ## Authentication URL: https://www.tryadeli.com/docs/authentication Markdown: https://www.tryadeli.com/docs/authentication.md Bearer API keys, how they reach every profile in your organization, and how to keep them safe. # Authentication > Bearer API keys, how they reach every profile in your organization, and how to keep them safe. Canonical: Every request to `/api/v1` carries a bearer API key. There is no `X-API-Key` header, no OAuth client-credentials flow, and no unauthenticated endpoint. ```http Authorization: Bearer rk_live_... Accept: application/json ``` ## Creating a key Keys are issued from the dashboard, not through the API. Owners and admins of an organization can create and delete them; every member can see the list, which shows who created each key. 1. Open **Settings → API keys**, or go to [`/settings/api-keys`](https://app.tryadeli.com/settings/api-keys). 2. Add an optional label and select **Create key**. 3. Copy the secret. > **Warning: The secret is shown exactly once** > > Adeli stores a SHA-256 hash of your key and the first few characters for > display. Nothing in the product can recover the plaintext, so if you lose it, > delete the key and create another. Keys look like `rk_live_` followed by 43 URL-safe characters. The dashboard lists them by their prefix, such as `rk_live_Ab3dEf9…`, so you can tell which key is which without ever revealing one. ## Keys belong to your organization A key belongs to your organization, not to a profile, and can act on every profile in it. Profile-scoped requests name the profile they act on: - With a `profileId` in the path, as in `/api/v1/profiles/{profileId}/accounts`, or in the query string or body. - Or with an `accountId`. Each connected account belongs to exactly one profile, so the `accountId` names it, and you can leave `profileId` out. Nothing defaults to a profile: - A profile-scoped request with neither returns `400 profile_required`. - A `profileId` in another organization returns `404 profile_not_found`, and an `accountId` in another organization returns `404 account_not_found`, not `403`. The API does not confirm whether something you cannot reach exists. - A `profileId` and `accountId` that disagree return `404 account_not_found`. Four endpoints can act on the whole organization and take no profile: `GET /api/v1/profiles`, `POST /api/v1/profiles`, `GET /api/v1/accounts`, and `GET /api/v1/usage/x`. The account list can still take `profileId` to narrow its results to one profile. There are no scopes or per-endpoint permissions. A key can do everything the API offers, for every profile in your organization. > **Note: Keep customers apart with profiles** > > If you serve multiple end customers, give each one its own profile and always > pass its `profileId` or one of its `accountId`s. Treat a key as access to all > of them: a leaked key exposes your whole organization, so rotate it. ## Breaking change (2026-10-08) Until 2026-10-08, a key was bound to one profile, and a request without a `profileId` used that profile. Every existing key was then promoted to its organization and can now reach every profile in it. If you shared a key with anyone outside your organization, such as one customer, rotate it. Profile-scoped requests must now name a profile with `profileId` or an `accountId`, or they return `400 profile_required`. An unscoped `GET /api/v1/accounts` lists accounts across the organization. `POST /api/v1/profiles` now creates a profile instead of returning `403 profile_scope_violation`. ## Revoking a key Delete the key from **Settings → API keys**. Revocation is immediate — there is no cache and no grace period, and the next request with that key returns `401`. Deleting a profile does not delete any key. ## Keep keys on your server An Adeli key can publish posts and send messages on your customer's behalf. Treat it like a database password. - Never ship a key in browser JavaScript, a mobile app bundle, or a public repo. - Never put one in a URL — they end up in logs, proxies, and analytics. - Call Adeli from your backend and expose only the results to your frontend. The `@adeli/sandbox` workspace in the Adeli repository is a working example of this shape: the browser posts to a small server route, and that route is the only place the key exists. ## Failed authentication A missing, malformed, or revoked key returns `401` with the standard error envelope: ```json { "error": { "code": "unauthorized", "message": "A valid Bearer API key is required" } } ``` Check a key quickly with a request that has no side effects: **cURL** ```bash curl -i "$ADELI_URL/api/v1/profiles" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch(`${process.env.ADELI_URL}/api/v1/profiles`, { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}` }, }); console.log(response.status); // 200 when the key is valid, 401 when it is not ``` **Python** ```python import os, requests response = requests.get( f"{os.environ['ADELI_URL']}/api/v1/profiles", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) print(response.status_code) # 200 when the key is valid, 401 when it is not ``` See [Errors](https://www.tryadeli.com/docs/errors) for everything else the API can return. ## OAuth setup URL: https://www.tryadeli.com/docs/oauth Markdown: https://www.tryadeli.com/docs/oauth.md Register exact client redirect URIs and return customers to your application after provider authorization. # OAuth setup > Register exact client redirect URIs and return customers to your application after provider authorization. Canonical: Adeli hosts the provider authorization flow, stores provider tokens, and returns your customer's browser to your application. Before a connect request can use a `redirectUrl`, register that exact URI for your organization. ## Register a redirect URI 1. Sign in to the [Adeli dashboard](https://app.tryadeli.com/sign-in). 2. Open **Settings → OAuth**, or go directly to [`/settings/oauth`](https://app.tryadeli.com/settings/oauth). 3. Enter the complete callback URI in your application, such as `https://client.example/oauth/adeli`. 4. Select **Register URI**. Owners and admins can add or remove registrations. Members can view them. Add a separate URI for every production, staging, and local callback your integration uses. > **Note: The complete URI must match** > > Adeli matches the normalized scheme, host, port, path, and fixed query string. > Registering `https://client.example/oauth/adeli` does not authorize > `https://client.example/another-path`. Wildcards and fragments are not > supported. Production URIs must use HTTPS. For local development only, HTTP is accepted on `localhost` and `127.0.0.1`, including a port: ```text http://localhost:3001/oauth/adeli http://127.0.0.1:3001/oauth/adeli ``` ## Client return URI versus provider callback URI Your registered URI is the **client return URI**. It belongs to your application and receives the browser after Adeli has processed authorization. The social provider instead returns to an **Adeli provider callback URI**, such as `https://app.tryadeli.com/api/youtube/callback`. Adeli owns the provider apps, client secrets, callback registration, token exchange, and refresh cycle. You do not create provider apps or register Adeli's callback URLs yourself. ## Start the authorization flow Call the connect endpoint from your server with your API key. `redirectUrl` must match one of the active organization's registered URIs: ```bash curl -X POST \ "$ADELI_URL/api/v1/profiles/$PROFILE_ID/connect" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{"platform":"instagram","redirectUrl":"https://client.example/oauth/adeli"}' ``` The response contains an `authUrl` and connection-session `id`. Open `authUrl` in **your customer's browser**; do not fetch it from your backend. The customer authorizes directly with the provider. You may omit `redirectUrl` and poll the session without a browser return. ## Handle the browser return After the provider callback finishes, Adeli sends the browser to your registered URI with these query parameters: - `connectionSessionId` — the connection session to poll. - `status` — its status when the browser was redirected. - `accountId` — present when an account connected successfully. - `workflowId` — a UI hint for the provider workflow. Treat them only as a browser hint. Your server must poll [`GET /api/v1/profiles/{profileId}/connect/{connectionSessionId}`](https://www.tryadeli.com/docs/api/connect/get-connection-session) with its API key until the authoritative status is `connected`, `failed`, or `expired`. > **Warning: Keep the API key on your server** > > The redirect handler can send the session id to your backend, but it must not > expose the Adeli API key in browser code. One key can act on every profile in > its organization. ## Change or remove a URI Add the replacement first, update your application to send it as `redirectUrl`, and then remove the old registration. Removing a URI prevents new connection sessions from using it immediately. A session created before removal stores the previously accepted URI and may finish during its ten-minute lifetime. An invalid, insecure, or unregistered `redirectUrl` returns `400 invalid_redirect_uri` before Adeli creates a connection session. ## Next steps - [Quickstart](https://www.tryadeli.com/docs/quickstart) — create a key, connect an account, and publish. - [Connect overview](https://www.tryadeli.com/docs/api/connect) — the full browser and provider flow. - [Start connection](https://www.tryadeli.com/docs/api/connect/start-connection) — request and response contract. - [Authentication](https://www.tryadeli.com/docs/authentication) — API-key scope and storage. ## Partial grants An authorization succeeds when its callback code produces a usable access token. Adeli stores the exact scopes and provider-confirmed resources even when requested or recommended access was withheld, profile fields cannot be hydrated, or no refresh token was returned. The account remains Connected; unresolved provider identity/resource rows are not billable. Each feature checks only its own requirements before provider calls, uploads, or metered work. Missing access returns `403 permission_required` with a `restart_oauth` action. Restart through `POST /api/v1/profiles/{profileId}/connect`; expanded consent updates the same `accountId`. Expired/revoked credentials remain separate reconnect errors. ## Core concepts URL: https://www.tryadeli.com/docs/concepts Markdown: https://www.tryadeli.com/docs/concepts.md Profiles, accounts, the partial-response contract, and the limits that apply to every read. # Core concepts > Profiles, accounts, the partial-response contract, and the limits that apply to every read. Canonical: Four ideas explain most of the API's behavior: profiles, accounts, the partial-response contract, and the limits on aggregate reads. ## Profiles A profile is a client boundary — one of your end customers or brands. It owns the provider connections made on its behalf. Profiles live in your **organization**, the workspace your team shares, and an API key belongs to the organization, so one key can act on every profile in it. **Profile** | Name | Type | Required | Description | | ------------ | ---------------- | -------- | ----------------------------------------------------------------------------------------------------------------------- | | `id` | `uuid` | | Adeli's identifier. Use it in every path that takes a profileId. | | `name` | `string` | | Display name, unique within your organization. 1–200 characters. | | `externalId` | `string \| null` | | Your own identifier for this customer, so you do not have to store a mapping. Unique within your organization when set. | | `metadata` | `object \| null` | | Arbitrary JSON you control, up to 16 KiB encoded as UTF-8. | | `isDefault` | `boolean` | | Whether this is the profile new dashboard sessions start on. | Profiles are created in the dashboard or with [`POST /api/v1/profiles`](https://www.tryadeli.com/docs/api/profiles), and listed with `GET /api/v1/profiles`. Deleting one cascades: its connected accounts and cached history go with it. API keys belong to the organization and are not affected. ## Accounts An account is one provider connection inside a profile — an Instagram professional account, a Facebook Page, a TikTok account, or a YouTube channel. A profile holds at most one of each. Every endpoint that acts on a provider takes `accountId`, which is **Adeli's** UUID. The provider's own identifier comes back as `providerId` and is informational; passing it where an `accountId` is expected returns `400 invalid_request`. **Account** | Name | Type | Required | Description | | ------------------- | ---------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------- | | `accountId` | `uuid` | | The identifier to use in requests. `id` is the same value. | | `platform` | `"instagram" \| "tiktok" \| "facebook" \| "youtube"` | | Which provider this connection belongs to. | | `providerId` | `string` | | The provider's identifier — an Instagram user id, TikTok's app-scoped open\_id, or a YouTube channel id. | | `displayName` | `string` | | Human-readable name, such as "@adeli". | | `displayIdentifier` | `string` | | The handle or open\_id, without decoration. | | `connectionStatus` | `"connected" \| "expired" \| "reconnect_required"` | | Whether Adeli can still act on this account. Anything but connected means the customer has to authorize again. | Instagram long-lived tokens last roughly 60 days. Adeli refreshes them, and `POST /api/v1/profiles/:profileId/accounts/refresh` forces the attempt, but a connection that has lapsed needs the customer to go back through [the connect flow](https://www.tryadeli.com/docs/api/connect). ## Profiles, accounts and billing Adeli bills per **profile**, not per account. A profile is active, and billed, on each day it has at least one connected account; how many accounts it connects doesn't change the price. An agency with ten clients, each on three platforms, has ten profiles and thirty accounts, and pays for ten profiles. Your first two profiles are free, with up to two accounts each. See [Pricing](https://www.tryadeli.com/docs/pricing) for the plans and [Billing](https://www.tryadeli.com/docs/billing) for how partial months and charges work. ## Scoping a request Every profile-scoped request names the profile it acts on, and nothing defaults to one. - **Pass `profileId`** in the path, the query string, or the body. - **Or pass `accountId`.** An account belongs to exactly one profile, so it names that profile and `profileId` can be left out. If you pass both, they must agree, or you get `404 account_not_found`. - **Pass neither** to a profile-scoped endpoint and you get `400 profile_required`. - **Pass a profile or account in another organization** and you get `404 profile_not_found` or `404 account_not_found`, whether or not it exists. `GET` and `POST /api/v1/profiles`, `GET /api/v1/accounts`, and `GET /api/v1/usage/x` can act on the whole organization and take no profile. An unscoped account list returns accounts from every profile; pass `profileId` to narrow it to one. Add `accountId` to narrow a read to one connection, and `platform` to narrow it to one provider. ## Partial responses Aggregate reads — accounts, posts, messages — can touch more than one provider in a single request. One provider failing does not throw away the data from the others. | HTTP | `status` | Meaning | | ------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `200` | `complete` | Every attempted provider succeeded. `errors` is empty. | | `207` | `partial` | At least one succeeded and at least one failed. Successful records are still in the response; `errors` says which account failed and why. | | `404` / `422` | — | Every attempted provider failed for the same reason, and that reason has a meaningful status: `account_not_found` is `404`, `connection_expired` and `provider_not_configured` are `422`. | | `502` | — | Every attempted provider failed for mixed or upstream reasons. | A partial response looks like this: ```json { "status": "partial", "messages": [], "errors": [ { "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "code": "provider_error", "message": "The provider request failed" } ] } ``` > **Warning: Treat 207 as success with caveats** > > A client that only checks `response.ok` will silently accept `207` and act on > an incomplete list. Check `status` and inspect `errors` before you treat an > aggregate read as the whole picture. Provider error bodies are never passed through. An upstream failure becomes a sanitized `provider_error` so that provider credentials and internal URLs cannot leak into your logs. ## Limits **What applies to every request** | Name | Type | Required | Description | | ----------------- | ------------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Pagination` | `none` | | Adeli follows each provider's cursors server-side and returns one flat array. There are no cursors in the public API. Filter by `platform` and `accountId` to keep responses small. | | `Result cap` | `10,000` | | The maximum number of records in one collection response. Exceeding it truncates the array and adds a `result_limit` entry to `errors`, which makes the response `207`. | | `Rate limiting` | `none` | | Not implemented in v1. Do not rely on its absence — be reasonable, and expect limits to arrive before general availability. | | `Caching` | `messages: 15s internal` | | `GET /messages` may replay a complete response from Adeli's internal cache for 15 seconds, after authentication and authorization. Accepted sends and verified provider changes normally invalidate the affected account sooner; 15 seconds remains the fallback bound. Partial and error responses are not cached. Every public response remains `cache-control: private, no-store`, so browsers and CDNs must not store it. | | `Instagram image` | `8 MiB` | | Decoded size for a single image or each carousel entry. JPEG, PNG, and WebP are accepted and normalized to JPEG. | | `TikTok video` | `64 MiB / 1 GB` | | 64 MiB decoded for base64 JSON bodies; 1 GB for multipart uploads and public URL pulls. | | `TikTok photo` | `20 MB` | | Per photo, up to 35 photos, normalized to JPEG at 1080×1920. | | `YouTube video` | `1 GB / 4 GiB` | | 1 GB for a public `video.url` pull; 4 GiB for a multipart upload to `POST /api/v1/posts/youtube`. Base64 JSON bodies are capped by the request size. | | `YouTube quota` | `Higher tier` | | Adeli's YouTube app has passed Google's API Services audit and is approved for higher quota tiers. The daily quota belongs to Adeli's Google Cloud project and is shared by every connected channel. Reads cost 1 unit, every comment write and video edit 50, and uploads draw on a separate allowance of 100 a day. When the day's quota is spent, YouTube calls return `429 quota_exhausted` with the reset time, midnight Pacific. | ## Idempotency and retries There is no idempotency key on the public API. `POST /api/v1/posts` and `POST /api/v1/messages` are not safe to retry blindly — a retry after a timeout may publish twice. If a publish times out, list posts or query the TikTok or YouTube status endpoint to find out what actually happened before trying again. Reads are safe to retry. ## What is not here - **Post editing and deletion.** `PUT` and `DELETE` on posts are deliberately not part of v1. - **WhatsApp free-form replies and connecting a number.** The API sends WhatsApp templates; see [Messages](https://www.tryadeli.com/docs/api/messages). - **Comments.** Not exposed through the API. - **Scheduling.** `scheduled_date`, `add_to_queue`, and `async_upload` are rejected with `422 unsupported_feature`. ## Errors URL: https://www.tryadeli.com/docs/errors Markdown: https://www.tryadeli.com/docs/errors.md The error envelope, every status code the API returns, and what each error code means. # Errors > The error envelope, every status code the API returns, and what each error code means. Canonical: Every failure returns JSON in the same shape, whatever went wrong. ```json { "error": { "code": "invalid_request", "message": "accountId must be a valid UUID", "details": [{ "path": ["accountId"], "message": "Invalid uuid" }] } } ``` `code` is stable and safe to branch on. `message` is written for a human reading a log and may change. `details` is present only when there is something more to say — validation issues, or the per-account `errors` array from an aggregate read. ## Status codes | Status | When | | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `200` | Success, or an aggregate read where every provider succeeded. | | `201` | A resource was created — an Instagram post, a message, a connection session. | | `202` | A TikTok or YouTube publish, or a Facebook video, was accepted. It is not published yet; [poll for status](https://www.tryadeli.com/docs/api/posts). | | `207` | An aggregate read where some providers succeeded and some failed. | | `400` | The request is malformed: bad JSON, a failed schema check, a non-UUID identifier, or no profile named (`profile_required`). | | `402` | The workspace's plan doesn't cover it: `billing_required` when a connect doesn't fit the plan (see [Billing](https://www.tryadeli.com/docs/billing#in-the-api)), `usage_limit_reached` when the workspace has sent its plan's posts, comments or messages (see [Billing](https://www.tryadeli.com/docs/billing#usage-limits)), `plan_required` when Free reads analytics, or `x_billing_required` when Free uses X (see [X API pricing](https://www.tryadeli.com/docs/pricing/x)). | | `403` | A healthy connection lacks a permission or provider-confirmed resource the feature needs: `permission_required`. Details include exact requirements and a restart-OAuth action. | | `404` | The resource does not exist, **or** it exists but your key cannot reach it. | | `413` | The request body is too large. | | `415` | `Content-Type` is neither `application/json` nor `multipart/form-data`. | | `422` | The request is well-formed but the operation is not possible: an unsupported platform, an expired connection, invalid media, a deferred feature. | | `429` | The provider is throttling this account or app (TikTok), the account hit TikTok's daily posting limit, or YouTube's shared daily quota is spent. Retry later. | | `502` | Every attempted provider failed, or a database read failed. Provider details are sanitized away. | | `503` | X is unavailable to Adeli for a while: `temporarily_unavailable`. Retry later. | > **Note: 404 covers authorization, on purpose** > > Supplying a `profileId` or `accountId` that belongs to another organization > returns `404`, not `403`. The API will not confirm that a resource exists > outside your key's organization. A `profileId` and `accountId` that disagree > also return `404 account_not_found`, the same answer as an unknown account. ## Error codes ### Authentication and scope | Name | Type | Required | Description | | ------------------- | ----- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `unauthorized` | `401` | | The Authorization header is missing, malformed, or names a key that has been deleted. | | `profile_required` | `400` | | A profile-scoped request named no profile. Pass `profileId`, or an `accountId` that belongs to a profile. `GET` and `POST /api/v1/profiles`, `GET /api/v1/accounts`, and `GET /api/v1/usage/x` need neither. | | `profile_not_found` | `404` | | The `profileId` does not exist, or it belongs to another organization. | ### Billing | Name | Type | Required | Description | | --------------------- | ----- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `billing_required` | `402` | | Starting a connection doesn't fit the workspace's plan: on Free, a third profile, a third account on a profile, or a WhatsApp or Bluesky account; on Starter, a sixth account on a profile. `details.billingUrl` is where the workspace owner chooses or upgrades a plan. The same check runs again when the connection finishes, so a connection session started with room to spare can end `failed` with this `error.code`. See [Billing](https://www.tryadeli.com/docs/billing#in-the-api). | | `usage_limit_reached` | `402` | | The workspace has sent its plan's limit of the kind in `details.kind` (`post`, `message` or `comment`): Free's lifetime total, or Starter's monthly one. `details` also carries `limit`, `used` and `billingUrl`, and on Starter `resetsAt`. Free's limits never reset, so `resetsAt` is absent there. Don't retry: it clears once a plan is chosen or upgraded, or on Starter at `resetsAt`. See [Billing](https://www.tryadeli.com/docs/billing#usage-limits). | | `plan_required` | `402` | | Analytics need a paid plan, and the workspace is on Free. `details.billingUrl` is where the workspace owner chooses one. See [Billing](https://www.tryadeli.com/docs/billing#402-plan_required). | ### Request validation | Name | Type | Required | Description | | ------------------------ | ----------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `invalid_request` | `400 / 413` | | Malformed JSON, a schema failure, a non-UUID identifier, or a body over the size limit. Check `details`. | | `invalid_profile` | `400` | | Profile fields failed their own checks — for example `metadata` over 16 KiB. | | `invalid_redirect_uri` | `400` | | The connect `redirectUrl` is malformed, insecure, or does not exactly match a URI registered under the API key organization's **Settings → OAuth**. See [OAuth setup](https://www.tryadeli.com/docs/oauth). | | `unsupported_media_type` | `415` | | `Content-Type` must be `application/json` or `multipart/form-data`. | ### Conflicts | Name | Type | Required | Description | | ------------------------------ | ----- | -------- | ------------------------------------------------------------------------------------- | | `profile_name_conflict` | `409` | | Another profile already uses this name. `details.existingProfileId` names it. | | `profile_external_id_conflict` | `409` | | Another profile already uses this `externalId`. `details.existingProfileId` names it. | | `idempotency_conflict` | `409` | | The `Idempotency-Key` was already used with a different request body. | ### Accounts and connections | Name | Type | Required | Description | | ------------------------------ | ----- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `account_not_found` | `404` | | No connected account with that id in your key's organization, or it is not on the `profileId` you also passed. | | `connection_session_not_found` | `404` | | No connection session with that id for this profile. | | `connection_expired` | `422` | | The stored provider token has expired or was revoked. Missing feature authorization uses permission\_required instead. | | `permission_required` | `403` | | The credential is healthy but the feature lacks a permission or provider-confirmed resource. `details` names required/missing items and a `restart_oauth` action. | | `connection_unavailable` | `—` | | Appears inside an aggregate errors array when one account's credentials could not be used for that read. | | `provider_not_configured` | `422` | | This Adeli deployment has no credentials for that provider. | | `provider_not_supported` | `422` | | The provider cannot do this. WhatsApp and Google Business Profile connect sessions, and TikTok and YouTube messaging, land here. | | `invalid_handle` | `400` | | A Bluesky `handle` did not resolve to an account, when starting a connect or as a connect session's `error.code`. | | `x_billing_required` | `402` | | X is billed per call and needs a paid plan. Connecting, posting, deleting, and listing X posts all return it on Free. See [X API pricing](https://www.tryadeli.com/docs/pricing/x). | | `reconnect_required` | `409` | | Turning on an X capability needs a permission the connection was not granted. `details.missingScopes` lists them. | ### Publishing | Name | Type | Required | Description | | --------------------------- | ----- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `unsupported_platform` | `422` | | The endpoint does not serve that platform — listing posts covers Instagram, Facebook, TikTok, YouTube, X, and Bluesky, and messages are Instagram, Facebook, or WhatsApp only. | | `unsupported_feature` | `422` | | Scheduling, queueing, and background uploads are deferred. `scheduled_date`, `add_to_queue`, and `async_upload` are rejected. | | `invalid_image` | `422` | | The image is not decodable, not a supported format, or over the size limit. | | `invalid_video` | `422` | | The video is not a usable MP4, is over the size limit, or exceeds the creator's maximum duration. | | `privacy_level_unsupported` | `422` | | A TikTok video asked for a `privacy_level` other than `PUBLIC_TO_EVERYONE`. TikTok videos publish publicly; send `post_mode: "MEDIA_UPLOAD"` for a draft instead. | | `invalid_post_settings` | `422` | | The requested privacy, comment, duet, or stitch setting is not available to this creator, or branded content was requested without public visibility. | | `media_url_unverified` | `422` | | TikTok has not verified this deployment's media URL prefix, which it must before any TikTok post works. | | `upload_limit_exceeded` | `422` | | The YouTube channel has reached YouTube's own upload limit. Try again later. | | `provider_rejected` | `422` | | The provider refused the post's content or metadata, such as a YouTube category\_id that does not exist. | | `duplicate_post` | `409` | | X refused the post because the account published the same text recently. | | `invalid_media` | `422` | | An X media item is not valid base64, does not match its content\_type, is over its size limit, or X could not process it. | ### Comments | Name | Type | Required | Description | | ------------------- | ----- | -------- | ------------------------------------------------------------------------------------------------------------ | | `post_not_found` | `404` | | The `postId` is not one of this account's posts. | | `comment_not_owned` | `422` | | TikTok deletes only comments the account itself wrote. Hide other people's comments instead. | | `not_supported` | `422` | | The platform cannot do this: liking a comment outside TikTok, or `cursor` paging outside TikTok and YouTube. | ### Upstream | Name | Type | Required | Description | | ------------------------- | ----- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | `provider_error` | `502` | | The provider request failed. The upstream body is deliberately not passed through. | | `rate_limited` | `429` | | TikTok is throttling this account (40 requests a minute per endpoint) or the app, or YouTube is throttling per-second. Retry with backoff. | | `quota_exhausted` | `429` | | YouTube's daily API quota, shared by every Adeli customer, is used up. The message says when it resets, at midnight Pacific; retrying before then fails. | | `provider_unavailable` | `502` | | Every attempted provider failed for mixed reasons. `details` carries the per-account errors. | | `temporarily_unavailable` | `503` | | X is unavailable to Adeli for a while. Retry later. | | `database_error` | `502` | | Adeli could not read or write its own store. Safe to retry. | | `result_limit` | `—` | | Appears inside an aggregate `errors` array when a collection was truncated at 10,000 records, which makes the response `207`. | ## Handling errors Branch on `code`, not on `message`, and treat `207` as its own case. **JavaScript** ```javascript const response = await fetch(`${BASE}/accounts?profileId=${profileId}`, { headers }); const body = await response.json(); if (!response.ok) { switch (body.error.code) { case "unauthorized": throw new Error("Adeli key is invalid or revoked"); case "connection_expired": return promptCustomerToReconnect(); default: throw new Error(`${body.error.code}: ${body.error.message}`); } } // 200 and 207 both land here. if (body.status === "partial") { console.warn("Incomplete result", body.errors); } return body.accounts; ``` **Python** ```python response = requests.get(f"{BASE}/accounts", headers=HEADERS, params={"profileId": profile_id}) body = response.json() if not response.ok: code = body["error"]["code"] if code == "unauthorized": raise RuntimeError("Adeli key is invalid or revoked") if code == "connection_expired": return prompt_customer_to_reconnect() raise RuntimeError(f"{code}: {body['error']['message']}") # 200 and 207 both land here. if body["status"] == "partial": logging.warning("Incomplete result: %s", body["errors"]) return body["accounts"] ``` Retry `502`, `429`, and `database_error` with backoff. Do not retry `4xx` — the request will fail the same way — and be careful retrying a publish that timed out, since [there is no idempotency key](https://www.tryadeli.com/docs/concepts#idempotency-and-retries). ## `permission_required` A healthy connection can be missing authorization for one feature. That feature returns HTTP `403` and `error.code: "permission_required"`; this is different from an expired or revoked credential. `error.details` names the provider, account/profile, capability, required and missing permissions/resources, and a structured `reconnect` action with `action: "restart_oauth"`, `method: "POST"`, and the profile connect endpoint. Restart the existing OAuth flow and grant the listed access—do not build a provider scope URL yourself. Aggregate endpoints keep successful provider results and include these details in the failed account's error record. --- # SDK ## TypeScript SDK URL: https://www.tryadeli.com/docs/sdk Markdown: https://www.tryadeli.com/docs/sdk.md The server-side @adeli/sdk SDK preview, its response model, and release availability. # TypeScript SDK > The server-side @adeli/sdk SDK preview, its response model, and release availability. Canonical: `@adeli/sdk` is Adeli's server-side TypeScript SDK, [published on npm](https://www.npmjs.com/package/@adeli/sdk). It runs on Node.js 22 or later, Vercel functions, and Cloudflare Workers, and throws in browsers. Keep your API key in server configuration and never expose it in a browser bundle. The client uses `https://app.tryadeli.com` as its origin by default. Resource calls take explicit `{ path, query, body }` input and return `{ data, status, headers }`; Adeli does not rewrite provider-specific fields or hide `202`/`207` outcomes. ## Install Install version `0.2.1` or later: **npm** ```bash npm install @adeli/sdk ``` **yarn** ```bash yarn add @adeli/sdk ``` **pnpm** ```bash pnpm add @adeli/sdk ``` **bun** ```bash bun add @adeli/sdk ``` ## Make your first call `getMe()` is read-only and works before you connect anything: it says who the key belongs to and lists what is connected. Create a key in **Settings → API keys**, or copy the one on the dashboard's **Quick Start** page, then: ```ts sdk import { Adeli } from "@adeli/sdk"; // Or omit apiKey and set ADELI_API_KEY in the environment. const adeli = new Adeli({ apiKey: "rk_live_replace_on_server" }); export async function sayHello() { const { data } = await adeli.getMe(); return data.message; } ``` See [`GET /api/v1/me`](https://www.tryadeli.com/docs/api/me) for the full response. ## Profiles and resources ```ts sdk import { Adeli } from "@adeli/sdk"; const adeli = new Adeli({ apiKey: "rk_live_replace_on_server" }); export async function listProfiles() { const response = await adeli.profiles.listProfiles(); return response.data; } ``` The same client exposes operation-oriented resources such as `profiles`, `accounts`, `posts`, `comments`, `messages`, `analytics`, `ads`, and `usage`. A base URL is an origin, not an `/api/v1` path: ```ts sdk import { Adeli } from "@adeli/sdk"; const adeli = new Adeli({ apiKey: "rk_live_replace_on_server", baseURL: "http://localhost:3000", }); export async function getProfile(profileId: string) { return adeli.profiles.getProfile({ path: { profileId } }); } ``` ## Connection and publishing results Starting a connection returns an authorization URL. Send that URL to the customer's browser; the API key remains on your server. A publishing request can return accepted or partial results, so inspect the returned status and data rather than automatically retrying a write. ```ts sdk import { Adeli } from "@adeli/sdk"; const adeli = new Adeli({ apiKey: "rk_live_replace_on_server" }); export async function startInstagramConnection(profileId: string) { const { data } = await adeli.profiles.startConnection({ path: { profileId }, body: { platform: "instagram", redirectUrl: "https://client.example/adeli/callback", }, }); return data.authUrl; } ``` ## Runtimes The root `@adeli/sdk` entry needs only `fetch` and loads no Node built-in when imported. It runs on Node.js 22 or later, Vercel functions, and Cloudflare Workers. The two subpaths need more: | Import | Contents | Runs on | | -------------------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | | `@adeli/sdk` | The `Adeli` client, types, and error classes | Node.js 22+, Vercel functions, Cloudflare Workers | | `@adeli/sdk/helpers` | Polling, comment iterators, and webhook verification | The same. `verifyWebhookSignature` uses `node:crypto`, which Workers provide only with `nodejs_compat` | | `@adeli/sdk/uploads` | `fileFromPath` and `blobFromPath` | Node.js only | On Cloudflare Workers without `nodejs_compat`, pass `apiKey` explicitly, because the client can't read `ADELI_API_KEY` there. On Vercel, serve webhook routes from the default Node.js runtime rather than `runtime = "edge"`. Outside Node.js, you can still pass any `Blob` or `File` as post media. Use the [API reference](https://www.tryadeli.com/docs/api) for the wire contract behind every SDK call; the curl, JavaScript, and Python samples in the [quickstart](https://www.tryadeli.com/docs/quickstart) work alongside the SDK. See [SDK migration notes](https://www.tryadeli.com/docs/sdk-migrations) for compatibility announcements. ## SDK migration notes URL: https://www.tryadeli.com/docs/sdk-migrations Markdown: https://www.tryadeli.com/docs/sdk-migrations.md Customer-facing API and SDK compatibility notes, versions, and migration windows. # SDK migration notes > Customer-facing API and SDK compatibility notes, versions, and migration windows. Canonical: This page records customer-facing compatibility changes between the public API and `@adeli/sdk`. It contains no private rollout links or internal release details. > **Note: Current release** > > `@adeli/sdk` `0.2.1` is published on npm. Upgrading from `0.1.x` has one breaking change: see [0.2.0 — Instagram Unified Login](https://www.tryadeli.com/docs/sdk-migrations#020--instagram-unified-login) below. `0.2.1` changes only the package README. ## Unreleased — Meta full campaigns Pre-release: not yet in a published `@adeli/sdk` version. The API change ships first. **Affected operations:** `createCampaign`, `updateAdGroup`, `listAdTargeting`, `getAdInsights`, `setAdStatus`, and the new `updateCampaign`, `deleteAdGroup`, `deleteAd`, `estimateAdReach`, and `listAdInstagramAccounts`. - `createCampaign` accepts a Meta body with `objective` (budget, schedule, bid, targeting, a new or boosted creative, `validateOnly`). The Page-post boost body is unchanged. A `validateOnly` request answers `200` with `{ validateOnly: true, steps }` instead of a campaign, so code that reads `campaign` from every `200` should check `validateOnly` first. - The Meta campaign record gains `source` and `objective`, and `pagePostId` is `null` for campaigns not built from a Page post. - `updateAdGroup` and `listAdTargeting` serve Meta too, so their responses can now carry `platform: "meta_ads"` with Meta-shaped `adGroup` and `options`. Exhaustive checks over `platform` or `type` need the new values. - `getAdInsights` on Meta adds result fields to each point and accepts Meta breakdowns, whose `rows` carry the same fields. - `setAdStatus` on Meta now answers `404 object_not_found` for an object outside `adAccountId`, where it used to pass Meta's own answer through. ## Unreleased — Scheduled publications and drafts Pre-release: not yet in a published `@adeli/sdk` version. The API change ships first. **Affected operations:** `createPublication`, `getPublication`, `retryPublication`, `listPosts`, and the new `listPublications`, `updatePublication`, `publishPublication`, and `cancelPublication`. - `Publication['status']` gains `"scheduled"`, `"draft"`, and `"canceled"`. Only publications created with the new `scheduledFor` or `draft` fields ever have them, but an exhaustive `switch` over the status needs the three branches before you adopt the new types. - `createPublication` answers `201` (not `202`) for a scheduled publication or a draft. Requests without those fields still answer `202`. - `listPosts` lists posts waiting in a scheduled publication first, with `status: "scheduled"`, `scheduledFor`, and `publicationId`, and an empty `providerId`. Code that assumes every listed post is live should check `status`. ## 0.2.0 — Instagram Unified Login Released in `@adeli/sdk` `0.2.0`. The API change is live: every new Instagram connection goes through Meta's Instagram API with Unified Login. **Affected operations:** `startConnection`, `getConnection`, `listAccounts`, `listProfileAccounts`, `getAccount`, and `refreshAccounts`. **Minimum SDK:** `0.2.0`. - `authMethod` gains `"unified_login"`, the value every new Instagram connection reports. Exhaustive `switch` statements over it need a `unified_login` branch. `"instagram_login"` and `"facebook_login"` remain for accounts connected earlier, until they reconnect. - On `startConnection`, `authMethod` stays optional. The `"instagram_login"` and `"facebook_login"` values are deprecated. They are still accepted, and they run Unified Login too, so existing requests keep working. - **Breaking:** `refreshAccounts` can return `expiresAt: null` for an Instagram account connected with Unified Login, whose token does not expire. Code that parses `expiresAt` as a date must handle `null`. **Update, November 10, 2026:** new Instagram connections run Instagram Login (the default) or Facebook Login again. `"instagram_login"` and `"facebook_login"` on `startConnection` are no longer deprecated, and `409 auth_method_conflict` again refuses switching between them. `"unified_login"` stays in the type: accounts connected with it keep working and report it, and sending it starts an Instagram Login connect. No SDK upgrade is needed; keep the `unified_login` branch and the `null` handling. ```ts // Before: every refreshed account had an expiry. const expires = new Date(result.expiresAt); // After: a Unified Login Instagram token has none. const expires = result.expiresAt === null ? null : new Date(result.expiresAt); ``` There is no compatibility window for the `null`. It appears only for accounts connected or reconnected since the change. Accounts on the older logins keep returning a date until their owners reconnect. ## 0.2.0 — Node.js 22 and Cloudflare Workers `0.2.0` lowers the minimum Node.js version from 24 to 22, and supports Cloudflare Workers with `nodejs_compat`. No code change is needed. See [Runtimes](https://www.tryadeli.com/docs/sdk#runtimes) for what each entry point needs. ## Candidate contract review — not a release notice The initial SDK candidate replaces broad response placeholders with typed contracts for all 48 operations. Consumers regenerating their own types should review these areas before adopting the candidate: - Required account capability fields and nullable profile metadata are represented explicitly; do not assume missing fields and `null` are interchangeable. - Account detail and connection routes retain their profile scope. Ads operations retain required account/query scope and idempotency keys where applicable. - Accepted publishing (`202`) and partial outcomes (`207`) are successful HTTP responses, not proof that every provider action finished successfully. Inspect the returned status and per-item outcomes. - Comment and campaign deletion can return `204` with no JSON body. Do not attempt to decode an empty response. - Error responses retain the nested `error` envelope; permission/reconnection details vary and must be narrowed safely. - Generated response fixtures and validators may need updates for the concrete field, enum, and union definitions instead of accepting arbitrary objects. ### LinkedIn organization candidate The candidate adds `linkedin` to generic connection, account, and post platform unions and adds a LinkedIn request branch to `createPost`. Existing wire requests remain valid, but TypeScript consumers that use exhaustive `switch` statements over platform or connection-status unions must add a LinkedIn branch (or an explicit unknown-provider fallback) before adopting the candidate. The new post body is `{ platform: "linkedin", accountId, profileId?, commentary, image? }`, where `image` is one JPEG, PNG, or GIF as base64. LinkedIn is available on the production deployment. ### LinkedIn media and mentions candidate The candidate widens the LinkedIn `createPost` branch and adds `linkedin` to the `createMediaUploads` platform enum. Every request that was valid before stays valid. A LinkedIn post now takes at most one of `image` (now also `{ upload_id, title? }`), `images` (2–20 `{ upload_id, alt_text? }`), `video` (`{ upload_id, title? }`), or `document` (`{ upload_id, title }`), plus optional `mentions` of `{ urn, name, offset }`. Code that narrows `image` to the base64 shape, or switches exhaustively over the media-upload platform enum, must handle the new members. A video request can now fail with `503 processing_timeout` when LinkedIn has not finished processing it; no post is created in that case. ## How future entries are structured Each released change will name the affected operation IDs, API availability and deprecation dates, the minimum SDK version, and a before/after migration example. Breaking API changes will include a compatibility window or staged rollout; an SDK major version alone does not protect existing HTTP API clients. For example, a future entry will state the actual values rather than placeholders: | Field | Release entry will include | | ------------------- | --------------------------------------------------------------------- | | Affected operations | Exact `operationId` names and public routes | | Minimum SDK | Published `@adeli/sdk` version | | API timing | Availability date and any deprecation date | | Migration | A before/after request or SDK call that compiles against that release | See the [TypeScript SDK page](https://www.tryadeli.com/docs/sdk) to install it, and the [API reference](https://www.tryadeli.com/docs/api) for the wire contract. ## Chat SDK adapter URL: https://www.tryadeli.com/docs/chat-sdk Markdown: https://www.tryadeli.com/docs/chat-sdk.md Build a Chat SDK bot that answers Instagram, Facebook and WhatsApp DMs and Instagram and TikTok comments with @adeli/chat-sdk-adapter. # Build a Chat SDK bot on Instagram, Facebook, WhatsApp and TikTok > Build a Chat SDK bot that answers Instagram, Facebook and WhatsApp DMs and Instagram and TikTok comments with @adeli/chat-sdk-adapter. Canonical: `@adeli/chat-sdk-adapter` is Adeli's adapter for [Chat SDK](https://chat-sdk.dev/docs). One bot, with one Adeli API key, answers **Instagram, Facebook and WhatsApp DMs**, and **Instagram and TikTok comments**. On Instagram DMs, cards can also carry up to three tappable buttons. Your users connect their accounts in the Adeli dashboard. Your bot never needs its own Meta app, App Review, or TikTok developer access. The adapter calls the same public [REST API](https://www.tryadeli.com/docs/api) and receives the same signed [webhooks](https://www.tryadeli.com/docs/api/webhooks) documented here. The source and the package README are at [github.com/kingscrosslabs/adeli-chat-sdk-adapter](https://github.com/kingscrosslabs/adeli-chat-sdk-adapter/tree/v1.0.2). ## Install ```bash npm install chat @adeli/chat-sdk-adapter ``` The quick start below keeps Chat SDK state in memory, which also needs `npm install @chat-adapter/state-memory`. In production, use a persistent state adapter such as `@chat-adapter/redis`. ## Set up Adeli 1. **Create an API key.** Sign in at [app.tryadeli.com](https://app.tryadeli.com), open [Settings → API keys](https://app.tryadeli.com/settings/api-keys), create a key, and set it as `ADELI_API_KEY`. See [Authentication](https://www.tryadeli.com/docs/authentication). 2. **Connect accounts.** On the **Accounts** page, connect the Instagram, Facebook Page, WhatsApp Business or TikTok accounts the bot should answer for. Each connected account is one Chat SDK channel, `adeli:`. 3. **Deploy the webhook route** from the [quick start](https://www.tryadeli.com/docs/chat-sdk#quick-start), for example at `https://bot.example.com/api/webhooks/adeli`. It must be `https`. 4. **Register the webhook** for `message.created`, `message.postback` and `comment.created`. In the dashboard, open **Webhooks**, click **Add webhook**, and enter the URL. Or call [Create webhook](https://www.tryadeli.com/docs/api/webhooks/create-webhook): **cURL** ```bash curl https://app.tryadeli.com/api/v1/webhooks \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "profileId": "", "url": "https://bot.example.com/api/webhooks/adeli", "events": ["message.created", "message.postback", "comment.created"] }' ``` **TypeScript SDK** ```ts import { Adeli } from "@adeli/sdk"; const adeli = new Adeli({ apiKey: "rk_live_replace_on_server" }); export async function registerBotWebhook(profileId: string) { const { data } = await adeli.webhooks.createWebhook({ body: { profileId, url: "https://bot.example.com/api/webhooks/adeli", events: ["message.created", "message.postback", "comment.created"], }, }); return data.secret; // shown once } ``` Replace `` with your profile id from [List profiles](https://www.tryadeli.com/docs/api/profiles/list-profiles). 5. **Store the signing secret** the response returns as `ADELI_WEBHOOK_SECRET`. It is shown only once. To rotate it, delete the webhook and create it again. 6. **Send a test event** from the webhook's row in the dashboard. Test events (`"test": true`) are verified and acknowledged without reaching your handlers. Every delivery is signed with `Adeli-Signature` (HMAC-SHA256 with a timestamp). The adapter rejects unsigned, mis-signed and stale (over 300 seconds) deliveries with `401`, answers `200` at once, and runs your handlers in `waitUntil`. Adeli [retries failed deliveries](https://www.tryadeli.com/docs/api/webhooks#delivery-and-retries) for about nine hours with the same event id. Chat SDK drops redelivered messages and comments that arrive within its dedupe window (`dedupeTtlMs`, 10 minutes by default); button taps (`message.postback`) are not deduplicated. ## Quick start A Next.js App Router bot that answers every new DM and top-level comment: ```ts // lib/bot.ts import { Chat } from "chat"; import { createMemoryState } from "@chat-adapter/state-memory"; import { createAdeliAdapter } from "@adeli/chat-sdk-adapter"; const bot = new Chat({ userName: "shopbot", adapters: { adeli: createAdeliAdapter({ apiKey: process.env.ADELI_API_KEY!, webhookSecret: process.env.ADELI_WEBHOOK_SECRET!, }), }, state: createMemoryState(), }); export { bot }; // A new DM, or a new top-level comment on one of the account's posts. bot.onNewMention(async (thread, message) => { await thread.subscribe(); await thread.post(`Thanks for reaching out! You said: ${message.text}`); }); // Later messages in a DM, or replies under the same comment. bot.onSubscribedMessage(async (thread, message) => { await thread.post("Got it. A teammate will follow up shortly."); }); ``` ```ts // app/api/webhooks/adeli/route.ts (Next.js App Router) import { after } from "next/server"; import { bot } from "@/lib/bot"; export async function POST(request: Request) { return bot.webhooks.adeli(request, { waitUntil: (task) => after(() => task) }); } ``` `createAdeliAdapter(config?)` falls back to environment variables for every field you leave out, so `createAdeliAdapter()` with `ADELI_API_KEY` and `ADELI_WEBHOOK_SECRET` set works too. A missing required value throws `ValidationError` naming both the field and the variable. ### Environment variables | Variable | Required | Description | | ---------------------- | -------- | -------------------------------------------------------------------------------- | | `ADELI_API_KEY` | Yes | Adeli API key (`rk_live_…`), from **Settings → API keys** in the Adeli dashboard | | `ADELI_WEBHOOK_SECRET` | Yes | Signing secret of the Adeli webhook that delivers to your bot (`whsec_…`) | | `ADELI_PROFILE_ID` | No | Adeli profile id. Only needed when the key can reach more than one profile | | `ADELI_BASE_URL` | No | Adeli API origin. Defaults to `https://app.tryadeli.com` | ### Configuration | Option | Type | Default | Description | | ------------------------- | ------------------------------------------- | ------------------------------------------------- | ------------------------------------------------------------------------ | | `apiKey` | `string \| () => string \| Promise` | `ADELI_API_KEY` | Adeli API key, or a function returning it. Resolved per request | | `webhookSecret` | `string \| () => string \| Promise` | `ADELI_WEBHOOK_SECRET` | Webhook signing secret, or a function returning it. Resolved per webhook | | `profileId` | `string` | `ADELI_PROFILE_ID` | Profile id sent with API calls. Also scopes Chat SDK locks and dedupe | | `baseURL` | `string` | `ADELI_BASE_URL`, then `https://app.tryadeli.com` | Adeli API origin | | `userName` | `string` | `"adeli-bot"` | Bot display name | | `webhookToleranceSeconds` | `number` | `300` | Maximum age of a webhook's signed timestamp | | `fetch` | `typeof fetch` | `globalThis.fetch` | `fetch` implementation for API calls | | `logger` | `Logger` | The `Chat` instance's logger | Custom logger | ### Rotating credentials `apiKey` and `webhookSecret` each accept a function instead of a string. The adapter calls `apiKey` before every API request and `webhookSecret` on every webhook, and never caches the result: ```ts createAdeliAdapter({ apiKey: async () => (await secrets.get("adeli-api-key")).value, webhookSecret: () => process.env.ADELI_WEBHOOK_SECRET!, }); ``` ## Threads The adapter's name is `adeli`. Each connected account is one channel, `adeli:`, and every thread belongs to one of two kinds: - **A DM thread** is one conversation between a connected account and one person on Instagram, Facebook or WhatsApp. It is keyed by the account and the message's [`conversationKey`](https://www.tryadeli.com/docs/api/messages/list-messages), `:`: the person's Instagram-scoped id, Facebook page-scoped id, or WhatsApp `wa_id`. - **A comment thread** is a top-level comment on an Instagram post or TikTok video, and its replies. It is keyed by the account, the post and the top-level comment. Unless you register `onDirectMessage`, every inbound DM reaches `onNewMention`, as does every new top-level comment. Replies under a comment reach `onSubscribedMessage` once the thread is subscribed. A post to a comment thread is a reply under its top-level comment. The bot's own sends never come back as messages: Adeli does not emit echoes. `message.id` is the provider's id (an Instagram `mid`, a WhatsApp `wamid`, a comment id). `message.raw` is an `AdeliRawMessage`: `kind`, `accountId`, `platform`, the provider message or comment id, and the sender. `fetchMessages` reads a DM's history from [`GET /api/v1/messages`](https://www.tryadeli.com/docs/api/messages/list-messages) by conversation, and a comment thread's from [`GET /api/v1/comments`](https://www.tryadeli.com/docs/api/comments/list-comments). ### Starting a DM `openDM` takes `":"` for an Instagram user, or `"::"` for any DM platform. It makes no network call; the first post sends the message: ```ts const adeli = bot.getAdapter("adeli"); const threadId = await adeli.openDM(`${accountId}:whatsapp:15555550123`); await bot.thread(threadId).post("Your order has shipped."); ``` ### Buttons (Instagram) On Instagram DMs, a card's ` View order , ); }); bot.onAction("track", async (event) => { await event.thread?.post(`Tracking ${event.value} for you.`); }); ``` On Facebook, WhatsApp and comment threads, cards are sent as plain text, with each link button written as `label: url`. ## Features | Feature | Instagram DM | Facebook DM | WhatsApp DM | Instagram comments | TikTok comments | | -------------------------------------------------------- | :-------------------: | :-----------: | :-----------: | :----------------: | :---------------: | | Receive messages (`onNewMention`, `onSubscribedMessage`) | Yes | Yes | Yes | Yes | Yes | | Post messages and replies | Yes | Yes | Yes | Yes | Yes | | Buttons and link buttons (`onAction`) | Yes, up to 3 | Text fallback | Text fallback | Text fallback | Text fallback | | Streaming | Buffered, posted once | Buffered | Buffered | Buffered | Buffered | | Fetch history (`fetchMessages`) | Yes | Yes | Yes | Yes | Yes | | Delete a sent message | No | No | No | Yes, own comments | Yes, own comments | | `openDM` | Yes | Yes | Yes | n/a | n/a | | Inbound attachments | Yes | Yes | Yes | n/a | n/a | All five surfaces show plain text. Markdown is flattened: emphasis markers are dropped, links become `text (url)`, list items start with `- `. ## Limitations - **The 24-hour window.** Instagram, Facebook and WhatsApp accept free-text messages only within 24 hours of the person's last message. Outside it, a post throws `AdapterError` with code `window_closed`. To open a WhatsApp conversation, send an approved template with `@adeli/sdk` `messages.sendMessage({ body: { platform: "whatsapp", template } })` ([Send message](https://www.tryadeli.com/docs/api/messages/send-message)); Chat SDK messages cannot carry templates. - **No edits, reactions or typing indicators.** `editMessage`, `addReaction` and `removeReaction` throw `NotImplementedError`. `startTyping` resolves without doing anything, so portable bots keep working. `deleteMessage` works only on the account's own comments. - **Some accounts need reconnecting.** Instagram accounts connected through a Facebook Page, and TikTok accounts connected without comment access, send no comment events until connected with that access in the dashboard. - **Instagram allows three buttons.** A card with more throws `ValidationError`. A button's `id` and `value` must fit Instagram's 1,000-character postback payload. - **No outbound files.** Posting files or attachments throws `ValidationError`. - **History reads backward.** `fetchMessages` with `direction: "forward"` on a DM reads up to 1,000 messages and returns them in one page. - **Usage limits.** Every bot reply counts as a message or comment in [`GET /api/v1/usage`](https://www.tryadeli.com/docs/api/usage/get-usage). A workspace that has used its plan's sends gets `AdapterRateLimitError`, with `retryAfter` set to the reset time on Starter. Provider rate limits (`429`) map to the same error. - **Errors.** `401` maps to `AuthenticationError`, `403` to `PermissionError` (for `permission_required`, reconnect the account with the missing permission), `404` to `ResourceNotFoundError`, `400`/`422` to `ValidationError`, and `5xx` or network failures to `NetworkError`, all from `@chat-adapter/shared`. --- # Postman ## Postman collection URL: https://www.tryadeli.com/docs/postman Markdown: https://www.tryadeli.com/docs/postman.md Fork the Adeli Postman collection, set your API key, and publish a first post without writing code. # Postman collection > Fork the Adeli Postman collection, set your API key, and publish a first post without writing code. Canonical: Adeli publishes a Postman collection with every `/api/v1` request, a guided folder that publishes your first post, and an environment that holds your API key. It is the quickest way to try the API without writing code. The collection lives in the public [Adeli API workspace](https://www.postman.com/try-adeli/adeli-api) on Postman. It is generated from the same [OpenAPI document](https://www.tryadeli.com/docs/openapi.json) the API is described by, so every request body is a valid example rather than a schema placeholder. ## Fork the collection [![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/58072869-ed9713ee-2806-494c-98ab-9e30ade77186?action=collection%2Ffork\&source=rip_markdown\&collection-url=entityId%3D58072869-ed9713ee-2806-494c-98ab-9e30ade77186%26entityType%3Dcollection%26workspaceId%3De93bccf3-1ae6-4ad3-bf6c-3b495a1b35b7) 1. Select **Run in Postman** above and fork the collection into a personal or team workspace you control. Or open the [Adeli API workspace](https://www.postman.com/try-adeli/adeli-api) and select **Fork** on the **Adeli API** collection. 2. In the workspace, fork the **Adeli** environment too. 3. In your workspace, select the **Adeli** environment in the top-right environment picker. Forking, rather than importing a copy, lets you pull updates when the API changes. See [Staying current](https://www.tryadeli.com/docs/postman#staying-current). ## Set your API key Create a key in the dashboard under [Settings → API keys](https://app.tryadeli.com/settings/api-keys). It starts with `rk_live_`. Paste it into the environment's `apiKey` value. Every request inherits `Authorization: Bearer {{apiKey}}` from the collection, so there is nothing to set per request. The environment's `baseUrl` is `https://app.tryadeli.com`; change it to `http://localhost:3000` if you run Adeli locally. > **Warning: Keep the key out of public workspaces** > > `apiKey` is a secret variable, so Postman masks it on screen. Put the key in > its **current value**, which stays on your machine, and leave the initial > value empty, because initial values are shared with anyone who can see the > workspace. Never paste the key into the collection or a request. If one > leaks, delete it under Settings → API keys; revocation is immediate. ## Start here: publish your first post The first folder, **Start here: publish your first post**, publishes one image to an Instagram account connected to your organization. Run its requests in order: each one saves the ids the next one needs into collection variables. Before you start, set two collection variables to describe the image you will upload: `uploadContentType` (`image/jpeg`, `image/png`, or `image/webp`) and `uploadFileSize`, the file's exact size in bytes. S3 checks the size, so it must match the file. | Request | What it does | Saves | | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | | 1. Check your API key | `GET /api/v1/me` confirms the key works and names your default profile. | `profileId` | | 2. Find a connected Instagram account | `GET /api/v1/accounts?platform=instagram` lists the accounts you can publish from. | `accountId`, `profileId` | | 3. Prepare the upload | `POST /api/v1/media/uploads` returns a short-lived S3 upload URL and the headers it needs. | `uploadId`, `uploadUrl`, `uploadHeaders` | | 4. Upload the file to S3 | `PUT {{uploadUrl}}` sends your image straight to S3. Choose the file under **Body → binary**. | — | | 5. Publish the post | `POST /api/v1/posts` publishes the staged image with a caption. | `jobId` | | 6. Check the post's status | `GET /api/v1/posts/instagram/status` reports `queued`, `processing`, `published`, or `failed`. Send it again until the post is `published`. | `postId` | > **Warning: Step 5 posts for real** > > There is no sandbox mode. The post goes live on the account step 2 found, so > use an account you do not mind posting to, and delete the post on Instagram > afterwards if it was only a test. No account connected yet? Connect one in the dashboard, or send **Profiles → Start connecting a social account** and open the `authUrl` it returns. See [the connect reference](https://www.tryadeli.com/docs/api/connect). ## Variables Requests in the other folders use the same collection variables, so an id one request saves is ready for the next. Ids nothing saves for you are left blank for you to fill. | Variable | Set by | | ----------------------------------------------------- | --------------------------------------------------------------- | | `profileId` | 1. Check your API key, or 2. Find a connected Instagram account | | `accountId` | 2. Find a connected Instagram account | | `secondAccountId` | You, for a publication to two accounts | | `uploadId`, `uploadUrl`, `uploadHeaders` | Prepare direct media uploads | | `uploadContentType`, `uploadFileSize` | You, before preparing an upload | | `thumbnailUploadId` | You, for a YouTube thumbnail | | `jobId` | Publish a post, for an Instagram post | | `postId` | Check an Instagram post's publishing status | | `connectionSessionId` | Start connecting a social account | | `publicationId` | Publish one post to several accounts | | `webhookId` | Create a webhook | | `commentId`, `adAccountId`, `campaignId`, `adGroupId` | You, from a list request | Optional query parameters start switched off. Tick one in the **Params** tab to send it. ## Uploading media Every request that publishes media takes a staged `upload_id`, never the file itself. Prepare the upload, `PUT` the file to the returned `url` with the returned headers sent unchanged, then publish with `upload_id`. The **Prepare direct media uploads** request saves the `uploadId` that the **Publish a post** requests use. See [media uploads](https://www.tryadeli.com/docs/api/posts/create-media-uploads) for the limits per platform. **Publish a post** has one request per network, named after it: Instagram image or Reel, Facebook photo, TikTok video, YouTube video, X, Bluesky, and LinkedIn image or document. The **TikTok video (multipart, legacy)** request uploads the file in the request itself and stays only for compatibility. ## Staying current The collection is regenerated from `/docs/openapi.json` and republished whenever the API changes. In your fork, open the collection's **…** menu and select **Pull changes** to bring in new and changed requests. Local edits to a request you also change in the fork can conflict; Postman shows both versions and lets you choose. ## Troubleshooting | Response | Cause | | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | `401 unauthorized` | `apiKey` is empty, or the **Adeli** environment is not selected. | | `403 permission_required` | The connected account has not granted a permission this request needs. The error names it; reconnect the account to grant it. | | `402 usage_limit_reached` | The workspace sent its plan's posts, comments or messages. See [Billing](https://www.tryadeli.com/docs/billing). | | `403` from S3 in step 4 | A header from step 3 was changed or left out, or the upload URL expired. Send step 3 again. | | `422 invalid_media` | The file does not match `uploadContentType` or `uploadFileSize`, or exceeds the platform's limit. | Every error has the same JSON envelope. See [Errors](https://www.tryadeli.com/docs/errors). --- # Pricing and billing ## Pricing URL: https://www.tryadeli.com/docs/pricing Markdown: https://www.tryadeli.com/docs/pricing.md What Adeli costs: Free, Starter, Business and Enterprise plans, monthly or annual, with worked examples. # Pricing > What Adeli costs: Free, Starter, Business and Enterprise plans, monthly or annual, with worked examples. Canonical: Adeli has four plans: Free, Starter, Business and Enterprise. Each plan includes a number of profiles. A profile is one of your users, and Starter and Business add more at a fixed price per profile. To compare the plans side by side, see the [pricing page](https://tryadeli.com/pricing). ## The plans | | Free | Starter | Business | Enterprise | | ----------------------- | --------------------- | ------------------------- | ---------------------------- | -------------- | | Monthly billing | $0 | $29 a month | $149 a month | Custom | | Annual billing | $0 | $300 a year ($25 a month) | $1,500 a year ($125 a month) | Custom | | Profiles included | 2 | 10 | 100 | Custom | | Each extra profile | Choose a plan | $2.50 a month | $1.50 a month | Custom | | Accounts per profile | 2 | 5 | Every platform | Every platform | | Posts | 10 in total | 10,000 a month | Unlimited | Unlimited | | Comments sent | 100 in total | 10,000 a month | Unlimited | Unlimited | | Messages sent | 100 in total | 10,000 a month | Unlimited | Unlimited | | Analytics | — | Included | Included | Included | | X, WhatsApp and Bluesky | — | Included | Included | Included | | Support | Email and in-app chat | Email and in-app chat | Priority | Priority | Every plan includes publishing, scheduling, comments, messaging, ads, the REST API, the TypeScript SDK, the MCP server, webhooks and unlimited team members. Reading posts, comments and messages never counts toward a limit. Prices are in US dollars and exclude sales tax. See [Billing](https://www.tryadeli.com/docs/billing#tax). ## What counts as a profile A profile is one of your users: one of your customers, clients, or brands. Each profile connects its own social accounts, one per platform: one Instagram account, one Facebook Page, one TikTok account, one YouTube channel, one WhatsApp number, one X account, and one Bluesky account. See [Profiles, accounts and billing](https://www.tryadeli.com/docs/concepts#profiles-accounts-and-billing). A profile counts for each day it has at least one connected account. Empty profiles, and profiles whose accounts all need reconnecting, don't count. ## Extra profiles Past the profiles your plan includes, each extra profile costs $2.50 a month on Starter and $1.50 a month on Business. Extra profiles are billed monthly on both monthly and annual plans, by the day: a profile active for 10 days of a 30-day month costs a third of the monthly price. See [Billing](https://www.tryadeli.com/docs/billing#profiles-active-for-part-of-a-month). Business has no profile ceiling. It keeps billing $1.50 per profile at any size, so you never have to talk to us to grow. ## The free tier Free is for building and testing, with no card. It includes 2 profiles with up to 2 accounts each, on every platform except X, WhatsApp and Bluesky, and a total of: - **10 posts.** A publication to several accounts counts once per account. - **100 comments.** Comments and comment replies Adeli posts for you. - **100 messages.** Direct messages and Instagram private replies you send. These are lifetime totals, not monthly ones: they don't reset. Sends that fail don't count. Edits, deletes, hiding comments and reading never count. At a limit, sends of that kind return [`402 usage_limit_reached`](https://www.tryadeli.com/docs/billing#usage-limits) until you choose a plan. [`GET /api/v1/usage`](https://www.tryadeli.com/docs/api/usage/get-usage) shows where the workspace stands. Analytics need a paid plan. On Free, analytics reads return [`402 plan_required`](https://www.tryadeli.com/docs/billing#402-plan_required). ## Starter's monthly limits Starter includes 10,000 posts, 10,000 comments and 10,000 messages a month, shared by all the workspace's profiles. The counts reset at midnight UTC on the 1st of each month. What counts is the same as on Free. Business has no send limits. ## When to choose Business Business includes 100 profiles, every platform on each, and no send limits. Starter plus its extra profiles costs as much as Business at 58 profiles on monthly billing ($29 + 48 × $2.50 = $149), and at 50 on annual billing ($25 + 40 × $2.50 = $125). From there, Business costs less. ## Worked examples These assume every profile is active for the whole month, on the cheaper plan for that count. | Profiles | Plan | Monthly billing | Annual billing, per month | | -------- | -------- | ----------------------------- | ----------------------------- | | 5 | Starter | **$29** | **$25** | | 25 | Starter | $29 + 15 × $2.50 = **$66.50** | $25 + 15 × $2.50 = **$62.50** | | 58 | Business | **$149** | **$125** | | 250 | Business | $149 + 150 × $1.50 = **$374** | $125 + 150 × $1.50 = **$350** | At 58 profiles on monthly billing, Starter costs the same $149. ## Annual billing Choose annual billing at checkout, or switch to it from the Billing page. You pay for the year up front: $300 for Starter and $1,500 for Business, about 2 months free. Extra profiles are still billed monthly, at the same rate. ## Enterprise Enterprise is for custom volume rates, annual invoicing and priority support. It's never required: Business keeps applying at any size. Email [hello@tryadeli.com](mailto:hello@tryadeli.com?subject=Adeli%20enterprise) to talk to us. > **Note: X API usage is passed through** > > X needs a paid plan, and X charges for each API call. Adeli passes those > calls on at X's own prices, with no markup. See > [X API pricing](https://www.tryadeli.com/docs/pricing/x). An X account is one of the profile's > social accounts like any other; only its API usage is billed. ## X API pricing URL: https://www.tryadeli.com/docs/pricing/x Markdown: https://www.tryadeli.com/docs/pricing/x.md What X API calls cost, passed through at X's prices with no markup, and the endpoint that reports this month's total. # X API pricing > What X API calls cost, passed through at X's prices with no markup, and the endpoint that reports this month's total. Canonical: X bills its API per call. Every X account connects through Adeli's one X app, so Adeli pays X for each call and passes the cost on to you **at X's published prices, with no markup**. Adeli records each call against your account as it happens, and the endpoint below reports the running total. The other providers do not bill per call, so this page covers X only. An X account itself is included in the profile like any other platform; only its API usage is billed. > **Warning: X needs a paid plan** > > X is available on Starter and Business. On [Free](https://www.tryadeli.com/docs/pricing#the-free-tier), > connecting an X account returns `402 x_billing_required`, and so does every > call that would cost money. Choose a plan on the dashboard's Billing page. ## How you're charged X usage is charged on the same invoices as your plan, as an "X API usage" line, and it counts toward the same [charge thresholds](https://www.tryadeli.com/docs/billing#when-your-card-is-charged) as extra profiles: $6 of X usage and $4 of extra profiles reach the first $10 charge together. Invoices round the line to the cent. Usage from before you chose a plan is never charged. The dashboard's Billing page shows this month's X usage to a tenth of a cent, straight from our records. It reaches the upcoming invoice within a few minutes. ## What costs money Adeli records a call only when X accepts it, so a request X rejects is free. | Name | Type | Required | Description | | ----------------- | -------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- | | `post.create` | `$0.015` | | Publishing a post, or each post in a thread. | | `post.create_url` | `$0.200` | | Publishing a post whose text contains a link, including a bare domain such as example.com. | | `post.delete` | `$0.010` | | Deleting a post. | | `post.read_owned` | `$0.001` | | Each post returned when you list an X account's posts. Listing posts includes X only when you ask for `platform=x` or an X `accountId`. | | `user.read_owned` | `$0.001` | | Reading the account's profile, which happens once when it connects. | | `media.upload` | `$0.000` | | Uploading an image or video. X does not list a price; it is recorded so totals can be checked against X's own. | If the same resource is read twice in one UTC day, X charges once, and so does Adeli. Prices are those on X's pricing page on the date in `ratesAsOf`. ## `GET /api/v1/usage/x` — Get X usage Returns your organization's X usage for the current UTC calendar month, across every profile and account. Costs are integers in millionths of a dollar, so they add up exactly: `230000` is $0.23. ```bash curl "$ADELI_URL/api/v1/usage/x" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` ```json { "from": "2026-10-01T00:00:00.000Z", "to": "2026-11-01T00:00:00.000Z", "ratesAsOf": "2026-10-06", "totalCostMicros": 230000, "operations": [ { "operation": "post.create", "resourceType": "post", "resourceCount": 2, "costMicros": 30000 }, { "operation": "post.create_url", "resourceType": "post", "resourceCount": 1, "costMicros": 200000 } ] } ``` **Errors** — `401 unauthorized`, `502 database_error`. ## Billing URL: https://www.tryadeli.com/docs/billing Markdown: https://www.tryadeli.com/docs/billing.md Choosing and changing plans, usage limits, extra profiles active for part of a month, when your card is charged, and the 402s the API returns. # Billing > Choosing and changing plans, usage limits, extra profiles active for part of a month, when your card is charged, and the 402s the API returns. Canonical: What you're charged, and when. For the plans and prices, see [Pricing](https://www.tryadeli.com/docs/pricing). ## Choosing a plan Every workspace starts on Free: 2 profiles with up to 2 connected accounts each, and no card. To go past Free, choose Starter or Business, monthly or annual, through Stripe Checkout. In the dashboard, any action that needs a plan opens a short "Choose a plan" dialog. In the API, it returns a [`402`](https://www.tryadeli.com/docs/billing#in-the-api) with a link to the Billing page. ## Changing plans Upgrade, downgrade, or switch between monthly and annual billing from the dashboard's Billing page. Limits change at once. The plan fee is prorated: an upgrade charges the difference for the rest of the period, and a downgrade credits it to your next invoice. Workspaces that started paying before these plans keep their per-account price until they choose a plan on the Billing page. ## Usage limits Free and Starter limit how many posts, comments and messages the workspace sends, shared by all its profiles: | | Free | Starter | Business | | -------- | ------------ | -------------- | --------- | | Posts | 10 in total | 10,000 a month | Unlimited | | Comments | 100 in total | 10,000 a month | Unlimited | | Messages | 100 in total | 10,000 a month | Unlimited | Free's limits are lifetime totals and never reset. Starter's reset at midnight UTC on the 1st of each month. [Pricing](https://www.tryadeli.com/docs/pricing#the-free-tier) lists what counts. Once the workspace reaches a limit, sends of that kind are refused with `402 usage_limit_reached`. On Free: ```json { "error": { "code": "usage_limit_reached", "message": "This workspace has sent 10 of 10 free posts. Choose a plan to keep posting.", "details": { "kind": "post", "limit": 10, "used": 10, "billingUrl": "https://app.tryadeli.com/settings/billing?reason=usage_limit&kind=post" } } } ``` On Starter, the message is "Upgrade to Business for unlimited sends", and `details.resetsAt` says when the count resets: ```json { "error": { "code": "usage_limit_reached", "message": "This workspace has sent 10,000 of 10,000 posts this month. Upgrade to Business for unlimited sends.", "details": { "kind": "post", "limit": 10000, "used": 10000, "resetsAt": "2026-12-01T00:00:00.000Z", "billingUrl": "https://app.tryadeli.com/settings/billing?reason=usage_limit&kind=post" } } } ``` Don't retry it: on Free it clears once you choose a plan, and on Starter at `resetsAt` or once you upgrade. `POST /api/v1/publications` checks every target before accepting the publication, so a publication that can't fit is refused whole, before anything is posted. Check the workspace's counts with [`GET /api/v1/usage`](https://www.tryadeli.com/docs/api/usage/get-usage), or on the dashboard's Billing page. ## Profiles active for part of a month Extra profiles are billed for the days they're active, meaning they have at least one connected account. A full month counts as one profile, half a month as half. A profile costs the same for a day whether it has one connected account or seven. **Example.** On Starter, which includes 10 profiles, you have 10 profiles active all of a 30-day month, and an 11th for one week (7 days): | | Counts as | | ----------------------- | --------------------------------- | | 10 profiles, all month | 10 profiles, included in the plan | | 1 profile, 7 of 30 days | 0.23 of an extra profile | The extra profile costs 0.23 × $2.50 = **$0.58** on top of the plan fee. A profile's charge starts the day its first account connects and stops the day after its last account disconnects. Connecting a second account on the same profile, or reconnecting one on the same day, isn't charged again. ## When your card is charged The plan fee is charged at the start of each billing period: monthly, or once a year on annual billing. Extra profiles and X API usage are charged as you go, in small amounts rather than one large bill at the end of the month: 1. The first charge happens when this month's unbilled usage reaches $10. 2. After each successful charge, the next one waits for twice as much: $20, then $40, $80 and $160, up to $200 at a time. 3. Whatever is left at the end of the month is charged on the 1st. The charge step carries over from month to month, so an established workspace gets fewer, larger charges. Every charge has an invoice on the dashboard's Billing page. ## X API usage X needs a paid plan. X charges per API call, and we pass that on at X's prices: see [X API pricing](https://www.tryadeli.com/docs/pricing/x). It appears on the same invoices as an "X API usage" line, and counts toward the same charges above, so X usage and extra profiles together reach $10, then $20, and so on. ## Failed payments If a charge fails, Stripe retries your card for about two weeks, and everything keeps working in the meantime. The dashboard's Billing page shows a warning so you can add a working card. If every retry fails, you can't connect more accounts until the balance is paid. The accounts you already have keep working. The next charge step starts again at $10. ## Cancelling Cancel your plan from the Billing page. It stays active until the end of the period you've paid for, and then the workspace returns to Free's limits. We charge any extra profiles and X usage not yet billed. ## Tax Prices exclude tax. Where we have to collect sales tax, VAT, or GST, we add it to each charge based on your billing address. A business can add its VAT or GST number in its billing details, and where reverse charge applies, we don't add VAT. ## Managing billing The dashboard's Billing page shows: - your plan and billing period, its limits, and this period's posts, comments and messages against them - your upcoming invoice, the next charge threshold, and what you've paid this month - your billing email, business name, name, address, and tax ID, which you can edit. Changes apply to future invoices. - your cards. You can keep up to five and choose the default. - your invoices, each with a link to view it or download the PDF You enter card details on Stripe's pages, so Adeli never sees or stores them. ## In the API Billing affects the API in four places, each a `402` with a `details.billingUrl` that links to the dashboard's Billing page. The workspace owner chooses or changes the plan there, and that's you, not your end customer. Existing accounts keep working even if a payment fails. ### `402 billing_required` Starting a connection with [`POST /api/v1/profiles/{profileId}/connect`](https://www.tryadeli.com/docs/api/connect/start-connection) returns `402` when the new account doesn't fit the workspace's plan: - **Free:** a third profile would become active. Profiles are counted for your API key's organization. The message is "Your first 2 profiles are free. Choose a plan to connect accounts on more profiles." - **Free:** a third account on a profile. The message is "Free profiles connect up to 2 accounts. Choose a plan to connect more." - **Free:** a WhatsApp or Bluesky account. The message is "WhatsApp and Bluesky need a paid plan." - **Starter:** a sixth account on a profile. The message is "Starter profiles connect up to 5 accounts. Upgrade to Business to connect every platform." Business never returns it. Starter never refuses a new profile, because extra profiles are billed. The `402` comes back before any `authUrl` exists, so your customer never goes through a provider's consent screen for nothing. The same check runs again when the connection finishes. A session you started while the workspace still had room can end `failed` with `error.code = "billing_required"` if other connects used up the room before your customer approved it. Their browser returns to your `redirectUrl` with `status=failed`, no account is created, and [polling the session](https://www.tryadeli.com/docs/api/connect/get-connection-session) shows the code. For Facebook, the check runs when the Page is chosen, because that is when the account is created. Choose or upgrade a plan, then start a new connection. ```json { "error": { "code": "billing_required", "message": "Starter profiles connect up to 5 accounts. Upgrade to Business to connect every platform.", "details": { "billingUrl": "https://app.tryadeli.com/settings/billing?reason=plan_limit&provider=youtube" } } } ``` Reconnecting or replacing an account that a profile already has connected never returns `402`, because it does not add an account. ### `402 usage_limit_reached` The workspace has sent its plan's posts, comments or messages. See [Usage limits](https://www.tryadeli.com/docs/billing#usage-limits). ### `402 plan_required` Analytics need a paid plan. On Free, every analytics read, through the [analytics endpoints](https://www.tryadeli.com/docs/api/analytics) or the MCP analytics tools, returns: ```json { "error": { "code": "plan_required", "message": "Analytics need a paid plan. Choose a plan to read analytics.", "details": { "billingUrl": "https://app.tryadeli.com/settings/billing?reason=plan_limit" } } } ``` ### `402 x_billing_required` X charges per API call and needs a paid plan. Connecting, posting, deleting, and listing X posts return it on Free. See [X API pricing](https://www.tryadeli.com/docs/pricing/x). ### Handling it Check `error.code`, not only the status: **JavaScript** ```javascript const response = await fetch(`${ADELI_URL}/api/v1/profiles/${profileId}/connect`, { method: "POST", headers: { Authorization: `Bearer ${ADELI_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ platform: "instagram", redirectUrl }), }); if (response.status === 402) { const { error } = await response.json(); if (error.code === "billing_required") { // Tell your team (the Adeli workspace owner) to choose or upgrade a plan. notifyBillingOwner(error.details.billingUrl); return showMessage("Connecting more accounts is temporarily unavailable."); } } ``` **cURL** ```bash curl -i -X POST "$ADELI_URL/api/v1/profiles/$PROFILE_ID/connect" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{"platform":"instagram"}' # HTTP/1.1 402 Payment Required # {"error":{"code":"billing_required", ... "details":{"billingUrl":"..."}}} ``` ### MCP The MCP `start_connect` tool wraps the same endpoint, so it returns the same `billing_required` error with the same `billingUrl`. See [MCP tools](https://www.tryadeli.com/docs/mcp/tools). --- # MCP ## MCP server URL: https://www.tryadeli.com/docs/mcp Markdown: https://www.tryadeli.com/docs/mcp.md Connect Claude Code, Cursor, Codex, or any MCP client to Adeli with your existing API key. # MCP server > Connect Claude Code, Cursor, Codex, or any MCP client to Adeli with your existing API key. Canonical: Adeli runs a [Model Context Protocol](https://modelcontextprotocol.io) server, so an AI agent can use the API as typed tools instead of hand-written HTTP requests. The tools are the REST API: each one calls the same endpoint with the same validation, profile scoping, errors, and side effects. Nothing is available over MCP that is not available over REST. ## Endpoint and authentication ```http POST https://app.tryadeli.com/mcp ``` There are two ways in, and both reach the same tools: - **Sign in** — Claude.ai, Claude Desktop, and ChatGPT add the URL as a custom connector and send you to Adeli to sign in. You pick the organization and approve what the app may do. There is no key to copy. - **API key** — every other client sends the same `rk_live_` key you use for REST, as `Authorization: Bearer rk_live_...`. Create one under [Settings → API keys](https://app.tryadeli.com/settings/api-keys). See [Authentication](https://www.tryadeli.com/docs/authentication). - **Transport** — Streamable HTTP. The server is stateless and answers each request with JSON; there is no session to keep and no event stream to hold open. - **Scope** — a connection reaches every profile in its organization. Profile-scoped tools do not default: pass `profileId`, or an `accountId`, which names its own profile. `list_profiles`, `create_profile`, `list_accounts`, and `get_x_usage` can act on the whole organization; `list_accounts` accepts `profileId` when you want one profile only. A request with no credential, a revoked key, or an expired sign-in fails with `401 unauthorized` before any tool runs. Its `WWW-Authenticate` header points at `https://app.tryadeli.com/.well-known/oauth-protected-resource/mcp`, which is how a client knows to send you to sign in. > **Warning: An API key lives in your client's config** > > MCP clients store the header in a local config file. Read the key from an > environment variable where your client supports it, give each machine or > agent its own key, and never commit the file. If one leaks, delete that key > under Settings → API keys — revocation is immediate. ## Connect Claude or ChatGPT by signing in 1. Add a custom connector with the URL `https://app.tryadeli.com/mcp`: - **Claude.ai and Claude Desktop** — Settings → Connectors → Add custom connector. Leave the advanced OAuth fields empty. - **ChatGPT** — Settings → Apps & Connectors → Create, with authentication set to OAuth. 2. Click **Connect**. Adeli opens in your browser: sign in with Google or your email and password. 3. If you belong to more than one organization, choose the one the app should work in. 4. Review what the app may do and click **Allow**. Leave **Let it make changes** on to post, reply, message, and manage ads; turn it off for a read-only connection that only lists tools that read. The app then calls Adeli as you, in that organization. A sign-in lasts an hour and the app renews it in the background for up to 30 days of inactivity. Disconnect it any time under **Settings → API keys → Connected apps**; it stops working on its next request. Removing someone from the organization disconnects their apps too. ## Connect with an API key **Claude Code** ```bash claude mcp add --transport http adeli https://app.tryadeli.com/mcp \ --header "Authorization: Bearer $ADELI_API_KEY" ``` **Cursor** ```json // .cursor/mcp.json { "mcpServers": { "adeli": { "url": "https://app.tryadeli.com/mcp", "headers": { "Authorization": "Bearer ${env:ADELI_API_KEY}" } } } } ``` **VS Code** ```json // .vscode/mcp.json { "inputs": [ { "type": "promptString", "id": "adeli-key", "description": "Adeli API key", "password": true } ], "servers": { "adeli": { "type": "http", "url": "https://app.tryadeli.com/mcp", "headers": { "Authorization": "Bearer ${input:adeli-key}" } } } } ``` **Codex** ```toml # ~/.codex/config.toml [mcp_servers.adeli] url = "https://app.tryadeli.com/mcp" bearer_token_env_var = "ADELI_API_KEY" ``` **stdio clients** ```json // Any client that only runs local servers { "mcpServers": { "adeli": { "command": "npx", "args": ["-y", "mcp-remote", "https://app.tryadeli.com/mcp", "--header", "Authorization:${ADELI_AUTH}"], "env": { "ADELI_AUTH": "Bearer rk_live_..." } } } } ``` Claude Code expands `$ADELI_API_KEY` when you run the command and stores the result in its config. Clients that can only launch local processes reach the server through [`mcp-remote`](https://www.npmjs.com/package/mcp-remote), which bridges stdio to HTTP. ## Check the connection List the tools with a single request. You should get back the tools described in [MCP tools](https://www.tryadeli.com/docs/mcp/tools). **cURL** ```bash curl https://app.tryadeli.com/mcp \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' ``` To call tools interactively, run `npx @modelcontextprotocol/inspector`, choose **Streamable HTTP**, and either add the `Authorization` header or sign in through its OAuth flow. ## How tools behave - **Results are REST bodies.** A tool returns exactly the JSON the matching endpoint returns, as `structuredContent` and as text. - **Partial is not an error.** Reads that span providers can succeed for some accounts and fail for others. That result carries `status: "partial"` and an `errors` list, as described in [Core concepts](https://www.tryadeli.com/docs/concepts), and is not marked as a tool error. - **Errors keep the envelope.** Any `4xx` or `5xx` becomes a tool error whose content is the usual `{ "error": { "code", "message", "details" } }` body. See [Errors](https://www.tryadeli.com/docs/errors) for every code. - **Tools say what they change.** Read-only tools are annotated `readOnlyHint`. `disconnect_account` and `ads_set_status` are annotated `destructiveHint`, so clients that ask before acting will ask. - **Large reads are truncated in text only.** Past about 100 KB, the text copy is cut short and `structuredContent` still holds the whole body. Filter by `platform` or `accountId` to keep responses small. ## What MCP does not do - **No multipart uploads.** `create_post` takes the JSON body of `POST /api/v1/posts`. For TikTok and YouTube video, pass a public HTTPS `video.url` rather than base64. Send large files through REST. - **No key management, and no profile deletion.** Create keys in the dashboard. Agents can list and create profiles, but deleting a profile is not a tool. - **WhatsApp sends templates only.** `send_message` sends one of the business's approved WhatsApp templates; free-form WhatsApp replies stay in the dashboard inbox. Connecting a WhatsApp number is done on the dashboard's Accounts page. ## For agents If you are an AI agent reading this page, the essentials are: 1. Call `list_profiles` and pick the profile the user means; use `create_profile` for a new customer. Nothing defaults to a profile-specific operation. If the user wants to discover all connected accounts instead, `list_accounts` can be called without `profileId`. 2. Call `list_accounts`, with `profileId` when the user means one profile. Every account-level tool takes an `accountId` from it, which names its profile, so `profileId` can then be left out. Every ads tool takes an `adAccountId` from `ads_list_accounts`. 3. Ask the user before calling `create_post`, `send_message`, `disconnect_account`, `ads_create_campaign`, `ads_create_account`, `ads_update_account`, or `ads_delete_campaign`. These act on a real customer's real accounts, and an ad account, once created, cannot be deleted. 4. **Never** call `ads_set_status` with `ACTIVE` unless the user has confirmed the budget and dates in this conversation. It starts spending money. 5. Publishing to TikTok and YouTube, and Facebook Reels and videos, is asynchronous: poll the matching status tool with the returned `publishId`. Ask the user for a YouTube video's visibility and whether it is made for kids; never choose either for them. 6. For anything not covered here, read the `adeli://docs/llms.txt` resource. It is this entire documentation site as plain text. ## MCP tools URL: https://www.tryadeli.com/docs/mcp/tools Markdown: https://www.tryadeli.com/docs/mcp/tools.md Every tool the Adeli MCP server exposes, what it calls, and which ones change or spend. # MCP tools > Every tool the Adeli MCP server exposes, what it calls, and which ones change or spend. Canonical: Each tool wraps one REST endpoint and takes that endpoint's parameters as arguments. Path, query, and body parameters are all flattened into one argument object, except where a body has several shapes: `create_post` and `send_message` take the whole body as a single `post` or `message` argument. Nothing defaults to a profile-specific operation. `list_profiles`, `create_profile`, `list_accounts`, and `get_x_usage` can act on the whole organization; `list_accounts` also accepts an optional `profileId` filter. The other profile, account, and connect tools take a required `profileId`, while account-level tools take an `accountId`, which names its own profile, with `profileId` optional. Pass both and they must agree. Tools marked **changes data** act on the customer's real accounts. The one marked **spends money** can start paid ad delivery. ## Profile ### `list_profiles` List every profile in your key's organization, the default first. Use a `profileId` from here for profile-specific tools, or call `list_accounts` without one to discover connected accounts across the organization. Wraps [`GET /api/v1/profiles`](https://www.tryadeli.com/docs/api/profiles/list-profiles). Read-only. ### `create_profile` Create a profile for a new customer or brand from `name`, `externalId`, and `metadata`. Names and `externalId`s are unique within the organization. Pass `idempotencyKey`, sent as the `Idempotency-Key` header, so a retry returns the same profile instead of a `409 profile_name_conflict`. Wraps [`POST /api/v1/profiles`](https://www.tryadeli.com/docs/api/profiles/create-profile). **Changes data.** ### `update_profile` Replace the `name`, `externalId`, and `metadata` of the profile named by `profileId`. This is a full replace: omitted fields are cleared. Wraps [`PUT /api/v1/profiles/{profileId}`](https://www.tryadeli.com/docs/api/profiles/update-profile). **Changes data.** ## Accounts and connecting ### `list_accounts` List the connected Instagram, Facebook, TikTok, YouTube, X, and Bluesky accounts across every profile in the organization, optionally filtered by `profileId`, `platform`, or `accountId`. Call this before any account-level tool. Wraps [`GET /api/v1/accounts`](https://www.tryadeli.com/docs/api/accounts/list-accounts). Read-only. ### `get_account` Return one account by `profileId` and `accountId`. Wraps [`GET /api/v1/profiles/{profileId}/accounts/{accountId}`](https://www.tryadeli.com/docs/api/accounts/get-account). Read-only. ### `refresh_accounts` Refresh the provider tokens of every account on the profile. Safe to repeat. Wraps [`POST /api/v1/profiles/{profileId}/accounts/refresh`](https://www.tryadeli.com/docs/api/accounts/refresh-tokens). ### `disconnect_account` Remove Adeli's credentials and cached history for one account. The account itself is not deleted on the provider, but reconnecting needs its owner to authorize again. Wraps [`DELETE /api/v1/profiles/{profileId}/accounts/{accountId}`](https://www.tryadeli.com/docs/api/accounts/disconnect-account). **Changes data. Destructive.** ### `set_x_capabilities` Turn an X account's paid background reads, `analytics` and `inbox`, on or off. Both are off by default, because every X read is billed; neither syncs anything yet. Wraps [`PATCH /api/v1/profiles/{profileId}/accounts/{accountId}`](https://www.tryadeli.com/docs/api/accounts/update-x-account). **Changes data.** ### `start_connect` Start connecting an account on `platform` (`instagram`, `facebook`, `tiktok`, `youtube`, or `x`), with an optional `redirectUrl`. When present, it must exactly match a URI registered under the API key organization's **Settings → OAuth**; see [OAuth setup](https://www.tryadeli.com/docs/oauth). X returns `402 x_billing_required` on Free. Returns an `authUrl` that the account owner opens in a browser. Wraps [`POST /api/v1/profiles/{profileId}/connect`](https://www.tryadeli.com/docs/api/connect/start-connection). When the account doesn't fit the workspace's plan, it returns `billing_required`, with a `billingUrl` where the workspace owner chooses or upgrades a plan. See [Billing](https://www.tryadeli.com/docs/billing#in-the-api). ### `get_connect_session` Poll a session from `start_connect` by `connectionSessionId` until it is `connected`, `failed`, or `expired`. Wraps [`GET /api/v1/profiles/{profileId}/connect/{connectionSessionId}`](https://www.tryadeli.com/docs/api/connect/get-connection-session). Read-only. ## Posts ### `list_posts` List recent Instagram, Facebook, TikTok, YouTube, X, and Bluesky posts, optionally filtered by `platform` or `accountId`. X posts are billed reads, so X is listed only when asked for by `platform` or `accountId`. Wraps [`GET /api/v1/posts`](https://www.tryadeli.com/docs/api/posts/list-posts). Read-only. ### `list_instagram_stories` List an Instagram account's live stories, newest first, each with its media, permalink, when it was posted and when it expires. Pass a story's `id` as `storyId` to `list_messages` to see who replied to it. Wraps [`GET /api/v1/posts/instagram/stories`](https://www.tryadeli.com/docs/api/posts/list-instagram-stories). Read-only. ### `create_post` Publish to Instagram, Facebook, TikTok, YouTube, X, or Bluesky. The `post` argument is exactly the JSON body of [`POST /api/v1/posts`](https://www.tryadeli.com/docs/api/posts), including its `platform` and `accountId`. Instagram takes `image`, legacy image-only `images`, `reel`, image/video `story`, or mixed `carousel`. Video is base64 MP4, `{ "url": "https://..." }`, or a previously prepared staged upload reference. A fully staged Instagram request returns a durable job; poll `get_instagram_post_status`. Legacy URL/base64 requests remain synchronous. Stories expire after 24 hours, may have no permalink, and do not appear in `list_posts`. For TikTok, call `get_tiktok_creator_info` first and prefer a public `video.url` to base64. TikTok videos publish publicly; `post_mode: "MEDIA_UPLOAD"` sends a draft to the creator's inbox instead. For YouTube, `title`, `privacy_status`, and `made_for_kids` are required; ask the user for the last two rather than choosing them. If YouTube applies a different visibility than the one asked for, the result reports it as `privacyRestricted`. Multipart uploads (`POST /api/v1/posts/youtube`) are REST-only. For X, `text` is up to 280 characters and `thread` adds replies; every post is billed at X's price, and a thread that fails part-way returns the posts that went live. **Changes data. Spends money on X.** ### `create_publication` Publish one post to several connected accounts at once. `publication` is exactly the JSON body of [`POST /api/v1/publications`](https://www.tryadeli.com/docs/api/posts/create-publication): shared `content` and `media`, and `platforms` with one entry per account. Each entry's `options` are that platform's `create_post` fields other than its text and media. Pass `idempotencyKey` to make a repeated call safe. Poll `get_publication` for the result. Set `scheduledFor` and `timeZone` to publish later, or `draft: true` to save it without publishing. **Changes data. Spends money on X.** ### `get_publication` Check a publication's `status`, its overall `progress` from 0 to 1, and each account's outcome. Wraps [`GET /api/v1/publications/{publicationId}`](https://www.tryadeli.com/docs/api/posts/get-publication). Read-only. ### `list_publications` List a profile's publications. `status: "scheduled"` lists what is scheduled, soonest first; `status: "draft"` lists drafts. Wraps [`GET /api/v1/publications`](https://www.tryadeli.com/docs/api/posts/list-publications). Read-only. ### `update_publication` Reschedule a scheduled publication or draft, or replace its post. Wraps [`PATCH /api/v1/publications/{publicationId}`](https://www.tryadeli.com/docs/api/posts/update-publication). **Changes data.** ### `publish_publication` Publish a scheduled publication or draft now. Wraps [`POST /api/v1/publications/{publicationId}/publish`](https://www.tryadeli.com/docs/api/posts/publish-publication). **Changes data. Spends money on X.** ### `cancel_publication` Cancel a scheduled publication or delete a draft before it is published. Wraps [`DELETE /api/v1/publications/{publicationId}`](https://www.tryadeli.com/docs/api/posts/cancel-publication). **Changes data. Destructive.** ### `retry_publication` Re-run only the accounts of a finished publication that failed. Wraps [`POST /api/v1/publications/{publicationId}/retry`](https://www.tryadeli.com/docs/api/posts/retry-publication). **Changes data. Spends money on X.** ### `get_instagram_post_status` Check a durable staged Instagram publish by `jobId` and optional `profileId`. `queued` and `processing` are pending; `published`, `failed`, and `outcome_unknown` are terminal. Do not automatically resubmit an `outcome_unknown` job because Meta may already have published it. Wraps [`GET /api/v1/posts/instagram/status`](https://www.tryadeli.com/docs/api/posts/get-instagram-publish-status). Read-only. ### `get_facebook_post_status` Check an asynchronous Facebook Reel or video publish by `accountId` and `publishId`. Wraps [`GET /api/v1/posts/facebook/status`](https://www.tryadeli.com/docs/api/posts/get-facebook-video-status). Read-only. ### `get_tiktok_creator_info` Return the TikTok creator's current posting options for `accountId`. Wraps [`GET /api/v1/posts/tiktok/creator-info`](https://www.tryadeli.com/docs/api/posts/get-tiktok-creator-info). Read-only. ### `get_tiktok_post_status` Check an asynchronous TikTok publish by `accountId` and `publishId`. The final statuses are `PUBLISH_COMPLETE`, `SEND_TO_USER_INBOX`, and `FAILED`. Wraps [`GET /api/v1/posts/tiktok/status`](https://www.tryadeli.com/docs/api/posts/get-tiktok-publish-status). Read-only. ### `get_youtube_post_status` Check a YouTube upload by `accountId` and `videoId` (the `publishId` `create_post` returned). `status` is `processing`, `published`, or `failed`; `privacyStatus` is what YouTube applied. Wraps [`GET /api/v1/posts/youtube/status`](https://www.tryadeli.com/docs/api/posts/get-youtube-upload-status). Read-only. ### `delete_x_post` Delete a post from an X account by `accountId` and `postId` (its `providerId`). It cannot be undone, and X bills it. Wraps [`DELETE /api/v1/posts/x/{postId}`](https://www.tryadeli.com/docs/api/posts/delete-x-post). **Changes data. Destructive.** ### `delete_bluesky_post` Delete a post from a Bluesky account by `accountId` and `postId` (its record key, or its AT URI). It cannot be undone. Wraps [`DELETE /api/v1/posts/bluesky/{postId}`](https://www.tryadeli.com/docs/api/posts/delete-bluesky-post). **Changes data. Destructive.** ### `get_usage` Return how many posts, messages and comments the workspace has sent this UTC month, across all its profiles, against the free plan's limits. Takes no input. Wraps [`GET /api/v1/usage`](https://www.tryadeli.com/docs/api/usage/get-usage). Read-only. ### `get_x_usage` Return what your X API calls have cost this UTC month, by operation. Wraps [`GET /api/v1/usage/x`](https://www.tryadeli.com/docs/pricing/x#get-api-v1-usage-x). Read-only. ## Comments ### `list_comments` The comments on one Instagram, Facebook, TikTok, or YouTube post, with the account's recent posts. Wraps [`GET /api/v1/comments`](https://www.tryadeli.com/docs/api/comments/list-comments). Read-only. ### `reply_to_comment` Reply to a comment, or comment on one of the account's own posts (Facebook, TikTok, and YouTube). Each YouTube comment write spends 50 units of a daily quota shared by every Adeli customer. Wraps [`POST /api/v1/comments`](https://www.tryadeli.com/docs/api/comments/create-comment). **Changes data.** ### `update_comment` Hide or unhide a comment, or like or unlike one on TikTok. On YouTube, hiding holds the comment for review. Wraps [`PATCH /api/v1/comments/{commentId}`](https://www.tryadeli.com/docs/api/comments/update-comment). **Changes data.** ### `delete_comment` Delete a comment permanently. TikTok deletes only the account's own comments. YouTube deletes the channel's own and rejects anyone else's; `banAuthor` also bans that commenter from the channel. Wraps [`DELETE /api/v1/comments/{commentId}`](https://www.tryadeli.com/docs/api/comments/delete-comment). **Changes data.** ## Messages ### `list_messages` Read Instagram and Facebook direct message history, optionally filtered by `platform` or `accountId`. Pass a message's `story.id` as `storyId` to list every reply to that Instagram story, then message each `sender` with `send_instagram_message`. Wraps [`GET /api/v1/messages`](https://www.tryadeli.com/docs/api/messages/list-messages). Read-only. ### `send_message` Send a text direct message. The `message` argument is exactly the JSON body of [`POST /api/v1/messages`](https://www.tryadeli.com/docs/api/messages/send-message). **Changes data.** ### `send_instagram_message` Send an Instagram direct message, or a private reply to the author of a comment, optionally with buttons. The `message` argument is exactly the JSON body of [`POST /api/v1/messages/instagram`](https://www.tryadeli.com/docs/api/messages/send-instagram-message). **Changes data.** ### `get_instagram_user` Read someone who has messaged an Instagram account: their username, name, and whether they follow the account. Instagram answers only after they have messaged the account or tapped one of its buttons. Wraps [`GET /api/v1/messages/instagram/users/{igsid}`](https://www.tryadeli.com/docs/api/messages/get-instagram-user). ## Analytics ### `get_instagram_insights` Instagram account insights for `accountId`. Wraps [`GET /api/v1/analytics/instagram/account-insights`](https://www.tryadeli.com/docs/api/analytics/instagram-account-insights). Read-only. ### `get_facebook_page_metrics` Facebook Page follower count, recent engagement, and 28-day Page Insights when the connection has granted `read_insights`. Without `accountId`, pass `profileId` to use that profile's Facebook connection. Wraps [`GET /api/v1/analytics/facebook/page-metrics`](https://www.tryadeli.com/docs/api/analytics/facebook-page-metrics). Read-only. ### `get_tiktok_analytics` TikTok profile and aggregate statistics for `accountId`. Wraps [`GET /api/v1/analytics/tiktok/account-analytics`](https://www.tryadeli.com/docs/api/analytics/tiktok-account-analytics). Read-only. ### `get_tiktok_account_insights` Daily TikTok account metrics and follower demographics for a UTC date window. Wraps [`GET /api/v1/analytics/tiktok/account-insights`](https://www.tryadeli.com/docs/api/analytics/tiktok-account-insights). Read-only. ### `get_tiktok_video_insights` Counters and watch metrics for up to 20 TikTok posts. Wraps [`GET /api/v1/analytics/tiktok/video-insights`](https://www.tryadeli.com/docs/api/analytics/tiktok-post-insights). Read-only. ### `get_youtube_channel_insights` Daily YouTube views, watch time, and subscribers, the top ten videos, and viewer demographics for a UTC date window. Needs the connection to have granted analytics. Wraps [`GET /api/v1/analytics/youtube/channel-insights`](https://www.tryadeli.com/docs/api/analytics/youtube-channel-insights). Read-only. ### `get_youtube_video_insights` Views, watch time, and average view percentage for up to 50 YouTube videos. Wraps [`GET /api/v1/analytics/youtube/video-insights`](https://www.tryadeli.com/docs/api/analytics/youtube-video-insights). Read-only. ### `get_linkedin_account_insights` Followers and daily impressions, reactions, comments, shares, and follower gain for a LinkedIn Page or personal profile, from a snapshot refreshed at most every six hours. Wraps [`GET /api/v1/analytics/linkedin/account-insights`](https://www.tryadeli.com/docs/api/analytics/linkedin-account-insights). Read-only. ### `get_linkedin_post_insights` Lifetime counters for up to five LinkedIn posts. A personal profile's posts must have been published through Adeli. Wraps [`GET /api/v1/analytics/linkedin/post-insights`](https://www.tryadeli.com/docs/api/analytics/linkedin-post-insights). Read-only. ## Ads Every ads tool takes an optional `accountId`: a Meta Ads account (connected separately from Facebook) or a `tiktok_ads` account (separate from the TikTok posting account). Without it, pass `profileId`, and the tool uses that profile's ads connection; when the profile has both, also pass `platform` (`meta_ads` or `tiktok_ads`). A Facebook or organic TikTok `accountId` is not accepted. ### `ads_list_accounts` List the ad accounts the Facebook connection can reach. Wraps [`GET /api/v1/ads/accounts`](https://www.tryadeli.com/docs/api/ads/list-ad-accounts). Read-only. ### `ads_list_businesses` The Business portfolios the Facebook connection administers — where `ads_create_account` can create one. Wraps [`GET /api/v1/ads/businesses`](https://www.tryadeli.com/docs/api/ads/list-businesses). Read-only. ### `ads_create_account` Create an ad account in a portfolio from `ads_list_businesses`. Takes the body of [`POST /api/v1/ads/accounts`](https://www.tryadeli.com/docs/api/ads/create-ad-account) plus a required `idempotencyKey`, sent as the `Idempotency-Key` header; retrying with the same key returns the first result. **Changes data, permanently:** Meta has no API to close an ad account, and its currency and time zone are fixed. ### `ads_get_account` One ad account's status, amount spent, spending limit, and whether a payment method is on file. Wraps [`GET /api/v1/ads/accounts/{adAccountId}`](https://www.tryadeli.com/docs/api/ads/get-ad-account). Read-only. ### `ads_update_account` Rename an ad account, or set or remove (`spendCap: null`) its spending limit. Wraps [`PATCH /api/v1/ads/accounts/{adAccountId}`](https://www.tryadeli.com/docs/api/ads/update-ad-account). **Changes data.** ### `ads_get_tree` Campaigns, ad sets, and ads for `adAccountId`, with metrics for an optional `since`–`until` range. Wraps [`GET /api/v1/ads/tree`](https://www.tryadeli.com/docs/api/ads/get-campaign-tree). Read-only. ### `ads_get_insights` Daily performance for `adAccountId`, or for one `objectId` within it, or with `breakdown` totals by age, gender, place, placement or device. Meta results include actions, their values, ROAS and cost per result, counted with optional `attributionWindows`. Wraps [`GET /api/v1/ads/insights`](https://www.tryadeli.com/docs/api/ads/get-insights). Read-only. ### `ads_list_leads` The Page's lead forms, or with `formId`, that form's submissions. Wraps [`GET /api/v1/ads/leads`](https://www.tryadeli.com/docs/api/ads/list-leads). Read-only. ### `ads_create_campaign` Create a campaign, ad set, and ad that promote a Page post, all **paused**, with an engagement objective and US targeting. For anything else, use `ads_create_meta_campaign`. Takes the body of [`POST /api/v1/ads/campaigns`](https://www.tryadeli.com/docs/api/ads/create-campaign) plus a required `idempotencyKey`, which is sent as the `Idempotency-Key` header. Retrying with the same key returns the first result instead of creating a second campaign. **Changes data.** ### `ads_create_meta_campaign` Create a Meta campaign, ad set, and ad, all **paused**: an objective, a daily or lifetime budget, dates, an optional bid strategy, targeting, and a new image, video or carousel ad (or a Page or Instagram post to boost), optionally inside an existing campaign or ad set. `validateOnly: true` has Meta check it without creating anything. Takes the Meta full campaign body of [`POST /api/v1/ads/campaigns`](https://www.tryadeli.com/docs/api/ads/create-campaign) plus a required `idempotencyKey`. The tool tells the agent to confirm the objective, budget, dates, audience and creative with the person first. **Changes data.** ### `ads_update_campaign` Rename a Meta campaign, or change its Advantage campaign budget, bid strategy or spend cap. Wraps [`PATCH /api/v1/ads/campaigns/{campaignId}`](https://www.tryadeli.com/docs/api/ads/update-campaign). **Changes data**, and a higher budget can spend more. ### `ads_delete_ad_group` Delete one Meta ad set with its ads. Wraps [`DELETE /api/v1/ads/ad-groups/{adGroupId}`](https://www.tryadeli.com/docs/api/ads/delete-ad-group). **Destructive and irreversible.** ### `ads_delete_ad` Delete one Meta ad. Wraps [`DELETE /api/v1/ads/ads/{adId}`](https://www.tryadeli.com/docs/api/ads/delete-ad). **Destructive and irreversible.** ### `ads_delete_campaign` Delete a campaign with its ad sets and ads. Wraps [`DELETE /api/v1/ads/campaigns/{campaignId}`](https://www.tryadeli.com/docs/api/ads/delete-campaign). **Destructive and irreversible.** ### `ads_set_status` Set a campaign, ad set (TikTok ad group), or ad to `ACTIVE` or `PAUSED`; TikTok needs `level`. Wraps [`PUT /api/v1/ads/status`](https://www.tryadeli.com/docs/api/ads/update-status). **Spends money** when set to `ACTIVE`. ### `ads_create_tiktok_campaign` Create a TikTok campaign, ad group, and video ad, all **disabled**. Takes the TikTok body of [`POST /api/v1/ads/campaigns`](https://www.tryadeli.com/docs/api/ads/create-campaign) plus a required `idempotencyKey`. **Changes data.** ### `ads_create_linkedin_campaign` Sponsor an existing post by the LinkedIn ad account's own Page as a campaign group, campaign, and ad, all **drafts**. Takes the LinkedIn body of [`POST /api/v1/ads/campaigns`](https://www.tryadeli.com/docs/api/ads/create-campaign) plus a required `idempotencyKey`. Nothing spends until `ads_set_status` activates the campaign group. **Changes data.** ### `ads_update_ad_group` Change a Meta ad set's name, budget, bid, dates or targeting, or a TikTok ad group's or LinkedIn campaign's daily budget, end date, or name. Wraps [`PATCH /api/v1/ads/ad-groups/{adGroupId}`](https://www.tryadeli.com/docs/api/ads/update-ad-group). **Changes data**, and a higher budget can spend more. ### `ads_list_targeting` Meta interests, behaviors, demographics, locations and languages (searched with `q`); TikTok location, language, and interest options; LinkedIn professional targeting. Wraps [`GET /api/v1/ads/targeting`](https://www.tryadeli.com/docs/api/ads/list-targeting). Read-only. ### `ads_estimate_reach` Meta's estimate of how many people a targeting spec reaches. Wraps [`POST /api/v1/ads/reach-estimate`](https://www.tryadeli.com/docs/api/ads/estimate-reach). Read-only: creates nothing. ### `ads_list_instagram_accounts` The Instagram accounts a Meta ad account can run ads as. Wraps [`GET /api/v1/ads/instagram-accounts`](https://www.tryadeli.com/docs/api/ads/list-instagram-accounts). Read-only. ### `ads_list_identities` The brand identities a TikTok ad can run as. Wraps [`GET /api/v1/ads/identities`](https://www.tryadeli.com/docs/api/ads/list-identities). Read-only. ### `ads_create_identity` Create a TikTok brand identity from a name and avatar. Wraps [`POST /api/v1/ads/identities`](https://www.tryadeli.com/docs/api/ads/create-identity). **Changes data.** ## Not exposed as tools - `DELETE /api/v1/profiles/{profileId}` — deletes the profile and every connection on it. Too destructive for one tool call; use the dashboard. - `GET /api/v1/profiles/{profileId}` and `GET /api/v1/profiles/{profileId}/accounts` — the same data as `list_profiles` and `list_accounts`. - `POST /api/v1/posts/youtube` — a multipart file upload. `create_post` takes the same YouTube post as JSON with a video URL or base64. --- # API Reference ## API Reference URL: https://www.tryadeli.com/docs/api Markdown: https://www.tryadeli.com/docs/api.md The base URL, authentication, the error envelope, the OpenAPI document, and every resource the API exposes. # API Reference > The base URL, authentication, the error envelope, the OpenAPI document, and every resource the API exposes. Canonical: Every endpoint in the Adeli REST API has its own page here: what it does, the parameters it takes, a request you can copy in cURL, JavaScript, or Python, and the responses it returns. For how the API fits together, start with the [Overview](https://www.tryadeli.com/docs). ## Base URL All endpoints live under `/api/v1`, and every response is JSON. ```bash https://app.tryadeli.com/api/v1 ``` ## Authentication Every request carries your API key as a bearer token. Keys are created in the dashboard and belong to your organization; see [Authentication](https://www.tryadeli.com/docs/authentication). ```http Authorization: Bearer rk_live_... ``` The examples on these pages read the key from an environment variable: ```bash export ADELI_API_KEY='rk_live_...' ``` ## Errors Every failure returns the same envelope, with a stable `code` to branch on and a `message` for humans. [Errors](https://www.tryadeli.com/docs/errors) lists every status and code. ```json { "error": { "code": "profile_not_found", "message": "Profile not found" } } ``` ## OpenAPI The whole API is described as an OpenAPI 3.1 document at [`/docs/openapi.json`](https://www.tryadeli.com/docs/openapi.json). Import it into Insomnia or another client, or generate a client from it. Prefer Postman? Fork the [Adeli Postman collection](https://www.tryadeli.com/docs/postman), which is generated from this document. ## Resources - [Check your API key](https://www.tryadeli.com/docs/api/me.md) — Who your key belongs to, which key it is, and the accounts connected so far. Read-only. (1 endpoints) - [Get usage](https://www.tryadeli.com/docs/api/usage/get-usage.md) — A profile's posts, messages and comments sent this month, against the free plan's limits. (1 endpoints) - [Profiles](https://www.tryadeli.com/docs/api/profiles.md) — List, create, read, update, and delete the profiles in your organization. (5 endpoints) - [Connect](https://www.tryadeli.com/docs/api/connect.md) — Run your customer through Instagram, Facebook, TikTok, YouTube, X, or Bluesky authorization without an Adeli login. (2 endpoints) - [Accounts](https://www.tryadeli.com/docs/api/accounts.md) — List connected accounts, refresh their tokens, and disconnect them. (6 endpoints) - [Posts](https://www.tryadeli.com/docs/api/posts.md) — List Instagram, Facebook, TikTok, YouTube, X, and Bluesky posts, and publish to all six. (25 endpoints) - [Comments](https://www.tryadeli.com/docs/api/comments.md) — Read, reply to, hide, like, and delete comments on Instagram, Facebook, TikTok, and YouTube posts. (4 endpoints) - [Messages](https://www.tryadeli.com/docs/api/messages.md) — Read Instagram and Facebook message history, and send text replies to both. (4 endpoints) - [Webhooks](https://www.tryadeli.com/docs/api/webhooks.md) — Signed callbacks for new Instagram and TikTok comments, inbound Instagram, Facebook and WhatsApp messages, and postback button taps. (4 endpoints) - [Analytics](https://www.tryadeli.com/docs/api/analytics.md) — Instagram account insights, Facebook Page metrics, TikTok profile statistics, account insights, and post insights, and YouTube channel and video insights. (9 endpoints) - [Ads](https://www.tryadeli.com/docs/api/ads.md) — Meta, TikTok and LinkedIn ad accounts, full campaign creation with targeting, edits after launch, insights with breakdowns, and lead form submissions. (20 endpoints) --- # API key ## Check your API key URL: https://www.tryadeli.com/docs/api/me Markdown: https://www.tryadeli.com/docs/api/me.md Who your key belongs to, which key it is, and the accounts connected so far. Read-only. # Check your API key > Who your key belongs to, which key it is, and the accounts connected so far. Read-only. Canonical: `GET https://app.tryadeli.com/api/v1/me` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Answers with who your API key belongs to, which key it is, and the accounts connected to a profile. It is read-only, calls no social platform, and returns the same fields whether or not anything is connected, so it is the quickest way to check that a key works. Keys belong to your organization, not to one profile, so `profileId` is optional and defaults to your organization's default profile. **Query parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | `profileId` | `uuid` | | The profile whose connected accounts to list. Defaults to the default profile. A profile outside your organization returns `404 profile_not_found`. | **Response** | Name | Type | Required | Description | | ------------------- | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | `message` | `string` | | A greeting that confirms the key works. The same on every call. | | `you.name` | `string \| null` | | The person who created the key, or `null` once they have left your organization. | | `you.organization` | `string` | | Your organization's name. | | `you.profile` | `object` | | The profile the accounts belong to: `id` and `name`. | | `apiKey` | `object` | | The key's `label`, its visible `prefix`, and when it was created (`createdAt`). Never the secret. | | `accountsConnected` | `array` | | The profile's working connections, each with `accountId`, `platform` and `username`. Empty when nothing is connected; expired connections are left out. | | `docs` | `string` | | Where these docs live. | **Errors** — `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`, `502 database_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/me" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/me", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/me", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) print(response.json()) ``` ## Responses ### 200 ```json { "message": "Hello from Adeli 👋 Your API key works.", "you": { "name": "Mika Reyes", "organization": "King's Cross Labs", "profile": { "id": "00000000-0000-4000-8000-000000000001", "name": "King's Cross Labs" } }, "apiKey": { "label": "Quickstart", "prefix": "rk_live_AbCd1234", "createdAt": "2026-10-15T21:04:00.000Z" }, "accountsConnected": [ { "accountId": "00000000-0000-0000-0000-000000000000", "platform": "instagram", "username": "adeli" } ], "docs": "https://www.tryadeli.com/docs" } ``` ### 401 ```json { "error": { "code": "unauthorized", "message": "A valid Bearer API key is required" } } ``` --- # Usage ## Get usage URL: https://www.tryadeli.com/docs/api/usage/get-usage Markdown: https://www.tryadeli.com/docs/api/usage/get-usage.md A profile's posts, messages and comments sent this month, against the free plan's limits. # Get usage > A profile's posts, messages and comments sent this month, against the free plan's limits. Canonical: `GET https://app.tryadeli.com/api/v1/usage` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Answers with how many posts, messages and comments your workspace has sent, across all its profiles, against its plan's limits. It is read-only and calls no social platform. Free can send **10 posts, 100 comments and 100 messages in total**, and Starter **10,000 of each a month**, shared by all the workspace's profiles. Once the workspace reaches a limit, sends of that kind answer [`402 usage_limit_reached`](https://www.tryadeli.com/docs/errors#billing) until the workspace chooses or upgrades a plan, or on Starter until the month resets. Business has no limits, and its `limit` fields are `null`. See [Pricing](https://www.tryadeli.com/docs/pricing#the-free-tier) for what counts as one post, message or comment. It takes no parameters. **Response** | Name | Type | Required | Description | | ---------- | ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `period` | `string` | | The calendar month, as `YYYY-MM` in UTC, or `free` on Free, whose counts are lifetime totals. | | `resetsAt` | `datetime \| null` | | When the counts go back to zero: midnight UTC on the 1st of next month. `null` on Free, whose limits never reset. | | `enforced` | `boolean` | | Whether sends past a limit are refused right now. `false` on Business. | | `posts` | `object` | | `used` in this period and the plan's `limit`, or `null` on Business. A publication to several accounts counts once per account; an X or Bluesky thread counts once. | | `messages` | `object` | | `used` and `limit` for direct messages, Instagram private replies and WhatsApp messages sent. | | `comments` | `object` | | `used` and `limit` for comments and comment replies Adeli posted. | Sends that fail don't count. Edits, deletes, hiding comments and reading never count. **Errors** — `401 unauthorized`, `502 database_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/usage" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/usage", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/usage", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) print(response.json()) ``` ## Responses ### 200 ```json { "period": "2026-11", "resetsAt": "2026-12-01T00:00:00.000Z", "enforced": true, "posts": { "used": 214, "limit": 1000 }, "messages": { "used": 3820, "limit": 10000 }, "comments": { "used": 0, "limit": 10000 } } ``` ### 401 ```json { "error": { "code": "unauthorized", "message": "A valid Bearer API key is required" } } ``` --- # Profiles ## Profiles URL: https://www.tryadeli.com/docs/api/profiles Markdown: https://www.tryadeli.com/docs/api/profiles.md List, create, read, update, and delete the profiles in your organization. # Profiles > List, create, read, update, and delete the profiles in your organization. Canonical: A profile represents one of your end customers or brands. Your API key belongs to your organization and can act on every profile in it, so profile-scoped endpoints name the profile they act on, with a `profileId` or with an `accountId` that belongs to it. See [Core concepts](https://www.tryadeli.com/docs/concepts#profiles) for the model. The endpoints here list and create profiles. Along with `GET /api/v1/accounts` and `GET /api/v1/usage/x`, they can act on the whole organization and take no profile. ## Endpoints - `GET /api/v1/profiles` — [List profiles](https://www.tryadeli.com/docs/api/profiles/list-profiles.md) - `POST /api/v1/profiles` — [Create profile](https://www.tryadeli.com/docs/api/profiles/create-profile.md) - `GET /api/v1/profiles/{profileId}` — [Get profile](https://www.tryadeli.com/docs/api/profiles/get-profile.md) - `PUT /api/v1/profiles/{profileId}` — [Update profile](https://www.tryadeli.com/docs/api/profiles/update-profile.md) - `DELETE /api/v1/profiles/{profileId}` — [Delete profile](https://www.tryadeli.com/docs/api/profiles/delete-profile.md) ## List profiles URL: https://www.tryadeli.com/docs/api/profiles/list-profiles Markdown: https://www.tryadeli.com/docs/api/profiles/list-profiles.md Every profile in your organization, the default profile first. # List profiles > Every profile in your organization, the default profile first. Canonical: `GET https://app.tryadeli.com/api/v1/profiles` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Returns every profile in your organization, the default profile first. Call it to find the `profileId` for a customer, or match on the `externalId` you set. This endpoint, [Create profile](https://www.tryadeli.com/docs/api/profiles/create-profile), and `GET /api/v1/usage/x` are the only ones that act on the whole organization and take no profile. **Errors** — `401 unauthorized`, `502 database_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/profiles" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/profiles", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/profiles", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) print(response.json()) ``` ## Responses ### 200 ```json { "profiles": [ { "id": "00000000-0000-4000-8000-000000000001", "name": "Acme Agency", "externalId": null, "metadata": {}, "isDefault": true, "createdAt": "2026-09-08T20:00:00.000Z", "updatedAt": "2026-09-08T20:00:00.000Z" }, { "id": "00000000-0000-4000-8000-000000000002", "name": "Client A", "externalId": "customer-123", "metadata": { "plan": "pro" }, "isDefault": false, "createdAt": "2026-09-09T14:30:00.000Z", "updatedAt": "2026-09-09T14:30:00.000Z" } ] } ``` ### 401 ```json { "error": { "code": "unauthorized", "message": "A valid Bearer API key is required" } } ``` ## Create profile URL: https://www.tryadeli.com/docs/api/profiles/create-profile Markdown: https://www.tryadeli.com/docs/api/profiles/create-profile.md Create a profile for one of your customers, idempotently if you pass a key. # Create profile > Create a profile for one of your customers, idempotently if you pass a key. Canonical: `POST https://app.tryadeli.com/api/v1/profiles` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Creates a profile in your organization and returns it with `201`. Create one per customer when they sign up in your app, and store its `id`. **Headers** | Name | Type | Required | Description | | ----------------- | -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Idempotency-Key` | `string` | | Optional. Any unique string, such as your own customer id. Repeating it with the same body returns the profile it created instead of a conflict; repeating it with a different body returns 409 idempotency\_conflict. | **Body** | Name | Type | Required | Description | | ------------ | ---------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- | | `name` | `string` | Yes | 1–200 characters after trimming. Must be unique across your organization's profiles. | | `externalId` | `string \| null` | | Your own id for this customer, up to 200 characters. Must be unique across your organization's profiles when not null. | | `metadata` | `object \| null` | | Any JSON object, up to 16 KiB encoded as UTF-8. Arrays and scalars are rejected. | A name or `externalId` that is already taken returns `409` with the existing profile's id in `details.existingProfileId`, so you can use that profile instead. **Errors** — `401 unauthorized`, `400 invalid_request`, `400 invalid_profile`, `409 profile_name_conflict`, `409 profile_external_id_conflict`, `409 idempotency_conflict`, `502 database_error`. ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/profiles" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: customer-123" \ -d '{ "name": "Client A", "externalId": "customer-123", "metadata": { "plan": "pro" } }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/profiles", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", "Idempotency-Key": "customer-123", }, body: JSON.stringify({ name: "Client A", externalId: "customer-123", metadata: { plan: "pro", }, }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/profiles", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}", "Idempotency-Key": "customer-123"}, json={ "name": "Client A", "externalId": "customer-123", "metadata": { "plan": "pro", }, }, ) print(response.json()) ``` ## Responses ### 201 ```json { "id": "00000000-0000-4000-8000-000000000002", "name": "Client A", "externalId": "customer-123", "metadata": { "plan": "pro" }, "isDefault": false, "createdAt": "2026-09-09T14:30:00.000Z", "updatedAt": "2026-09-09T14:30:00.000Z" } ``` ### 409 ```json { "error": { "code": "profile_name_conflict", "message": "A profile with this name already exists", "details": { "existingProfileId": "00000000-0000-4000-8000-000000000009" } } } ``` ## Get profile URL: https://www.tryadeli.com/docs/api/profiles/get-profile Markdown: https://www.tryadeli.com/docs/api/profiles/get-profile.md One profile, as a bare object. # Get profile > One profile, as a bare object. Canonical: `GET https://app.tryadeli.com/api/v1/profiles/{profileId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Returns the profile as a bare object — not wrapped in `profiles`. **Path parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | -------------------------------------------------------------------------------- | | `profileId` | `uuid` | Yes | A profile in your organization. Any other value returns 404 profile\_not\_found. | **Errors** — `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`, `502 database_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000002" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000002", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000002", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) print(response.json()) ``` ## Responses ### 200 ```json { "id": "00000000-0000-4000-8000-000000000002", "name": "Client A", "externalId": "customer-123", "metadata": { "plan": "pro" }, "isDefault": false, "createdAt": "2026-09-09T14:30:00.000Z", "updatedAt": "2026-09-09T14:30:00.000Z" } ``` ### 404 ```json { "error": { "code": "profile_not_found", "message": "Profile not found" } } ``` ## Update profile URL: https://www.tryadeli.com/docs/api/profiles/update-profile Markdown: https://www.tryadeli.com/docs/api/profiles/update-profile.md Replace a profile's name, externalId, and metadata. # Update profile > Replace a profile's name, externalId, and metadata. Canonical: `PUT https://app.tryadeli.com/api/v1/profiles/{profileId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Replaces the mutable fields. This is a full replace, not a merge: omitting `externalId` or `metadata` clears them. **Path parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | -------------------------------------------------------------------------------- | | `profileId` | `uuid` | Yes | A profile in your organization. Any other value returns 404 profile\_not\_found. | **Body** | Name | Type | Required | Description | | ------------ | ---------------- | -------- | --------------------------------------------------------------------------------------- | | `name` | `string` | Yes | 1–200 characters after trimming. Must be unique across your organization's profiles. | | `externalId` | `string \| null` | | Up to 200 characters. Must be unique across your organization's profiles when not null. | | `metadata` | `object \| null` | | Any JSON object, up to 16 KiB encoded as UTF-8. Arrays and scalars are rejected. | Both conflict responses carry the colliding profile in `details.existingProfileId`, as they do on [create](https://www.tryadeli.com/docs/api/profiles/create-profile). **Errors** — `401 unauthorized`, `400 invalid_request`, `400 invalid_profile`, `404 profile_not_found`, `409 profile_name_conflict`, `409 profile_external_id_conflict`, `502 database_error`. ## Request examples **cURL** ```bash curl -X PUT "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000002" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Client A", "externalId": "customer-123", "metadata": { "plan": "pro" } }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000002", { method: "PUT", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ name: "Client A", externalId: "customer-123", metadata: { plan: "pro", }, }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.put( "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000002", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "name": "Client A", "externalId": "customer-123", "metadata": { "plan": "pro", }, }, ) print(response.json()) ``` ## Responses ### 200 ```json { "id": "00000000-0000-4000-8000-000000000002", "name": "Client A", "externalId": "customer-123", "metadata": { "plan": "pro" }, "isDefault": false, "createdAt": "2026-09-09T14:30:00.000Z", "updatedAt": "2026-10-09T16:00:00.000Z" } ``` ### 409 ```json { "error": { "code": "profile_external_id_conflict", "message": "A profile with this externalId already exists", "details": { "existingProfileId": "00000000-0000-4000-8000-000000000009" } } } ``` ## Delete profile URL: https://www.tryadeli.com/docs/api/profiles/delete-profile Markdown: https://www.tryadeli.com/docs/api/profiles/delete-profile.md Delete a profile and everything connected to it. Cannot be undone. # Delete profile > Delete a profile and everything connected to it. Cannot be undone. Canonical: `DELETE https://app.tryadeli.com/api/v1/profiles/{profileId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) > **Danger: This cascades and cannot be undone** > > Deleting a profile removes its connected accounts, their cached history, and > its connection sessions. Your API keys belong to the organization and keep > working. It does not delete anything on Instagram, Facebook, TikTok, YouTube, X, or Bluesky. **Path parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | -------------------------------------------------------------------------------- | | `profileId` | `uuid` | Yes | A profile in your organization. Any other value returns 404 profile\_not\_found. | **Errors** — `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`, `502 database_error`. ## Request examples **cURL** ```bash curl -X DELETE "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001", { method: "DELETE", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.delete( "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) print(response.json()) ``` ## Responses ### 200 ```json { "id": "00000000-0000-4000-8000-000000000001", "deleted": true } ``` ### 404 ```json { "error": { "code": "profile_not_found", "message": "Profile not found" } } ``` --- # Connect ## Connect URL: https://www.tryadeli.com/docs/api/connect Markdown: https://www.tryadeli.com/docs/api/connect.md Run your customer through Instagram, Facebook, TikTok, YouTube, X, or Bluesky authorization without an Adeli login. # Connect > Run your customer through Instagram, Facebook, TikTok, YouTube, X, or Bluesky authorization without an Adeli login. Canonical: The connect flow lets your customer authorize their Instagram, Facebook, TikTok, YouTube, X, or Bluesky account from **your** application. They never see an Adeli dashboard, and you never handle a provider token. Before starting, an organization owner or admin registers the application's exact client callback under **Settings → OAuth**. The request's `redirectUrl` must match that URI. This client return is separate from the provider callback Adeli configures with each social platform. See [OAuth setup](https://www.tryadeli.com/docs/oauth). ## How it works 1. Your server calls [`POST /api/v1/profiles/:profileId/connect`](https://www.tryadeli.com/docs/api/connect/start-connection) and gets back an `authUrl` plus a session id. 2. You send your customer's browser to `authUrl`. They authorize with the provider directly. 3. The provider returns to Adeli, which exchanges the code server-side and stores the token. 4. Adeli sends the browser back to your `redirectUrl` with the session id and status in the query string. 5. Your server [polls the session](https://www.tryadeli.com/docs/api/connect/get-connection-session) until it reaches a terminal state. > **Warning: Open authUrl in the customer's browser** > > Do not fetch it from your backend. It is an authorization page that requires a > human to grant consent; requesting it server-side will not produce a > connection. The session is valid for **ten minutes** and its OAuth state can be consumed once. A callback that arrives late, twice, or with a tampered state is rejected without re-exchanging anything with the provider. For the full internal sequence, see the repository's `docs/nested-oauth-connect-flow.md`. ## Endpoints - `POST /api/v1/profiles/{profileId}/connect` — [Start connection](https://www.tryadeli.com/docs/api/connect/start-connection.md) - `GET /api/v1/profiles/{profileId}/connect/{connectionSessionId}` — [Get connection session](https://www.tryadeli.com/docs/api/connect/get-connection-session.md) ## The browser return When you supply a `redirectUrl`, Adeli sends the browser back with these query parameters: | Name | Type | Required | Description | | --------------------- | -------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------- | | `connectionSessionId` | `uuid` | | The session to poll. | | `status` | `string` | | The status at redirect time. | | `accountId` | `uuid` | | Present only on success. | | `workflowId` | `string` | | An internal hint — `connecting-accounts` for Instagram and Facebook, `connecting-tiktok` for TikTok, `connecting-youtube` for YouTube. | > **Note: Poll, do not trust the query string** > > These parameters are convenient for rendering an immediate result in your UI, > but they arrive through the customer's browser. Confirm the outcome with a > server-side poll before acting on it. ## Provider requirements **Instagram** needs a professional (Business or Creator) account. With Instagram Login, Adeli requests `instagram_business_basic`, `instagram_business_manage_comments`, `instagram_business_manage_insights`, `instagram_business_manage_messages`, and `instagram_business_content_publish`. ### Instagram login methods An Instagram professional account can be connected two ways, and a profile's Instagram connection uses exactly one of them: - **`instagram_login`** (the default) — your customer signs in on Instagram. Adeli requests the `instagram_business_*` permissions above. No Facebook Page is needed. - **`facebook_login`** — your customer signs in with Facebook and grants the Facebook Page their Instagram account is linked to. The approved configuration requests `instagram_basic`, `instagram_manage_messages`, `pages_show_list`, `pages_read_engagement`, `pages_manage_metadata`, and `business_management`. They must be able to manage messages on that Page. Both produce an Instagram account record, and [Accounts](https://www.tryadeli.com/docs/api/accounts) reports which method it uses. They do not currently provide identical feature grants: the Facebook Login configuration omits rejected publishing, comments, and Insights permissions. The dashboard hides those unavailable controls, while API capabilities continue to reflect the token's actual grant. Starting a connect with the method the profile's Instagram does **not** use returns `409 auth_method_conflict` before your customer reaches Meta. To switch, disconnect the account first. A usable Facebook user token completes even when Page or Instagram-account discovery is unavailable, several accounts are visible, or the Page lacks a messaging task. Those unresolved fields remain null and affected features return `403 permission_required`. `auth_method_conflict` remains a terminal session error if the profile was connected through the other method while OAuth was open. Some accounts report a third method, **`unified_login`**: they were connected through Meta's Instagram API with Unified Login, which Adeli has also offered. They keep working, with a token that does not expire (`expiresAt` is `null`). Starting a connect for such a profile with either method above is never refused, and replaces the Unified Login connection. Sending `authMethod: "unified_login"` starts an Instagram Login connect. **Facebook** connects one Page. Adeli uses Facebook Login for Business. Its organic baseline is `pages_show_list`, `pages_read_engagement`, `pages_manage_metadata`, and `pages_messaging`. A Facebook account does not authorize Ads; that is the separate Meta Ads account below. Publishing, comment management, and Page Insights permissions are not part of this configuration; reconnecting cannot add those rejected grants. Facebook is the one provider whose connection is not finished when the authorization callback returns. Authorizing yields a _user_ token, which lists the Pages your customer manages; a Page still has to be chosen before anything can be published or read. Until it is, the session stays `processing` and the redirect carries `status=pending_page_selection`. The account exists at that point and appears in [Accounts](https://www.tryadeli.com/docs/api/accounts) with `connectionStatus: "pending_page_selection"`, but every write against it returns `409 page_not_selected`. Only Pages Meta returns for this approved configuration are offered. A Page available solely through a Business portfolio may not be connectable through the organic Page flow; Adeli does not broaden this configuration to work around that asset assignment. **Meta Ads** (`platform: "meta_ads"`) connects a profile's ads, separately from its Facebook Page, with its own consent: `ads_management`, `business_management`, `pages_manage_ads`, `leads_retrieval`, `pages_show_list`, and `pages_read_engagement`. Like Facebook, it finishes by choosing a Page — the one ads are created from, which may be the Facebook account's Page or another — so the session stays `processing` and the redirect carries `status=pending_page_selection` until it is chosen. It gets its own `accountId`, used by the [Ads](https://www.tryadeli.com/docs/api/ads) endpoints, and is billed as its own connected account. **TikTok Ads** (`platform: "tiktok_ads"`) connects a profile's TikTok advertiser authorization, separately from the TikTok account used for posting. It gets its own `accountId`, used by the [Ads](https://www.tryadeli.com/docs/api/ads) endpoints, and is billed as its own connected account. TikTok Ads is in beta: the production API returns `422 provider_not_configured` for it. **LinkedIn Ads** (`platform: "linkedin_ads"`) connects a LinkedIn member's Advertising API grant, separately from the LinkedIn account used for posting. It requests `r_basicprofile`, `r_ads`, `rw_ads`, `r_ads_reporting`, and `r_organization_social`, reaches every ad account the member has a role on, gets its own `accountId` for the [Ads](https://www.tryadeli.com/docs/api/ads) endpoints, and is billed as its own connected account. A member with no role on any ad account fails with `no_ad_accounts`. **TikTok** connects through TikTok API for Business and requests `user.info.basic`, `user.info.username`, `user.info.profile`, `user.info.stats`, `user.account.type`, `user.insights`, `video.list`, `video.insights`, `video.publish`, `video.upload`, `comment.list`, `comment.list.manage`, and `biz.spark.auth`. Both personal accounts and TikTok Business Accounts can connect. The account identity and video list scopes — the first five and `video.list` — are required; without them the connection fails outright. The rest are stored as granted, and a call that needs a missing one returns `422 connection_expired` until the customer reconnects and approves it. TikTok always shows its consent screen, even to a customer who authorized before. TikTok connections made before Adeli moved to TikTok API for Business show `reconnect_required` and must be connected again. Reconnecting keeps the same `accountId`. **YouTube** connects one channel through its own Google sign-in, separate from Adeli's dashboard sign-in. Adeli requests `https://www.googleapis.com/auth/youtube.force-ssl`, which covers uploads, comments, and moderation, and `https://www.googleapis.com/auth/yt-analytics.readonly` for [YouTube analytics](https://www.tryadeli.com/docs/api/analytics). Google's account chooser decides which channel is connected: your customer's own, or one of their Brand Account channels. Reconnecting the same channel keeps the same `accountId`; connecting a different channel on the profile replaces it. Google always shows its consent screen. A YouTube session that cannot finish fails with one of these `error.code` values: A usable Google access token completes even when the customer unticks a scope, no refresh token is returned, or channel hydration is unavailable. Adeli stores the exact grant and nullable resource fields. Data and Analytics features check their own requirements and return `403 permission_required` with restart-OAuth guidance when missing. Google revokes a grant when your customer removes Adeli from their Google account, and after six months unused; the account then shows `reconnect_required`. **X** connects one account through Adeli's X app with OAuth 2.0. Adeli requests `tweet.read`, `tweet.write`, `users.read`, `media.write`, and `offline.access`. They are recommended rather than a callback gate: a usable partial grant is stored, and reads, posts, media, and refresh each enforce their own requirements. Reconnecting the same X account keeps the same `accountId`; connecting a different one on the profile replaces it. X shows every customer a warning that the app is requesting sensitive permissions and is not affiliated with X. It appears for any app that can post, and cannot be removed, so tell your customers to expect it. Every X call is billed to you at X's price, including the one read of the account's profile that connecting makes. On Free, starting a connect returns `402 x_billing_required` before any `authUrl` exists: X needs a paid plan. See [X API pricing](https://www.tryadeli.com/docs/pricing/x). Every provider accepts usable partial consent: the connection is stored with exact scopes and provider-confirmed resources, and a feature needing missing authorization returns `403 permission_required` with structured restart-OAuth guidance. ### Bluesky **Bluesky** connects one account with AT Protocol OAuth. Your customer signs in on their account's own server: bsky.social for Bluesky-hosted accounts, which is where a connect without `handle` starts. A customer who runs their own server, or uses another provider's, must be connected with `handle`, or they won't find their account at bsky.social. The consent screen names Adeli and asks for broad access to the account, because the permissions Bluesky offers today are not finer-grained than that. Adeli uses it to publish, list, and delete posts. It does not read direct messages. Reconnecting the same account keeps the same `accountId`; connecting a different one on the profile replaces it. Bluesky's API is free: connecting and posting cost nothing beyond the connected account itself. `error.code` values beyond the common ones: | Name | Type | Required | Description | | ---------------- | ---- | -------- | -------------------------------------------------------------------------------------- | | `invalid_handle` | | | The `handle` did not resolve to a Bluesky account. Starting the connect returns `400`. | A usable Bluesky OAuth session is stored with its exact scope. Feed/post features return `403 permission_required` when the recommended generic grant or resolved DID is unavailable. A customer can revoke Adeli in the Bluesky app's settings at any time; the account then shows `reconnect_required`. ## Disconnecting `DELETE /api/v1/profiles/:profileId/accounts/:accountId` removes Adeli's stored credentials and cached history. See [Accounts](https://www.tryadeli.com/docs/api/accounts/disconnect-account). It never deletes anything on the provider side. ## Start connection URL: https://www.tryadeli.com/docs/api/connect/start-connection Markdown: https://www.tryadeli.com/docs/api/connect/start-connection.md Start a hosted OAuth connection and get the URL to send your customer to. # Start connection > Start a hosted OAuth connection and get the URL to send your customer to. Canonical: `POST https://app.tryadeli.com/api/v1/profiles/{profileId}/connect` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) **Body** | Name | Type | Required | Description | | ------------- | ------------------------------------------------------------------------------------------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `platform` | `"instagram" \| "tiktok" \| "tiktok_ads" \| "facebook" \| "youtube" \| "x" \| "bluesky" \| "linkedin" \| "linkedin_ads"` | Yes | `tiktok_ads` connects TikTok Ads, the advertiser authorization the [Ads endpoints](https://www.tryadeli.com/docs/api/ads) use; it is separate from `tiktok`, which posts. TikTok Ads is in beta: the production API returns `422 provider_not_configured` for it. LinkedIn connects a personal profile or one eligible organization Page; `linkedin_ads` connects LinkedIn Ads, separately from it. X returns `402 x_billing_required` on Free, and WhatsApp and Bluesky need a paid plan too; see [X API pricing](https://www.tryadeli.com/docs/pricing/x). WhatsApp and Google Business Profile are accepted by the schema but return `422 provider_not_supported`. A business connects its WhatsApp number itself, through Embedded Signup on the dashboard's Accounts page. | | `redirectUrl` | `string` | | Where to send the browser when authorization finishes. It must exactly match a URI registered under the API key organization's **Settings → OAuth**, and use HTTPS unless the host is localhost or 127.0.0.1. See [OAuth setup](https://www.tryadeli.com/docs/oauth). Omit it to poll only. | | `authMethod` | `"unified_login" \| "instagram_login" \| "facebook_login"` | | Instagram only, and optional. `instagram_login` (the default) has your customer sign in on Instagram; `facebook_login` connects through the Facebook Page linked to the account. A profile's Instagram uses one of the two, and the other returns `409 auth_method_conflict` until it is disconnected. `unified_login` is accepted and starts an Instagram Login connect. See [Instagram login methods](https://www.tryadeli.com/docs/api/connect#instagram-login-methods). Sending it with any other platform returns `400 invalid_request`. | | `handle` | `string` | | Bluesky only, and optional: your customer's handle, such as `alice.example.com`, or their DID. The connect then starts at the server their account lives on. Leave it out for accounts hosted on Bluesky itself (`*.bsky.social` and most custom domains), which sign in at bsky.social. See [Bluesky](https://www.tryadeli.com/docs/api/connect#bluesky). Sending it with any other platform returns `400 invalid_request`. | A successful start returns `201`. Instagram sessions also carry an `authMethod`: the login the session runs. LinkedIn connects either the member's own personal profile or one organization Page they administer. A member who administers at least one eligible Page is redirected to an Adeli-hosted chooser after consent, listing their personal profile first and then each Page. Keep polling while that browser step is open: the session remains `processing` and becomes `connected` only after one account is selected. The final redirect includes its `accountId`. A member with no eligible Page connects their personal profile automatically. **Errors** — `401 unauthorized`, `400 invalid_request`, `400 invalid_redirect_uri`, `404 profile_not_found`, `409 auth_method_conflict`, `402 billing_required` (the account doesn't fit the workspace's plan; the same check runs again when the connection finishes, so a session can also end `failed` with that code; see [Billing](https://www.tryadeli.com/docs/billing#in-the-api)), `422 provider_not_supported`, `422 provider_not_configured`, `422 provider_not_available`, `502 database_error`. ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/connect" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "platform": "instagram", "redirectUrl": "https://client.example/callback" }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/connect", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ platform: "instagram", redirectUrl: "https://client.example/callback", }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/connect", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "platform": "instagram", "redirectUrl": "https://client.example/callback", }, ) print(response.json()) ``` ## Responses ### 201 ```json { "id": "00000000-0000-4000-8000-000000000002", "profileId": "00000000-0000-4000-8000-000000000001", "platform": "instagram", "authMethod": "instagram_login", "status": "pending_authorization", "accountId": null, "expiresAt": "2026-09-08T20:10:00.000Z", "completedAt": null, "error": null, "authUrl": "https://www.instagram.com/oauth/authorize?..." } ``` ### 400 ```json { "error": { "code": "invalid_redirect_uri", "message": "redirectUrl is not registered for this organization" } } ``` ## Get connection session URL: https://www.tryadeli.com/docs/api/connect/get-connection-session Markdown: https://www.tryadeli.com/docs/api/connect/get-connection-session.md Poll a connection session until it completes, fails, or expires. # Get connection session > Poll a connection session until it completes, fails, or expires. Canonical: `GET https://app.tryadeli.com/api/v1/profiles/{profileId}/connect/{connectionSessionId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) The same object without `authUrl`. Poll until `status` is terminal. **Session status** | Name | Type | Required | Description | | ----------------------- | ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------- | | `pending_authorization` | | | Waiting for your customer to authorize. Becomes expired ten minutes after creation. | | `processing` | | | The customer authorized and Adeli is exchanging the code with the provider. This is brief, and may finish after expiresAt has passed. | | `connected` | `terminal` | | Done. `accountId` is the connection to use in every later request. | | `failed` | `terminal` | | Authorization was denied or the exchange failed. `error.code` says why. | | `expired` | `terminal` | | Nobody completed authorization in time. Start a new session. | **Errors** — `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`, `404 connection_session_not_found`, `502 database_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/connect/00000000-0000-4000-8000-000000000002" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/connect/00000000-0000-4000-8000-000000000002", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/connect/00000000-0000-4000-8000-000000000002", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) print(response.json()) ``` ## Responses ### 200 ```json { "id": "00000000-0000-4000-8000-000000000002", "profileId": "00000000-0000-4000-8000-000000000001", "platform": "instagram", "authMethod": "instagram_login", "status": "connected", "accountId": "00000000-0000-0000-0000-000000000000", "expiresAt": "2026-09-08T20:10:00.000Z", "completedAt": "2026-09-08T20:03:11.000Z", "error": null } ``` ### 404 ```json { "error": { "code": "connection_session_not_found", "message": "Connection session not found" } } ``` --- # Accounts ## Accounts URL: https://www.tryadeli.com/docs/api/accounts Markdown: https://www.tryadeli.com/docs/api/accounts.md List connected accounts, refresh their tokens, and disconnect them. # Accounts > List connected accounts, refresh their tokens, and disconnect them. Canonical: An account is one provider connection inside a profile. Its `accountId` is the identifier every other endpoint takes. ## The account object [List accounts](https://www.tryadeli.com/docs/api/accounts/list-accounts) returns these records, and [Get account](https://www.tryadeli.com/docs/api/accounts/get-account) returns one bare. **Account fields** | Name | Type | Required | Description | | ------------------- | ---------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `accountId` | `uuid` | | Use this everywhere. `id` is the same value, kept for clients that expect it. | | `profileId` | `uuid` | | The profile this connection belongs to. Use it to group an organization-wide account list by customer or brand. | | `providerId` | `string` | | Instagram's user id, or TikTok's app-scoped open\_id. Informational — do not send it back as an accountId. A TikTok account's open\_id changed once, when it reconnected through TikTok API for Business. For YouTube, the channel id (UC…). For X, the user id, which survives a change of username. For Bluesky, the account's DID (did:plc:…), which survives a change of handle. For Facebook and Meta Ads, the selected Page's id. | | `displayName` | `string` | | For Instagram, "@" plus the username. For TikTok, the profile display name. For YouTube, the channel title. For X, the account name. For Bluesky, the display name, or the handle when there is none. | | `displayIdentifier` | `string` | | The Instagram username, or the TikTok username (its open\_id for a connection that has not reconnected since the move to TikTok API for Business), or the YouTube channel handle, such as @adeli (its channel id when it has none), or the X username, or the Bluesky handle. | | `authMethod` | `"unified_login" \| "instagram_login" \| "facebook_login"` | | Instagram only: the login the account was connected with: `instagram_login`, `facebook_login`, or `unified_login` (Meta's Instagram API with Unified Login). See [Instagram login methods](https://www.tryadeli.com/docs/api/connect#instagram-login-methods). | | `connectionStatus` | `string` | | `connected`; `expired` when an Instagram connection has lapsed: its token was revoked (Unified Login), expired, or, for Facebook Login, its Page can no longer be reached; `reconnect_required` when TikTok, Facebook, YouTube, X, or Bluesky needs fresh consent; `pending_page_selection` when a Facebook or Meta Ads connection exists but no Page has been chosen. | ## Endpoints - `GET /api/v1/accounts` — [List accounts](https://www.tryadeli.com/docs/api/accounts/list-accounts.md) - `GET /api/v1/profiles/{profileId}/accounts` — [List profile accounts](https://www.tryadeli.com/docs/api/accounts/list-profile-accounts.md) - `GET /api/v1/profiles/{profileId}/accounts/{accountId}` — [Get account](https://www.tryadeli.com/docs/api/accounts/get-account.md) - `PATCH /api/v1/profiles/{profileId}/accounts/{accountId}` — [Update X account](https://www.tryadeli.com/docs/api/accounts/update-x-account.md) - `POST /api/v1/profiles/{profileId}/accounts/refresh` — [Refresh tokens](https://www.tryadeli.com/docs/api/accounts/refresh-tokens.md) - `DELETE /api/v1/profiles/{profileId}/accounts/{accountId}` — [Disconnect account](https://www.tryadeli.com/docs/api/accounts/disconnect-account.md) ## Permission state Every connected account reports exact `grantedPermissions`, advisory `recommendedPermissions` and `missingRecommendedPermissions`, per-feature `capabilities`, `capabilityRequirements` with required/missing permissions and resources, and a structured `reconnect` action. Missing recommended permissions do not change `connectionStatus`: a usable partial grant remains `connected`. Nullable provider identity fields mean narrow consent prevented hydration; reconnect with expanded consent updates the same `accountId`. Recommended permissions contain only grants Adeli's production configuration can request. Rejected Meta publishing, comments, and Insights permissions can still appear in a dormant capability's requirements, but they are not reconnect recommendations; unavailable dashboard controls stay hidden until those products can be used. Ads capabilities belong to the separate `meta_ads` account, never to a Facebook account, and use approved `ads_management` rather than rejected `ads_read`. ## List accounts URL: https://www.tryadeli.com/docs/api/accounts/list-accounts Markdown: https://www.tryadeli.com/docs/api/accounts/list-accounts.md Connected accounts across every profile in the organization. # List accounts > Connected accounts across every profile in the organization. Canonical: `GET https://app.tryadeli.com/api/v1/accounts` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Returns connected accounts across every profile in your organization, sorted by platform and then by id. Pass `profileId` to limit the list to one profile. Uses the [aggregate response contract](https://www.tryadeli.com/docs/concepts#partial-responses). Each account has the fields described in [The account object](https://www.tryadeli.com/docs/api/accounts#the-account-object), including the `profileId` it belongs to. **Query parameters** | Name | Type | Required | Description | | ----------- | ------------------------------------------------------------------------------------------------------------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `platform` | `"instagram" \| "tiktok" \| "tiktok_ads" \| "facebook" \| "youtube" \| "x" \| "bluesky" \| "linkedin" \| "linkedin_ads"` | | Narrow to one provider. | | `accountId` | `uuid` | | Narrow to one connection. It names its profile, so `profileId` can be left out. An id outside your organization returns `404 account_not_found`. | | `profileId` | `uuid` | | Optional. Limit the list to one profile; omit it to include every profile in your organization. A profile outside your organization returns `404 profile_not_found`. | **Errors** — `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`, `404 account_not_found`, `502 provider_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/accounts?platform=instagram" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/accounts?platform=instagram", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/accounts", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "platform": "instagram", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "status": "complete", "accounts": [ { "id": "00000000-0000-0000-0000-000000000000", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "platform": "instagram", "providerId": "17841400000000000", "displayName": "@adeli", "displayIdentifier": "adeli", "authMethod": "instagram_login", "connectionStatus": "connected" } ], "errors": [] } ``` ### 404 ```json { "error": { "code": "profile_not_found", "message": "Profile not found" } } ``` ## List profile accounts URL: https://www.tryadeli.com/docs/api/accounts/list-profile-accounts Markdown: https://www.tryadeli.com/docs/api/accounts/list-profile-accounts.md The same list, scoped by path instead of query. # List profile accounts > The same list, scoped by path instead of query. Canonical: `GET https://app.tryadeli.com/api/v1/profiles/{profileId}/accounts` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) The same `accounts` aggregate as [List accounts](https://www.tryadeli.com/docs/api/accounts/list-accounts), scoped by path instead of query. Takes no filters. Useful when your code already has the profile id in hand. **Path parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | -------------------------------------------------------------------------------- | | `profileId` | `uuid` | Yes | A profile in your organization. Any other value returns 404 profile\_not\_found. | **Errors** — `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`, `502 database_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) print(response.json()) ``` ## Responses ### 200 ```json { "status": "complete", "accounts": [ { "id": "00000000-0000-0000-0000-000000000000", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "platform": "instagram", "providerId": "17841400000000000", "displayName": "@adeli", "displayIdentifier": "adeli", "authMethod": "instagram_login", "connectionStatus": "connected" } ], "errors": [] } ``` ### 404 ```json { "error": { "code": "profile_not_found", "message": "Profile not found" } } ``` ## Get account URL: https://www.tryadeli.com/docs/api/accounts/get-account Markdown: https://www.tryadeli.com/docs/api/accounts/get-account.md One connected account, as a bare object. # Get account > One connected account, as a bare object. Canonical: `GET https://app.tryadeli.com/api/v1/profiles/{profileId}/accounts/{accountId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Returns a **bare** account object — no `status`, no `errors` wrapper. Its fields are described in [The account object](https://www.tryadeli.com/docs/api/accounts#the-account-object). **Path parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | ------------------------------------------------------------------------------------- | | `profileId` | `uuid` | Yes | A profile in your organization. Any other value returns 404 profile\_not\_found. | | `accountId` | `uuid` | Yes | A connected account in that profile. Any other value returns 404 account\_not\_found. | **Errors** — `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`, `404 account_not_found`, `502 database_error`. An X account adds `xCapabilities`, its paid background reads; see [Update X account](https://www.tryadeli.com/docs/api/accounts/update-x-account). ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts/00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts/00000000-0000-0000-0000-000000000000", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts/00000000-0000-0000-0000-000000000000", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) print(response.json()) ``` ## Responses ### 200 ```json { "id": "00000000-0000-0000-0000-000000000000", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "platform": "tiktok", "providerId": "app-scoped-open-id", "displayName": "Creator", "displayIdentifier": "creator", "connectionStatus": "connected" } ``` ### 404 ```json { "error": { "code": "account_not_found", "message": "Account not found" } } ``` ## Update X account URL: https://www.tryadeli.com/docs/api/accounts/update-x-account Markdown: https://www.tryadeli.com/docs/api/accounts/update-x-account.md Turn an X account's billed background reads on or off. # Update X account > Turn an X account's billed background reads on or off. Canonical: `PATCH https://app.tryadeli.com/api/v1/profiles/{profileId}/accounts/{accountId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Every X read is billed to you ([X API pricing](https://www.tryadeli.com/docs/pricing/x)), so the reads that would run in the background on an X account are off until you turn them on: `analytics` (post metrics and follower counts) and `inbox` (direct messages). Neither syncs anything yet; the switches are stored so that both features respect them when they arrive. Publishing and deleting always work. **Path parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `profileId` | `uuid` | Yes | A profile in your organization. Any other value returns 404 profile\_not\_found. | | `accountId` | `uuid` | Yes | An X account in that profile. Another platform's account returns 400 unsupported\_platform; any other value returns 404 account\_not\_found. | **Body** | Name | Type | Required | Description | | --------------- | -------- | -------- | ------------------------------------------------------------------------------------------------ | | `xCapabilities` | `object` | Yes | `{ analytics?: boolean, inbox?: boolean }`, at least one. Fields you leave out keep their value. | Returns the account with its updated `xCapabilities`. Turning `inbox` on needs the `dm.read` and `dm.write` permissions, which a connection made today has not granted: that returns `409 reconnect_required` with the missing scopes in `details.missingScopes`. **Errors** — `401 unauthorized`, `400 invalid_request`, `400 unsupported_platform` (not an X account), `404 profile_not_found`, `404 account_not_found`, `409 reconnect_required`, `502 database_error`. ## Request examples **cURL** ```bash curl -X PATCH "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts/00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "xCapabilities": { "analytics": true } }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts/00000000-0000-0000-0000-000000000000", { method: "PATCH", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ xCapabilities: { analytics: true, }, }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.patch( "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts/00000000-0000-0000-0000-000000000000", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "xCapabilities": { "analytics": True, }, }, ) print(response.json()) ``` ## Responses ### 200 ```json { "id": "00000000-0000-0000-0000-000000000000", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "platform": "x", "providerId": "1234567890", "displayName": "Adeli", "displayIdentifier": "adeli", "connectionStatus": "connected", "xCapabilities": { "analytics": true, "inbox": false } } ``` ### 409 ```json { "error": { "code": "reconnect_required", "message": "Reconnect this X account to grant dm.read, dm.write", "details": { "missingScopes": ["dm.read", "dm.write"] } } } ``` ## Refresh tokens URL: https://www.tryadeli.com/docs/api/accounts/refresh-tokens Markdown: https://www.tryadeli.com/docs/api/accounts/refresh-tokens.md Refresh the OAuth tokens of every connection in a profile. # Refresh tokens > Refresh the OAuth tokens of every connection in a profile. Canonical: `POST https://app.tryadeli.com/api/v1/profiles/{profileId}/accounts/refresh` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Attempts an OAuth token refresh for every Instagram, TikTok, Facebook, and YouTube connection in the profile. For YouTube it also re-reads the channel's title, avatar, and counts. Takes no body. Each account appears in the response only after its new token and expiry have been written, so a success here means the credential is durable, not merely fetched. An Instagram account connected with Unified Login (`authMethod: "unified_login"`) holds a token that does not expire and has nothing to refresh. For it, refresh checks that the token still works and returns `expiresAt: null`. A token your customer revoked comes back as a `connection_expired` error instead. > **Warning: expiresAt can be null** > > `expiresAt` is `null` for an Instagram account connected with Unified Login, > whose token does not expire. Earlier, every refreshed account returned a date. > Treat `null` as "no expiry to schedule against", not as a failure; the account > keeps working until its owner revokes access. > **Warning: This response is not a list of accounts** > > It uses the aggregate envelope with the `accounts` key, but the **elements are > a different shape** — refresh results, not account records. Code that reuses an > account parser here will not find `displayName` or `connectionStatus`. **Path parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | -------------------------------------------------------------------------------- | | `profileId` | `uuid` | Yes | A profile in your organization. Any other value returns 404 profile\_not\_found. | Per-account error codes: `provider_not_configured`, `connection_expired`, `account_not_found`, `provider_error`. **Errors** — `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`, `502 database_error`. ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts/refresh" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts/refresh", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts/refresh", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) print(response.json()) ``` ## Responses ### 200 ```json { "status": "partial", "accounts": [ { "id": "00000000-0000-0000-0000-000000000000", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "platform": "instagram", "refreshed": true, "expiresAt": "2026-11-07T12:00:00.000Z" } ], "errors": [ { "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000001", "code": "connection_expired", "message": "TikTok requires reconnection" } ] } ``` ### 404 ```json { "error": { "code": "profile_not_found", "message": "Profile not found" } } ``` ## Disconnect account URL: https://www.tryadeli.com/docs/api/accounts/disconnect-account Markdown: https://www.tryadeli.com/docs/api/accounts/disconnect-account.md Delete Adeli's credentials and cached history for one connection. # Disconnect account > Delete Adeli's credentials and cached history for one connection. Canonical: `DELETE https://app.tryadeli.com/api/v1/profiles/{profileId}/accounts/{accountId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Deletes Adeli's stored credentials and cached history for that connection. It never deletes the account, its posts, or its messages on the provider. For TikTok, YouTube, X, and Bluesky, Adeli first tries to revoke the authorization with the provider and then guarantees local deletion either way. X usage already recorded stays on your bill. `revocationFailed: true` means the local credential is gone but the provider may still list the authorization, and the customer can remove it from their TikTok settings or their [Google account permissions](https://security.google.com/settings/security/permissions). **Path parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | ------------------------------------------------------------------------------------- | | `profileId` | `uuid` | Yes | A profile in your organization. Any other value returns 404 profile\_not\_found. | | `accountId` | `uuid` | Yes | A connected account in that profile. Any other value returns 404 account\_not\_found. | **Errors** — `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`, `404 account_not_found`, `502 database_error`. ## Request examples **cURL** ```bash curl -X DELETE "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts/00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts/00000000-0000-0000-0000-000000000000", { method: "DELETE", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.delete( "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts/00000000-0000-0000-0000-000000000000", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) print(response.json()) ``` ## Responses ### 200 ```json { "id": "00000000-0000-0000-0000-000000000000", "disconnected": true } ``` ### 200 ```json { "id": "00000000-0000-0000-0000-000000000001", "disconnected": true, "revocationFailed": false } ``` ### 404 ```json { "error": { "code": "account_not_found", "message": "Account not found" } } ``` --- # Posts ## Posts URL: https://www.tryadeli.com/docs/api/posts Markdown: https://www.tryadeli.com/docs/api/posts.md List Instagram, Facebook, TikTok, YouTube, X, and Bluesky posts, and publish to all six. # Posts > List Instagram, Facebook, TikTok, YouTube, X, and Bluesky posts, and publish to all six. Canonical: One endpoint dispatches to every implemented provider, but availability is connection-specific. Fresh Facebook and Instagram-through-Facebook connections use Meta's approved-only configurations, which omit publishing permissions, so the dashboard hides both providers from Post and those tokens report `post.publish: false`. A valid direct or legacy Instagram/Facebook token is still evaluated from its actual grant and can use the implemented endpoints. For a capable token, a fully staged Instagram request returns `202` after durable acceptance and continues through Vercel Workflow; poll [Instagram publish status](https://www.tryadeli.com/docs/api/posts/get-instagram-publish-status). Legacy Instagram URL/base64 requests remain synchronous and return `201` after Meta publishes. X, Bluesky, and LinkedIn posts return `201`. TikTok and YouTube return `202`, and Facebook returns `202` for Reels or feed video, but those statuses represent provider-side asynchronous processing—not Vercel Workflow. See [Publish to LinkedIn](https://www.tryadeli.com/docs/api/posts/publish-linkedin) for the request, which publishes as a personal profile or an organization Page. **Workflow scope:** Instagram is currently the only provider using Adeli's Vercel Workflow-based publishing. Facebook and TikTok submit directly and then expose provider status. YouTube first streams the staged file to YouTube inside the initiating request (the page must stay open until acceptance), then exposes YouTube's processing status. X, Bluesky, and LinkedIn publish in the initiating request. Editing and deleting posts are deliberately not part of the public API in v1, except deleting an [X post](https://www.tryadeli.com/docs/api/posts/delete-x-post) or a [Bluesky post](https://www.tryadeli.com/docs/api/posts/delete-bluesky-post). ## Endpoints - `GET /api/v1/posts` — [List posts](https://www.tryadeli.com/docs/api/posts/list-posts.md) - `POST /api/v1/media/uploads` — [Prepare media uploads](https://www.tryadeli.com/docs/api/posts/create-media-uploads.md) - `POST /api/v1/publications` — [Publish to several accounts](https://www.tryadeli.com/docs/api/posts/create-publication.md) - `GET /api/v1/publications/{publicationId}` — [Publication status](https://www.tryadeli.com/docs/api/posts/get-publication.md) - `POST /api/v1/publications/{publicationId}/retry` — [Retry a publication](https://www.tryadeli.com/docs/api/posts/retry-publication.md) - `GET /api/v1/publications` — [List publications](https://www.tryadeli.com/docs/api/posts/list-publications.md) - `PATCH /api/v1/publications/{publicationId}` — [Update a publication](https://www.tryadeli.com/docs/api/posts/update-publication.md) - `POST /api/v1/publications/{publicationId}/publish` — [Publish a publication now](https://www.tryadeli.com/docs/api/posts/publish-publication.md) - `DELETE /api/v1/publications/{publicationId}` — [Cancel a publication](https://www.tryadeli.com/docs/api/posts/cancel-publication.md) - `POST /api/v1/posts` — [Publish to Instagram](https://www.tryadeli.com/docs/api/posts/publish-instagram.md) - `GET /api/v1/posts/instagram/status` — [Instagram publish status](https://www.tryadeli.com/docs/api/posts/get-instagram-publish-status.md) - `GET /api/v1/posts/instagram/stories` — [List Instagram stories](https://www.tryadeli.com/docs/api/posts/list-instagram-stories.md) - `POST /api/v1/posts` — [Publish to Facebook](https://www.tryadeli.com/docs/api/posts/publish-facebook.md) - `GET /api/v1/posts/facebook/status` — [Facebook video status](https://www.tryadeli.com/docs/api/posts/get-facebook-video-status.md) - `GET /api/v1/posts/tiktok/creator-info` — [TikTok creator info](https://www.tryadeli.com/docs/api/posts/get-tiktok-creator-info.md) - `POST /api/v1/posts` — [Publish to TikTok](https://www.tryadeli.com/docs/api/posts/publish-tiktok.md) - `GET /api/v1/posts/tiktok/status` — [TikTok publish status](https://www.tryadeli.com/docs/api/posts/get-tiktok-publish-status.md) - `POST /api/v1/posts` — [Publish to YouTube](https://www.tryadeli.com/docs/api/posts/publish-youtube.md) - `POST /api/v1/posts/youtube` — [Upload YouTube file](https://www.tryadeli.com/docs/api/posts/upload-youtube-video-file.md) - `GET /api/v1/posts/youtube/status` — [YouTube upload status](https://www.tryadeli.com/docs/api/posts/get-youtube-upload-status.md) - `POST /api/v1/posts` — [Publish to X](https://www.tryadeli.com/docs/api/posts/publish-x.md) - `DELETE /api/v1/posts/x/{postId}` — [Delete X post](https://www.tryadeli.com/docs/api/posts/delete-x-post.md) - `POST /api/v1/posts` — [Publish to Bluesky](https://www.tryadeli.com/docs/api/posts/publish-bluesky.md) - `POST /api/v1/posts` — [Publish to LinkedIn](https://www.tryadeli.com/docs/api/posts/publish-linkedin.md) - `DELETE /api/v1/posts/bluesky/{postId}` — [Delete Bluesky post](https://www.tryadeli.com/docs/api/posts/delete-bluesky-post.md) ## Publish to several accounts at once [Publish to several accounts](https://www.tryadeli.com/docs/api/posts/create-publication) takes shared content and media plus one entry per account, validates each account's post exactly as the single-platform endpoints do, and publishes to all of them in the background. Upload each local file once with `platforms` naming every target platform, then follow the whole publication with one status URL and one `progress` number, and [retry](https://www.tryadeli.com/docs/api/posts/retry-publication) only the accounts that failed. Give it a `scheduledFor` to [publish it later](https://www.tryadeli.com/docs/api/posts/create-publication#scheduling-and-drafts), or `draft: true` to save it, then [list](https://www.tryadeli.com/docs/api/posts/list-publications), [reschedule](https://www.tryadeli.com/docs/api/posts/update-publication), [publish now](https://www.tryadeli.com/docs/api/posts/publish-publication), or [cancel](https://www.tryadeli.com/docs/api/posts/cancel-publication) it. ## Upload local media first For every local image, GIF, video, carousel item, or thumbnail, call [Prepare media uploads](https://www.tryadeli.com/docs/api/posts/create-media-uploads), PUT the raw files directly to the returned S3 URLs with the exact returned headers, and publish with `{ "upload_id": "..." }` references. This avoids Vercel's 4.5 MB Function request-body limit. Legacy base64, public-URL, and multipart inputs remain compatible, but Adeli copies them into S3 internally and they are not recommended for large files. ## Media limits | Name | Type | Required | Description | | --------------------------------- | ----------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Instagram image` | `8 MiB` | | Decoded, per image. JPEG, PNG, and WebP in; normalized to JPEG. | | `Instagram video` | `300 MB` | | Stage MP4 for a Reel, Story, or carousel. Legacy inline base64 remains limited to 64 MiB decoded. | | `Instagram Reel` | `3 sec–15 min` | | Meta allows up to 300 MB. Inline MP4 is still bounded by the 64 MiB JSON-media limit. | | `Instagram video Story` | `3–60 sec` | | Meta allows up to 100 MB. Stories expire after 24 hours. | | `Instagram carousel` | `2–10 items` | | Images, videos, or both. Reels cannot be children. | | `Facebook photo` | `4 MiB` | | Decoded, per photo — lower than Instagram's limit. Meta rejects anything larger. | | `Facebook multi-photo` | `2–10 photos` | | | | `Facebook video` | `4 GiB staged` | | MP4, MOV, or WebM. Legacy inline MP4 base64 remains limited to 64 MiB. | | `TikTok video (JSON)` | `64 MiB` | | Decoded from base64, MP4 only. | | `TikTok video (multipart or URL)` | `1 GB` | | MP4, MOV, or WebM; 3 seconds up to the creator's maximum duration. Remote URLs must be public HTTPS, and are fetched with private-network, redirect, timeout, and size protections. | | `TikTok photo` | `20 MB` | | Per photo, 1–35 per post, normalized to JPEG at 1080×1920. Remote photo URLs are not accepted. | | `YouTube video` | `4 GiB staged` | | MP4, MOV, or WebM. Legacy public URL and multipart inputs remain compatible. | | `YouTube thumbnail` | `50 MB` | | JPEG or PNG; custom thumbnails need a verified channel. | | `X image` | `5 MB` | | JPEG, PNG, or WebP, up to 4 per post. The file's bytes must match its content\_type. | | `X GIF` | `15 MB` | | One per post, alone. | | `X video` | `512 MB` | | Stage MP4 or MOV. One per post, alone; legacy inline base64 remains constrained by the JSON body limit. | | `Bluesky image` | `20 MB in, 2 MB posted` | | JPEG, PNG, or WebP, up to 4 per post. Larger than 2 MB is resized to JPEG; a resized PNG loses transparency. | | `Bluesky video` | `100 MB` | | MP4 as base64 or from a public HTTPS URL. One per post, alone. Bluesky's own length and daily limits apply, read from Bluesky at upload time. | | `LinkedIn image` | `20 MB` | | One JPEG, PNG, or GIF with fewer than 40 million pixels. The file's bytes must match its content\_type. | | `JSON request body` | `96 MiB` | | Beyond this the request is rejected with 413 before parsing. | | `Multipart request` | `4 GiB` | | Total across all parts. | Staged upload references are the recommended form on `POST /api/v1/posts` for every provider. `multipart/form-data` on the shared route remains TikTok-only. Instagram uses JSON base64 or a public HTTPS video URL. YouTube file multipart uses its separate `POST /api/v1/posts/youtube` endpoint. ## Errors Beyond the shared codes in [Errors](https://www.tryadeli.com/docs/errors): | Name | Type | Required | Description | | --------------------------- | ----- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `unsupported_feature` | `422` | | You sent `scheduled_date`, `add_to_queue`, or `async_upload`. Scheduling is deferred. | | `invalid_post_settings` | `422` | | The privacy, comment, duet, or stitch setting is not available to this creator right now, or branded content was requested without public visibility. Re-query creator info. | | `media_url_unverified` | `422` | | TikTok has not verified this deployment's media URL prefix, which every TikTok post needs. | | `privacy_level_unsupported` | `422` | | A TikTok video asked for a privacy level other than PUBLIC\_TO\_EVERYONE. Publish it publicly, or send it as a MEDIA\_UPLOAD draft. | | `rate_limited` | `429` | | TikTok or LinkedIn is throttling the account or shared application. Retry after the returned delay when one is provided; Adeli does not automatically retry LinkedIn writes. | | `page_not_selected` | `409` | | The Facebook connection exists but no Page has been chosen yet. | | `permission_required` | `403` | | The connected credential is healthy but lacks this publish permission or resource. Restart the profile OAuth flow using the structured reconnect details. | | `quota_exhausted` | `429` | | YouTube's daily API quota, shared by every Adeli customer, is used up. The message says when it resets: midnight Pacific. | | `upload_limit_exceeded` | `422` | | The YouTube channel has reached YouTube's own upload limit, or the Bluesky account has reached its daily video limit or has not verified its email. Try again later. | | `provider_rejected` | `422` | | YouTube refused the video's metadata, such as an unknown category\_id. | | `x_billing_required` | `402` | | The workspace is on Free, and X needs a paid plan. See [X API pricing](https://www.tryadeli.com/docs/pricing/x). | | `usage_limit_reached` | `402` | | The workspace has sent its plan's posts: 10 in total on Free, or 10,000 this month on Starter. A publication is refused whole when its targets don't all fit. See [Billing](https://www.tryadeli.com/docs/billing#usage-limits). | | `duplicate_post` | `409` | | X refused the post because the account published the same text recently. | | `invalid_media` | `422` | | Media is invalid base64, does not match its declared content\_type, exceeds that provider's limit, or cannot be decoded. LinkedIn accepts one JPEG, PNG, or GIF image. | | `temporarily_unavailable` | `503` | | X is unavailable to Adeli for a while. Retry later. | | `unsupported_media_type` | `415` | | Content-Type must be `application/json` or `multipart/form-data`. | ## Publishing permission Before inspecting, staging, uploading, or billing media, Adeli checks the selected account's publish scope and provider-confirmed identity/resource. A partial connection without that access returns `403 permission_required`; use `error.details.missingPermissions`, `missingResources`, and `reconnect` to restart the profile's OAuth flow. An expired or revoked token remains a connection-expiry error. ## List posts URL: https://www.tryadeli.com/docs/api/posts/list-posts Markdown: https://www.tryadeli.com/docs/api/posts/list-posts.md Posts from every account in a profile, newest first. # List posts > Posts from every account in a profile, newest first. Canonical: `GET https://app.tryadeli.com/api/v1/posts` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Lists posts from the Instagram accounts, Facebook Pages, TikTok accounts, YouTube channels, and Bluesky accounts in one profile, newest first. Passing `platform=whatsapp` returns `422 unsupported_platform`. Uses the [aggregate response contract](https://www.tryadeli.com/docs/concepts#partial-responses), and follows each provider's pagination internally. TikTok is read 20 posts per request and rate-limited per account, so its listing stops at the 60 most recent posts. YouTube reads cost quota shared by every Adeli customer, so its listing is the 50 most recent videos per channel. X bills every post it returns ([X API pricing](https://www.tryadeli.com/docs/pricing/x)), so X is listed only when you ask for it with `platform=x` or an X `accountId`, and then only the 10 most recent posts. Bluesky lists the 10 most recent top-level posts per account, without replies or reposts; reposts are reported as `shares`. Posts waiting in a [scheduled publication](https://www.tryadeli.com/docs/api/posts/create-publication#scheduling-and-drafts) come first, soonest first, one per account, with `status: "scheduled"`, `scheduledFor`, and `publicationId`. Their `id` is the publication target's id; they have no `providerId`, `permalink`, or engagement until they are published. Every other post has `status: "published"`. **Query parameters** | Name | Type | Required | Description | | ----------- | ----------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------- | | `platform` | `"instagram" \| "facebook" \| "tiktok" \| "youtube" \| "x"` | | Optional. Narrow to one provider. X is listed only when asked for. | | `accountId` | `uuid` | | Narrow to one connected account. | | `profileId` | `uuid` | | Required unless you pass accountId, which names its profile. If you pass both, they must agree. | TikTok posts add `shares`, `views`, and `reach` to `engagement`, and their `media[].url` is TikTok's embeddable player. For watch time and retention, pass the `providerId` to [TikTok post insights](https://www.tryadeli.com/docs/api/analytics/tiktok-post-insights). YouTube videos add `views` to `engagement`; `caption` is the video's title and `media[].url` its watch page. Pass the `providerId` to [YouTube video insights](https://www.tryadeli.com/docs/api/analytics/youtube-video-insights) for watch time. X posts add `shares` (reposts) and `views` (impressions) to `engagement`; `comments` counts replies, and `caption` is the post's text. **Errors** — `401 unauthorized`, `400 invalid_request`, `422 unsupported_platform`, `404 profile_not_found`, `404 account_not_found`, `502 provider_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/posts?profileId=00000000-0000-4000-8000-000000000001" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/posts?profileId=00000000-0000-4000-8000-000000000001", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/posts", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "profileId": "00000000-0000-4000-8000-000000000001", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "status": "complete", "posts": [ { "id": "instagram_post_00000000-0000-0000-0000-000000000000_17900000000000000", "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "providerId": "17900000000000000", "caption": "Hello", "media": [{ "type": "IMAGE", "url": "https://...", "thumbnailUrl": "https://..." }], "permalink": "https://www.instagram.com/p/...", "engagement": { "likes": 12, "comments": 3 }, "publishedAt": "2026-04-01T12:00:00.000Z" }, { "id": "tiktok_post_00000000-0000-0000-0000-000000000002_7300000000000000000", "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000002", "profileId": "00000000-0000-4000-8000-000000000001", "providerId": "7300000000000000000", "caption": "Backyard birds", "media": [{ "type": "VIDEO", "url": "https://www.tiktok.com/player/v1/7300000000000000000", "thumbnailUrl": "https://p16-sign-va.tiktokcdn.com/..." }], "permalink": "https://www.tiktok.com/@creator/video/7300000000000000000", "engagement": { "likes": 30, "comments": 6, "shares": 4, "views": 2400, "reach": 1900 }, "publishedAt": "2026-03-30T12:00:00.000Z" } ], "errors": [] } ``` ### 422 ```json { "error": { "code": "unsupported_platform", "message": "Only Instagram, Facebook, TikTok, YouTube, X, and Bluesky posts are listed by this endpoint" } } ``` ## Prepare media uploads URL: https://www.tryadeli.com/docs/api/posts/create-media-uploads Markdown: https://www.tryadeli.com/docs/api/posts/create-media-uploads.md Create short-lived direct S3 PUTs for post media. # Prepare media uploads > Create short-lived direct S3 PUTs for post media. Canonical: `POST https://app.tryadeli.com/api/v1/media/uploads` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Create short-lived S3 PUT descriptors before publishing any local file. This is Adeli's recommended media transport for Instagram, Facebook, TikTok, YouTube, X, Bluesky, and LinkedIn. File bytes go directly to private S3 rather than through a Vercel Function. `clientId` is your correlation value and must be unique inside the request. Use `post_media` for normal media and `youtube_thumbnail` only for a YouTube JPEG or PNG thumbnail. Counts, MIME types, and sizes are checked against the selected platform before any capability is issued. For `linkedin`, a request declares up to 20 files: JPEG, PNG, or GIF images up to 20 MB each, an MP4 video up to 500 MB, or a PDF up to 100 MB. To post the same file to several platforms, send `platforms` (for example `["instagram", "tiktok", "youtube"]`) instead of `platform`. Each file is checked against every listed platform's limits, so it must fit the strictest of them, and its `uploadId` starts with `shared/staging/`. Use it in a [publication](https://www.tryadeli.com/docs/api/posts/create-publication), or in a single-platform post to any of the listed platforms. Give `platform` or `platforms`, not both. The `201` response has one entry per declaration: PUT the raw bytes to `url` with **every returned header unchanged**. Do not send your Adeli API key to S3 and do not add or alter metadata. URLs expire after ten minutes and grant access to one random object only. Uploads may run concurrently; use `clientId` to restore the original order. Then publish a small JSON request with staged references: ```json { "platform": "youtube", "profileId": "00000000-0000-4000-8000-000000000001", "accountId": "00000000-0000-4000-8000-000000000002", "title": "Launch", "privacy_status": "unlisted", "made_for_kids": false, "video": { "upload_id": "youtube/staging/opaque.mp4" }, "thumbnail": { "upload_id": "youtube/staging/opaque.jpg" } } ``` Before contacting a provider, Adeli verifies the object's organization, profile, platform, purpose, MIME declaration, and exact S3 byte length. Missing, expired, or mismatched media returns `422 invalid_media`. Retry initiation if a URL expires. Retrying a single PUT restarts that file; resumable S3 multipart upload is not part of this version. API keys belong on your server. Do not expose one in browser code or request broad customer-origin bucket CORS. ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/media/uploads" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "profileId": "00000000-0000-4000-8000-000000000001", "platform": "youtube", "files": [ { "clientId": "video", "purpose": "post_media", "contentType": "video/mp4", "size": 75497472, "filename": "launch.mp4" }, { "clientId": "thumb", "purpose": "youtube_thumbnail", "contentType": "image/jpeg", "size": 240000, "filename": "launch.jpg" } ] }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/media/uploads", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ profileId: "00000000-0000-4000-8000-000000000001", platform: "youtube", files: [ { clientId: "video", purpose: "post_media", contentType: "video/mp4", size: 75497472, filename: "launch.mp4", }, { clientId: "thumb", purpose: "youtube_thumbnail", contentType: "image/jpeg", size: 240000, filename: "launch.jpg", }, ], }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/media/uploads", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "profileId": "00000000-0000-4000-8000-000000000001", "platform": "youtube", "files": [ { "clientId": "video", "purpose": "post_media", "contentType": "video/mp4", "size": 75497472, "filename": "launch.mp4", }, { "clientId": "thumb", "purpose": "youtube_thumbnail", "contentType": "image/jpeg", "size": 240000, "filename": "launch.jpg", }, ], }, ) print(response.json()) ``` ## Responses ### 201 ```json { "uploads": [{ "clientId": "video", "uploadId": "youtube/staging/opaque.mp4", "method": "PUT", "url": "https://signed-s3-url.example/...", "headers": { "content-type": "video/mp4", "cache-control": "public, max-age=300", "x-amz-server-side-encryption": "AES256", "x-amz-meta-organization": "..." }, "expiresAt": "2026-10-26T12:10:00.000Z" }] } ``` ### 422 ```json { "error": { "code": "invalid_media", "message": "The media declaration exceeds the platform limit" } } ``` ## Publish to several accounts URL: https://www.tryadeli.com/docs/api/posts/create-publication Markdown: https://www.tryadeli.com/docs/api/posts/create-publication.md Publish one post to several connected accounts at once. # Publish to several accounts > Publish one post to several connected accounts at once. Canonical: `POST https://app.tryadeli.com/api/v1/publications` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Publish one post to several connected accounts in a single request. Shared `content` and `media` go to every account in `platforms`; each entry can override them and add that platform's own options. Adeli validates every account's post exactly as [the single-platform endpoints](https://www.tryadeli.com/docs/api/posts) would, accepts the publication durably, and publishes to every account in the background. **Body** | Name | Type | Required | Description | | ----------------------- | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `profileId` | `uuid` | | The profile. Optional: every accountId names its profile, and they must all agree. | | `content` | `string` | | The post's text: each platform's caption, message, text, or commentary. YouTube's title defaults to its first line and TikTok photo posts' title to its first 90 characters. | | `media` | `array` | | Shared media, in order: { upload\_id } from Prepare media uploads (name every target platform in its platforms), or { url } for a public HTTPS video. | | `platforms` | `array` | Yes | 1–20 targets. | | `platforms[].platform` | `string` | Yes | instagram, facebook, tiktok, youtube, x, bluesky, or linkedin. | | `platforms[].accountId` | `uuid` | Yes | The connected account to post from. | | `platforms[].kind` | `string` | | image, carousel, video, reel, or story. Inferred from the media when omitted: one video is a Reel on Instagram and Facebook and a video elsewhere. | | `platforms[].content` | `string` | | Replaces content for this account, for example a shorter caption for X. | | `platforms[].media` | `array` | | Replaces media for this account. Items may carry the platform's per-item fields, such as Instagram altText and userTags. | | `platforms[].options` | `object` | | This platform's create-post fields other than its text and media: TikTok's music\_usage\_confirmed and privacy\_level, YouTube's privacy\_status and made\_for\_kids, Instagram's collaborators, and so on. | | `scheduledFor` | `string` | | Publish later instead of now: ISO 8601 with a UTC offset, from one minute to 365 days ahead. | | `timeZone` | `string` | | The IANA zone the scheduled time was chosen in, such as America/New\_York. Kept only so the time can be shown back the same way. | | `draft` | `boolean` | | Save the publication as a draft instead of publishing it. Not with scheduledFor. | Every target is validated before anything is written. An invalid target answers `400` with each problem's path under `platforms[i]`; an account that is not in the profile answers `404`. Nothing is published in either case. ## Scheduling and drafts With `scheduledFor`, the publication is stored with `status: "scheduled"` and answered with `201`. Adeli publishes it within about a minute of that time, as if it had been created then, and each account's post also appears in [List posts](https://www.tryadeli.com/docs/api/posts/list-posts) with `status: "scheduled"` until it goes out. With `draft: true`, it is stored as a `draft` and published only when you [publish it](https://www.tryadeli.com/docs/api/posts/publish-publication) or give it a time with [Update a publication](https://www.tryadeli.com/docs/api/posts/update-publication). Either can be [canceled](https://www.tryadeli.com/docs/api/posts/cancel-publication) before it starts. Adeli keeps the staged media of a scheduled publication or draft until it is published or canceled, so staged uploads' one-day expiry does not apply to it. `{ url }` media is fetched when the publication is published, so the URL must still work then. Accounts are checked again at that time: an account that was disconnected or lost a permission in the meantime fails on its own, with its reason, and the rest still publish. Send an `Idempotency-Key` header to make retries safe. Repeating a key with the same body returns the original publication with `200` and publishes nothing new; the same key with a different body returns `409 idempotency_conflict`. On Free and Starter, every target counts as one post against the workspace's limit. If they don't all fit, the request returns [`402 usage_limit_reached`](https://www.tryadeli.com/docs/billing#usage-limits) and nothing is published. The `202` response (or `201` for a scheduled publication or draft) is the publication. Poll its `statusUrl` with [Publication status](https://www.tryadeli.com/docs/api/posts/get-publication) until `status` is `published`, `partial`, or `failed`. You can stop polling at any time: the platforms keep publishing. ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/publications" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: 8f6d2b1e-6a1f-4c55-9d0a-5d7c0a2f1e11" \ -d '{ "profileId": "00000000-0000-4000-8000-000000000001", "content": "Morning chorus over the pond", "media": [ { "upload_id": "shared/staging/opaque.mp4" } ], "platforms": [ { "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000010", "kind": "reel", "options": { "shareToFeed": true } }, { "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000011", "options": { "post_mode": "MEDIA_UPLOAD", "music_usage_confirmed": true } }, { "platform": "youtube", "accountId": "00000000-0000-0000-0000-000000000012", "options": { "privacy_status": "private", "made_for_kids": false } }, { "platform": "x", "accountId": "00000000-0000-0000-0000-000000000013", "content": "Morning chorus 🦆" } ] }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/publications", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", "Idempotency-Key": "8f6d2b1e-6a1f-4c55-9d0a-5d7c0a2f1e11", }, body: JSON.stringify({ profileId: "00000000-0000-4000-8000-000000000001", content: "Morning chorus over the pond", media: [ { upload_id: "shared/staging/opaque.mp4", }, ], platforms: [ { platform: "instagram", accountId: "00000000-0000-0000-0000-000000000010", kind: "reel", options: { shareToFeed: true, }, }, { platform: "tiktok", accountId: "00000000-0000-0000-0000-000000000011", options: { post_mode: "MEDIA_UPLOAD", music_usage_confirmed: true, }, }, { platform: "youtube", accountId: "00000000-0000-0000-0000-000000000012", options: { privacy_status: "private", made_for_kids: false, }, }, { platform: "x", accountId: "00000000-0000-0000-0000-000000000013", content: "Morning chorus 🦆", }, ], }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/publications", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}", "Idempotency-Key": "8f6d2b1e-6a1f-4c55-9d0a-5d7c0a2f1e11"}, json={ "profileId": "00000000-0000-4000-8000-000000000001", "content": "Morning chorus over the pond", "media": [ { "upload_id": "shared/staging/opaque.mp4", }, ], "platforms": [ { "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000010", "kind": "reel", "options": { "shareToFeed": True, }, }, { "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000011", "options": { "post_mode": "MEDIA_UPLOAD", "music_usage_confirmed": True, }, }, { "platform": "youtube", "accountId": "00000000-0000-0000-0000-000000000012", "options": { "privacy_status": "private", "made_for_kids": False, }, }, { "platform": "x", "accountId": "00000000-0000-0000-0000-000000000013", "content": "Morning chorus 🦆", }, ], }, ) print(response.json()) ``` ## Responses ### 202 ```json { "id": "00000000-0000-4000-8000-000000000020", "profileId": "00000000-0000-4000-8000-000000000001", "status": "queued", "progress": 0, "statusUrl": "/api/v1/publications/00000000-0000-4000-8000-000000000020", "createdAt": "2026-11-03T12:00:00.000Z", "updatedAt": "2026-11-03T12:00:00.000Z", "completedAt": null, "targets": [ { "id": "00000000-0000-4000-8000-000000000021", "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000010", "status": "queued", "attempts": 0, "result": null, "error": null }, { "id": "00000000-0000-4000-8000-000000000022", "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000011", "status": "queued", "attempts": 0, "result": null, "error": null } ] } ``` ### 400 ```json { "error": { "code": "invalid_request", "message": "Invalid publication", "details": [{ "code": "invalid_value", "path": ["platforms", 2, "privacy_status"], "message": "Invalid option: expected one of \"public\"|\"unlisted\"|\"private\"" }] } } ``` ## Publication status URL: https://www.tryadeli.com/docs/api/posts/get-publication Markdown: https://www.tryadeli.com/docs/api/posts/get-publication.md Follow a publication's overall progress and each account's outcome. # Publication status > Follow a publication's overall progress and each account's outcome. Canonical: `GET https://app.tryadeli.com/api/v1/publications/{publicationId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Check a publication that [Publish to several accounts](https://www.tryadeli.com/docs/api/posts/create-publication) accepted. The response has the same shape as the create response. **Path parameters** | Name | Type | Required | Description | | --------------- | ------ | -------- | -------------------------------- | | `publicationId` | `uuid` | Yes | The id from the create response. | `status` is `queued` or `processing` while any account is still running, then `published` (every account), `partial` (some), or `failed` (none). `progress` is every account's progress together, from 0 to 1: one number for one progress bar. Each target's `status` is `queued`, `submitting`, `processing` (accepted, and still processing on the platform), `published`, `failed`, or `outcome_unknown`. `result` is the body the single-platform endpoint returns for that platform, such as Instagram's job or X's permalink. `error` is a sanitized `{ code, message }`. `outcome_unknown` means the platform may have published the post but Adeli could not confirm it; check the platform before posting again. A publication outside the API key's organization returns `404`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/publications/00000000-0000-4000-8000-000000000020" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/publications/00000000-0000-4000-8000-000000000020", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/publications/00000000-0000-4000-8000-000000000020", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) print(response.json()) ``` ## Responses ### 200 ```json { "id": "00000000-0000-4000-8000-000000000020", "profileId": "00000000-0000-4000-8000-000000000001", "status": "partial", "progress": 1, "statusUrl": "/api/v1/publications/00000000-0000-4000-8000-000000000020", "createdAt": "2026-11-03T12:00:00.000Z", "updatedAt": "2026-11-03T12:02:00.000Z", "completedAt": "2026-11-03T12:02:00.000Z", "targets": [ { "id": "00000000-0000-4000-8000-000000000021", "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000011", "status": "published", "attempts": 1, "result": { "status": "SEND_TO_USER_INBOX" }, "error": null }, { "id": "00000000-0000-4000-8000-000000000022", "platform": "x", "accountId": "00000000-0000-0000-0000-000000000013", "status": "failed", "attempts": 1, "result": null, "error": { "code": "duplicate_post", "message": "X refused a duplicate post" } } ] } ``` ### 404 ```json { "error": { "code": "not_found", "message": "Publication not found" } } ``` ## Retry a publication URL: https://www.tryadeli.com/docs/api/posts/retry-publication Markdown: https://www.tryadeli.com/docs/api/posts/retry-publication.md Re-run only the accounts that failed. # Retry a publication > Re-run only the accounts that failed. Canonical: `POST https://app.tryadeli.com/api/v1/publications/{publicationId}/retry` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Re-run only the accounts of a finished publication that `failed`, with their original inputs. Accounts that published are left alone, and an account whose outcome is `outcome_unknown` is never retried, because its post may already be live. **Path parameters** | Name | Type | Required | Description | | --------------- | ------ | -------- | -------------------------------- | | `publicationId` | `uuid` | Yes | The id from the create response. | A retry is a real new attempt on each failed platform: it counts against TikTok's daily post limit and X bills it like any other post. The response is the publication with the retried targets back to `queued`, and `status` back to `processing`; poll [Publication status](https://www.tryadeli.com/docs/api/posts/get-publication) as before. While the publication is still running, or when no account failed, the request answers `409`. ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/publications/00000000-0000-4000-8000-000000000020/retry" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/publications/00000000-0000-4000-8000-000000000020/retry", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/publications/00000000-0000-4000-8000-000000000020/retry", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) print(response.json()) ``` ## Responses ### 202 ```json { "id": "00000000-0000-4000-8000-000000000020", "profileId": "00000000-0000-4000-8000-000000000001", "status": "processing", "progress": 0.5, "statusUrl": "/api/v1/publications/00000000-0000-4000-8000-000000000020", "createdAt": "2026-11-03T12:00:00.000Z", "updatedAt": "2026-11-03T12:05:00.000Z", "completedAt": null, "targets": [ { "id": "00000000-0000-4000-8000-000000000021", "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000011", "status": "published", "attempts": 1, "result": { "status": "SEND_TO_USER_INBOX" }, "error": null }, { "id": "00000000-0000-4000-8000-000000000022", "platform": "x", "accountId": "00000000-0000-0000-0000-000000000013", "status": "queued", "attempts": 1, "result": null, "error": null } ] } ``` ### 409 ```json { "error": { "code": "nothing_to_retry", "message": "No target failed, so there is nothing to retry" } } ``` ## List publications URL: https://www.tryadeli.com/docs/api/posts/list-publications Markdown: https://www.tryadeli.com/docs/api/posts/list-publications.md Scheduled posts, drafts, and past publications in a profile. # List publications > Scheduled posts, drafts, and past publications in a profile. Canonical: `GET https://app.tryadeli.com/api/v1/publications` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Lists publications in one profile. With `status=scheduled` they are listed soonest first, which makes this the way to see what is scheduled; every other listing is newest first. A post waiting in a scheduled publication also appears in [List posts](https://www.tryadeli.com/docs/api/posts/list-posts) with `status: "scheduled"`. **Query parameters** | Name | Type | Required | Description | | ----------- | --------- | -------- | -------------------------------------------------------------------------------------------------- | | `status` | `string` | | scheduled, draft, queued, processing, published, partial, failed, or canceled. Optional. | | `platform` | `string` | | Only publications with an account on this platform. | | `accountId` | `uuid` | | Only publications that post from this account. It names its profile, so profileId can be left out. | | `profileId` | `uuid` | | Required unless you pass accountId. If you pass both, they must agree. | | `cursor` | `string` | | nextCursor from the previous page. | | `limit` | `integer` | | 1–100 publications per page. Defaults to 25. | ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/publications?profileId=00000000-0000-4000-8000-000000000001&status=scheduled" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/publications?profileId=00000000-0000-4000-8000-000000000001&status=scheduled", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/publications", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "profileId": "00000000-0000-4000-8000-000000000001", "status": "scheduled", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "publications": [ { "id": "00000000-0000-4000-8000-000000000020", "profileId": "00000000-0000-4000-8000-000000000001", "status": "scheduled", "progress": 0, "scheduledFor": "2026-11-13T12:30:00.000Z", "timeZone": "America/New_York", "canceledAt": null, "statusUrl": "/api/v1/publications/00000000-0000-4000-8000-000000000020", "createdAt": "2026-11-10T15:00:00.000Z", "updatedAt": "2026-11-10T15:00:00.000Z", "completedAt": null, "targets": [ { "id": "00000000-0000-4000-8000-000000000021", "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000010", "status": "queued", "attempts": 0, "result": null, "error": null } ] } ], "nextCursor": null } ``` ### 400 ```json { "error": { "code": "invalid_request", "message": "Invalid publication filter", "details": [{ "code": "invalid_value", "path": ["status"], "message": "Invalid option: expected one of \"scheduled\"|\"draft\"|\"queued\"|\"processing\"|\"published\"|\"partial\"|\"failed\"|\"canceled\"" }] } } ``` ## Update a publication URL: https://www.tryadeli.com/docs/api/posts/update-publication Markdown: https://www.tryadeli.com/docs/api/posts/update-publication.md Reschedule a scheduled publication or draft, or replace its post. # Update a publication > Reschedule a scheduled publication or draft, or replace its post. Canonical: `PATCH https://app.tryadeli.com/api/v1/publications/{publicationId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Reschedules a scheduled publication or a draft, or replaces its post. A draft given a `scheduledFor` becomes scheduled. Only a publication that is still `scheduled` or a `draft` can change: once it has started, or was canceled, the request answers `409`. **Path parameters** | Name | Type | Required | Description | | --------------- | ------ | -------- | ----------------------------------------------------- | | `publicationId` | `uuid` | Yes | The id from the create response or List publications. | **Body** | Name | Type | Required | Description | | -------------- | -------- | -------- | -------------------------------------------------------------------------------------------------------------------- | | `scheduledFor` | `string` | | The new time, as ISO 8601 with a UTC offset, from one minute to 365 days ahead. | | `timeZone` | `string` | | The IANA zone the time was chosen in, such as America/New\_York. Kept only for display. | | `platforms` | `array` | | Replaces the whole post, with the same shape as Publish to several accounts. Required when content or media is sent. | | `content` | `string` | | The new shared text, with platforms. | | `media` | `array` | | The new shared media, with platforms. | A replaced post is validated exactly as [Publish to several accounts](https://www.tryadeli.com/docs/api/posts/create-publication) validates a new one. ## Request examples **cURL** ```bash curl -X PATCH "https://app.tryadeli.com/api/v1/publications/00000000-0000-4000-8000-000000000020" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "scheduledFor": "2026-11-14T08:00:00-05:00", "timeZone": "America/New_York" }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/publications/00000000-0000-4000-8000-000000000020", { method: "PATCH", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ scheduledFor: "2026-11-14T08:00:00-05:00", timeZone: "America/New_York", }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.patch( "https://app.tryadeli.com/api/v1/publications/00000000-0000-4000-8000-000000000020", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "scheduledFor": "2026-11-14T08:00:00-05:00", "timeZone": "America/New_York", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "id": "00000000-0000-4000-8000-000000000020", "profileId": "00000000-0000-4000-8000-000000000001", "status": "scheduled", "progress": 0, "scheduledFor": "2026-11-14T13:00:00.000Z", "timeZone": "America/New_York", "canceledAt": null, "statusUrl": "/api/v1/publications/00000000-0000-4000-8000-000000000020", "createdAt": "2026-11-10T15:00:00.000Z", "updatedAt": "2026-11-10T15:05:00.000Z", "completedAt": null, "targets": [ { "id": "00000000-0000-4000-8000-000000000021", "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000010", "status": "queued", "attempts": 0, "result": null, "error": null } ] } ``` ### 409 ```json { "error": { "code": "publication_in_progress", "message": "The publication has already started, so it can no longer be changed" } } ``` ## Publish a publication now URL: https://www.tryadeli.com/docs/api/posts/publish-publication Markdown: https://www.tryadeli.com/docs/api/posts/publish-publication.md Publish a scheduled publication or draft immediately. # Publish a publication now > Publish a scheduled publication or draft immediately. Canonical: `POST https://app.tryadeli.com/api/v1/publications/{publicationId}/publish` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Publishes a scheduled publication or a draft now, instead of at its time. The publication then runs exactly as one created without `scheduledFor`: poll [Publication status](https://www.tryadeli.com/docs/api/posts/get-publication) until `status` is `published`, `partial`, or `failed`. Once it has started, or was canceled, the request answers `409`. **Path parameters** | Name | Type | Required | Description | | --------------- | ------ | -------- | ----------------------------------------------------- | | `publicationId` | `uuid` | Yes | The id from the create response or List publications. | ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/publications/00000000-0000-4000-8000-000000000020/publish" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/publications/00000000-0000-4000-8000-000000000020/publish", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/publications/00000000-0000-4000-8000-000000000020/publish", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) print(response.json()) ``` ## Responses ### 202 ```json { "id": "00000000-0000-4000-8000-000000000020", "profileId": "00000000-0000-4000-8000-000000000001", "status": "queued", "progress": 0, "scheduledFor": "2026-11-13T12:30:00.000Z", "timeZone": "America/New_York", "canceledAt": null, "statusUrl": "/api/v1/publications/00000000-0000-4000-8000-000000000020", "createdAt": "2026-11-10T15:00:00.000Z", "updatedAt": "2026-11-10T15:10:00.000Z", "completedAt": null, "targets": [ { "id": "00000000-0000-4000-8000-000000000021", "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000010", "status": "queued", "attempts": 0, "result": null, "error": null } ] } ``` ### 409 ```json { "error": { "code": "publication_canceled", "message": "The publication was canceled" } } ``` ## Cancel a publication URL: https://www.tryadeli.com/docs/api/posts/cancel-publication Markdown: https://www.tryadeli.com/docs/api/posts/cancel-publication.md Cancel a scheduled publication or delete a draft. # Cancel a publication > Cancel a scheduled publication or delete a draft. Canonical: `DELETE https://app.tryadeli.com/api/v1/publications/{publicationId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Cancels a scheduled publication, or deletes a draft, before it is published. Its `status` becomes `canceled`, it is never published, and the media Adeli kept for it is deleted. Once it has started, the request answers `409`. **Path parameters** | Name | Type | Required | Description | | --------------- | ------ | -------- | ----------------------------------------------------- | | `publicationId` | `uuid` | Yes | The id from the create response or List publications. | ## Request examples **cURL** ```bash curl -X DELETE "https://app.tryadeli.com/api/v1/publications/00000000-0000-4000-8000-000000000020" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/publications/00000000-0000-4000-8000-000000000020", { method: "DELETE", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.delete( "https://app.tryadeli.com/api/v1/publications/00000000-0000-4000-8000-000000000020", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) print(response.json()) ``` ## Responses ### 200 ```json { "id": "00000000-0000-4000-8000-000000000020", "profileId": "00000000-0000-4000-8000-000000000001", "status": "canceled", "progress": 0, "scheduledFor": "2026-11-13T12:30:00.000Z", "timeZone": "America/New_York", "canceledAt": "2026-11-10T15:20:00.000Z", "statusUrl": "/api/v1/publications/00000000-0000-4000-8000-000000000020", "createdAt": "2026-11-10T15:00:00.000Z", "updatedAt": "2026-11-10T15:20:00.000Z", "completedAt": "2026-11-10T15:20:00.000Z", "targets": [ { "id": "00000000-0000-4000-8000-000000000021", "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000010", "status": "queued", "attempts": 0, "result": null, "error": null } ] } ``` ### 409 ```json { "error": { "code": "publication_in_progress", "message": "The publication has already started, so it can no longer be changed" } } ``` ## Publish to Instagram URL: https://www.tryadeli.com/docs/api/posts/publish-instagram Markdown: https://www.tryadeli.com/docs/api/posts/publish-instagram.md Publish an Instagram image, Reel, Story, or carousel. # Publish to Instagram > Publish an Instagram image, Reel, Story, or carousel. Canonical: `POST https://app.tryadeli.com/api/v1/posts` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Send `application/json` and provide exactly one of `image`, `images`, `reel`, `story`, or `carousel`. For local files, first [prepare direct uploads](https://www.tryadeli.com/docs/api/posts/create-media-uploads) and use `{ "upload_id": "..." }` in each ordered media position. Images may also use legacy JPEG/PNG/WebP base64; video may use legacy MP4 base64 or a public HTTPS URL. Every compatibility source is copied into Adeli's S3 boundary before Meta receives a verified CloudFront URL. **Body** | Name | Type | Required | Description | | --------------- | ------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `platform` | `"instagram"` | Yes | | | `accountId` | `uuid` | Yes | A connected Instagram account in your organization. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `caption` | `string` | | Feed posts, Reels, and carousel parents only. Up to 2,200 characters, 30 hashtags, and 20 `@` mentions. | | `image` | `object` | | One image: `{ contentType, base64, altText?, userTags? }`. | | `images` | `object[]` | | The backwards-compatible image-only carousel spelling: 2–10 objects shaped like `image`. | | `reel` | `object` | | One Reel, using the same video source shapes. Inline Reels must be 3 seconds–15 minutes. | | `shareToFeed` | `boolean` | | Reels only. `false` asks Instagram to keep it out of Feed; Reels-tab placement is still Meta's decision. | | `story` | `object` | | One image or video Story. Video Stories must be 3–60 seconds. Stories expire after 24 hours and may return no permalink. | | `carousel` | `object[]` | | 2–10 image/video items in order. Reels cannot be carousel children. | | `altText` | `string` | | Up to 1,000 characters. Feed images and carousel image children only. | | `userTags` | `object[]` | | Up to 20. Images use `{ username, x, y }`; videos use `{ username }`; Stories allow either. Coordinates are 0–1 fractions from the top-left. | | `thumbOffsetMs` | `integer` | | Non-negative thumbnail offset for Reels and carousel video children. | | `collaborators` | `string[]` | | Up to 3 usernames on images, Reels, and carousel parents. Not supported on Stories. | | `isAiGenerated` | `boolean` | | Adds Instagram's AI-generated label to the published container. It is not accepted on an individual carousel child. | A Reel can use inline MP4 or a public URL and adds Reel-level controls: ```json { "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "caption": "Morning flight", "collaborators": ["centralparkbirders"], "shareToFeed": true, "reel": { "contentType": "video/mp4", "base64": "..." } } ``` Stories take an image or video. They do not accept a caption, collaborators, alt text, or Reel controls: ```json { "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "story": { "url": "https://media.example.com/story.mp4", "userTags": [{ "username": "birder" }] } } ``` An image Story uses base64 and may place a tag with both coordinates: ```json { "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "story": { "contentType": "image/jpeg", "base64": "...", "userTags": [{ "username": "birder", "x": 0.3, "y": 0.7 }] } } ``` Use `carousel` for videos or mixed media. `images` remains supported for existing image-only clients: ```json { "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "caption": "Two backyard birds #birding", "collaborators": ["centralparkbirders"], "carousel": [ { "contentType": "image/webp", "base64": "...", "altText": "A cardinal on a snowy branch" }, { "url": "https://media.example.com/titmouse.mp4", "thumbOffsetMs": 500 } ] } ``` Unknown or media-incompatible fields are rejected with `400 invalid_request` rather than ignored. A tagged person or collaborator Instagram cannot resolve fails with `422 provider_rejected` and Instagram's safe end-user explanation. When every media item is a staged `{ "upload_id": "..." }`, Adeli durably accepts the request with `202`. A Vercel Workflow continues Meta container processing and publication after the request ends. Instagram is currently the only provider whose Adeli publishing path uses Vercel Workflow; other providers' `202` responses describe provider-side processing. Poll the returned `statusUrl`; see [Instagram publish status](https://www.tryadeli.com/docs/api/posts/get-instagram-publish-status). Legacy base64 and public-URL inputs remain synchronous and return the normalized post with `201` during the compatibility migration. `GET /api/v1/posts` does not list Stories because Meta exposes active Stories separately. The signed-in **Post** page supports the same Reel, Story, and mixed carousel choices with local files. It accepts MP4 video (up to 300 MiB, or 100 MiB for a video Story), uploads directly to S3, and reports durable acceptance. Instagram continues processing after the user closes the page. **Errors** — [`402 usage_limit_reached`](https://www.tryadeli.com/docs/billing#usage-limits), `400 invalid_request`, `413 invalid_request`, `415 unsupported_media_type`, `422 invalid_image`, `422 invalid_video`, `422 connection_expired`, `422 provider_not_configured`, `422 provider_rejected`, `404 account_not_found`, `404 profile_not_found`, `502 provider_error`. ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/posts" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "caption": "Hello", "image": { "upload_id": "opaque-upload-id" } }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/posts", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ platform: "instagram", accountId: "00000000-0000-0000-0000-000000000000", caption: "Hello", image: { upload_id: "opaque-upload-id", }, }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/posts", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "caption": "Hello", "image": { "upload_id": "opaque-upload-id", }, }, ) print(response.json()) ``` ## Responses ### 202 ```json { "jobId": "00000000-0000-4000-8000-000000000002", "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "status": "queued", "statusUrl": "/api/v1/posts/instagram/status?jobId=00000000-0000-4000-8000-000000000002&profileId=00000000-0000-4000-8000-000000000001" } ``` ### 422 ```json { "error": { "code": "connection_expired", "message": "Instagram connection has expired" } } ``` ## Instagram publish status URL: https://www.tryadeli.com/docs/api/posts/get-instagram-publish-status Markdown: https://www.tryadeli.com/docs/api/posts/get-instagram-publish-status.md Poll a staged Instagram publish until it completes or fails. # Instagram publish status > Poll a staged Instagram publish until it completes or fails. Canonical: `GET https://app.tryadeli.com/api/v1/posts/instagram/status` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Polls an Instagram post that [Publish to Instagram](https://www.tryadeli.com/docs/api/posts/publish-instagram) accepted with `202`. The job is scoped to the API key's organization and the selected profile. **Query parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | ---------------------------------------------------------------------------------------- | | `jobId` | `uuid` | Yes | From the accepted publish response. | | `profileId` | `uuid` | | The profile returned with the job. Omit only when the organization has a single profile. | `status` is `queued`, `processing`, `published`, `failed`, or `outcome_unknown`. Keep polling while it is `queued` or `processing`. A `published` response carries the normalized `post`. A `failed` response carries a sanitized `error`. `outcome_unknown` means Meta may have accepted the final publish write but Adeli did not receive its response; Adeli does not retry that write because doing so could create a duplicate post. Responses use `cache-control: no-store`. A job outside the authenticated organization/profile scope returns `404`, so job IDs do not reveal another tenant's publication state. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/posts/instagram/status?jobId=00000000-0000-4000-8000-000000000002&profileId=00000000-0000-4000-8000-000000000001" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/posts/instagram/status?jobId=00000000-0000-4000-8000-000000000002&profileId=00000000-0000-4000-8000-000000000001", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/posts/instagram/status", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "jobId": "00000000-0000-4000-8000-000000000002", "profileId": "00000000-0000-4000-8000-000000000001", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "jobId": "00000000-0000-4000-8000-000000000002", "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "status": "published", "statusUrl": "/api/v1/posts/instagram/status?jobId=00000000-0000-4000-8000-000000000002&profileId=00000000-0000-4000-8000-000000000001", "post": { "providerId": "17900000000000000", "permalink": "https://www.instagram.com/p/..." } } ``` ### 200 ```json { "jobId": "00000000-0000-4000-8000-000000000002", "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "status": "failed", "statusUrl": "/api/v1/posts/instagram/status?jobId=00000000-0000-4000-8000-000000000002&profileId=00000000-0000-4000-8000-000000000001", "error": { "code": "provider_rejected", "message": "Instagram could not process this media" } } ``` ### 404 ```json { "error": { "code": "not_found", "message": "Instagram publish job not found" } } ``` ## List Instagram stories URL: https://www.tryadeli.com/docs/api/posts/list-instagram-stories Markdown: https://www.tryadeli.com/docs/api/posts/list-instagram-stories.md List an Instagram account's live stories, with when each expires. # List Instagram stories > List an Instagram account's live stories, with when each expires. Canonical: `GET https://app.tryadeli.com/api/v1/posts/instagram/stories` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) List an Instagram account's active stories: everything it posted in the last 24 hours, newest first. Use it to let someone pick a story, for example to run an automation only on replies to that story: the story's `id` is the `story.id` on its replies, and passing it as `storyId` to [List messages](https://www.tryadeli.com/docs/api/messages/list-messages) returns everyone who replied. The list comes live from Instagram on every call, so a story posted a moment ago shows up straight away, and one that has expired is gone. **Query parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | --------------------------------------------------------------------------------- | | `accountId` | `uuid` | Yes | The connected Instagram account. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | Each story has: **Story fields** | Name | Type | Required | Description | | ------------------ | ---------------- | -------- | ------------------------------------------------------------------------------------ | | `id` | `string` | | The story's Instagram media id. | | `mediaType` | `string \| null` | | IMAGE or VIDEO. | | `mediaProductType` | `string` | | Always STORY. | | `mediaUrl` | `string \| null` | | The image or video. Null for a video with licensed music; show thumbnailUrl instead. | | `thumbnailUrl` | `string \| null` | | A video story's cover image. Null for images. | | `permalink` | `string \| null` | | The story on Instagram. It opens only while the story is live. | | `timestamp` | `date-time` | | When the story was posted. | | `expiresAt` | `date-time` | | When the story stops being live, 24 hours after timestamp. | > **Note: Only live stories** > > Instagram keeps a story for 24 hours, and so does this list. Media URLs stop > working when the story expires, so copy anything you want to keep. Live > video broadcasts and stories reshared from other accounts are never > included. The account needs the basic read permission that every Instagram connection has. An account with no live stories returns `"stories": []`. **Errors** — `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`, `404 account_not_found`, `403 permission_required` with missing permission and reconnect details, `422 connection_expired`, `502 provider_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/posts/instagram/stories?accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/posts/instagram/stories?accountId=00000000-0000-0000-0000-000000000000", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/posts/instagram/stories", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "stories": [ { "id": "17900000000000003", "mediaType": "VIDEO", "mediaProductType": "STORY", "mediaUrl": null, "thumbnailUrl": "https://scontent.cdninstagram.com/v/story-cover.jpg", "permalink": "https://instagram.com/stories/acmecoffee/3480000000000000003", "timestamp": "2026-11-10T15:20:00.000Z", "expiresAt": "2026-11-11T15:20:00.000Z" }, { "id": "17900000000000002", "mediaType": "IMAGE", "mediaProductType": "STORY", "mediaUrl": "https://scontent.cdninstagram.com/v/story.jpg", "thumbnailUrl": null, "permalink": "https://instagram.com/stories/acmecoffee/3480000000000000002", "timestamp": "2026-11-10T09:05:00.000Z", "expiresAt": "2026-11-11T09:05:00.000Z" } ] } ``` ### 404 ```json { "error": { "code": "account_not_found", "message": "Instagram account not found" } } ``` ## Publish to Facebook URL: https://www.tryadeli.com/docs/api/posts/publish-facebook Markdown: https://www.tryadeli.com/docs/api/posts/publish-facebook.md Publish photos, a multi-photo post, a Reel, or a video to a Facebook Page. # Publish to Facebook > Publish photos, a multi-photo post, a Reel, or a video to a Facebook Page. Canonical: `POST https://app.tryadeli.com/api/v1/posts` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) For local media, first [prepare direct uploads](https://www.tryadeli.com/docs/api/posts/create-media-uploads) and use `{ "upload_id": "..." }` for each photo or video. Legacy base64 remains accepted and is staged internally before Meta receives an Adeli CloudFront URL. Four shapes, chosen by which media field you send rather than by a kind string, so an impossible combination cannot be expressed. As with Instagram, media is staged on Adeli's HTTPS media host because Meta fetches it by URL. | Name | Type | Required | Description | | ----------- | ------------ | -------- | ---------------------------------------------------------------- | | `platform` | `"facebook"` | Yes | | | `accountId` | `uuid` | Yes | A connected Facebook Page in your organization. | | `message` | `string` | | Up to 2200 characters. The caption shown with the post. | | `image` | `object` | | One photo — `contentType` and `base64`. Publishes synchronously. | | `images` | `object[]` | | 2–10 photos, published as one multi-photo post. Synchronous. | | `reel` | `object` | | One vertical video, published as a Reel. Asynchronous. | | `video` | `object` | | One video, published to the Page feed. Asynchronous. | | `title` | `string` | | Only valid alongside `video`. Up to 255 characters. | A photo response is the same normalized post Instagram returns, with `platform: "facebook"`. A Reel or feed video returns `202` with a `publishId`; pass it to [Facebook video status](https://www.tryadeli.com/docs/api/posts/get-facebook-video-status). > **Note: A Page must be chosen first** > > A Facebook account in `pending_page_selection` has no Page token and cannot > publish. Every write against it returns `409 page_not_selected` until your > customer picks a Page. See [Connect](https://www.tryadeli.com/docs/api/connect#provider-requirements). ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/posts" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "platform": "facebook", "accountId": "00000000-0000-0000-0000-000000000000", "message": "Hello", "image": { "contentType": "image/jpeg", "base64": "" } }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/posts", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ platform: "facebook", accountId: "00000000-0000-0000-0000-000000000000", message: "Hello", image: { contentType: "image/jpeg", base64: "", }, }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/posts", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "platform": "facebook", "accountId": "00000000-0000-0000-0000-000000000000", "message": "Hello", "image": { "contentType": "image/jpeg", "base64": "", }, }, ) print(response.json()) ``` ## Responses ### 201 ```json { "id": "facebook_post_00000000-0000-0000-0000-000000000000_100000000000000_200000000000000", "platform": "facebook", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "providerId": "100000000000000_200000000000000", "caption": "Hello", "media": [{ "type": "IMAGE", "url": "https://...", "thumbnailUrl": "https://..." }], "permalink": "https://www.facebook.com/...", "engagement": { "likes": null, "comments": null }, "publishedAt": "2026-04-01T12:00:00.000Z" } ``` ### 202 ```json { "platform": "facebook", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-0000-0000-000000000000", "publishId": "1234567890", "status": "ACCEPTED", "statusUrl": "/api/v1/posts/facebook/status?accountId=...&profileId=...&publishId=1234567890" } ``` ### 409 ```json { "error": { "code": "page_not_selected", "message": "Choose a Facebook Page first" } } ``` ## Facebook video status URL: https://www.tryadeli.com/docs/api/posts/get-facebook-video-status Markdown: https://www.tryadeli.com/docs/api/posts/get-facebook-video-status.md Check whether a Facebook Page video has finished publishing. # Facebook video status > Check whether a Facebook Page video has finished publishing. Canonical: `GET https://app.tryadeli.com/api/v1/posts/facebook/status` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Polls a Reel or feed video that [Publish to Facebook](https://www.tryadeli.com/docs/api/posts/publish-facebook) accepted with `202`. Photos publish synchronously and have nothing to poll. **Query parameters** | Name | Type | Required | Description | | ----------- | -------- | -------- | --------------------------------------------------------------------------------- | | `accountId` | `uuid` | Yes | | | `publishId` | `string` | Yes | From the publish response. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | `status` is `PROCESSING`, `READY`, or `ERROR`. A `READY` response carries `permalink`; an `ERROR` carries `failureReason`, which is Meta's own account of what was wrong with the video — usually its length or aspect ratio. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/posts/facebook/status?accountId=00000000-0000-0000-0000-000000000000&publishId=1234567890" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/posts/facebook/status?accountId=00000000-0000-0000-0000-000000000000&publishId=1234567890", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/posts/facebook/status", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", "publishId": "1234567890", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "facebook", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "publishId": "1234567890", "status": "READY", "phase": "complete", "permalink": "https://www.facebook.com/reel/1234567890", "failureReason": null } ``` ### 422 ```json { "error": { "code": "connection_expired", "message": "Facebook connection requires reconnecting" } } ``` ## TikTok creator info URL: https://www.tryadeli.com/docs/api/posts/get-tiktok-creator-info Markdown: https://www.tryadeli.com/docs/api/posts/get-tiktok-creator-info.md What a TikTok creator currently allows, to read before a Direct Post. # TikTok creator info > What a TikTok creator currently allows, to read before a Direct Post. Canonical: `GET https://app.tryadeli.com/api/v1/posts/tiktok/creator-info` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Recommended before a Direct Post: TikTok revalidates what the creator currently allows, and those capabilities change. Use the response to build your UI and to pick a legal photo `privacy_level` for [Publish to TikTok](https://www.tryadeli.com/docs/api/posts/publish-tiktok). `nickname` is the account's display name. **Query parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | --------------------------------------------------------------------------------- | | `accountId` | `uuid` | Yes | A connected TikTok account. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/posts/tiktok/creator-info?accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/posts/tiktok/creator-info?accountId=00000000-0000-0000-0000-000000000000", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/posts/tiktok/creator-info", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "creator": { "nickname": "Creator", "privacyLevelOptions": ["PUBLIC_TO_EVERYONE", "MUTUAL_FOLLOW_FRIENDS", "SELF_ONLY"], "commentDisabled": false, "duetDisabled": false, "stitchDisabled": false, "maxVideoPostDurationSec": 600 } } ``` ### 422 ```json { "error": { "code": "connection_expired", "message": "TikTok connection requires reconnecting" } } ``` ## Publish to TikTok URL: https://www.tryadeli.com/docs/api/posts/publish-tiktok Markdown: https://www.tryadeli.com/docs/api/posts/publish-tiktok.md Publish a TikTok video, photo, or carousel. # Publish to TikTok > Publish a TikTok video, photo, or carousel. Canonical: `POST https://app.tryadeli.com/api/v1/posts` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) For local media, first [prepare direct uploads](https://www.tryadeli.com/docs/api/posts/create-media-uploads) and publish with staged `{ "upload_id": "..." }` video or photo references. Legacy multipart, base64, and public-video URL forms remain accepted and are copied into Adeli S3 before TikTok pulls a verified CloudFront URL. TikTok publishing is asynchronous. A successful request means TikTok accepted the content, not that it is live. Adeli publishes through TikTok API for Business, which pulls every video and photo from a URL: whatever you send — base64, multipart, or a URL — Adeli stages it on its own verified media host first. > **Note: Videos are public or drafts** > > TikTok for Business has no privacy setting for videos. A `DIRECT_POST` video > is published to everyone, so its `privacy_level` must be > `PUBLIC_TO_EVERYONE` or left out; anything else is > `422 privacy_level_unsupported` rather than a post that is more public than > you asked for. To keep a video private, send `post_mode: "MEDIA_UPLOAD"`: it > arrives as a draft in the creator's TikTok inbox. Photo posts accept every > `privacy_level` the creator currently allows. TikTok allows 15 API posts per account per day. Before a Direct Post, [check creator capabilities](https://www.tryadeli.com/docs/api/posts/get-tiktok-creator-info) first. **Body** | Name | Type | Required | Description | | --------------------------- | --------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `platform` | `"tiktok"` | Yes | | | `accountId` | `uuid` | Yes | A connected TikTok account. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `post_mode` | `"DIRECT_POST" \| "MEDIA_UPLOAD"` | | Defaults to `DIRECT_POST`, which publishes. `MEDIA_UPLOAD` sends a draft to the creator's TikTok inbox to finish in the app; a video draft carries the media only, a photo draft its title and description too. | | `tiktok_title` | `string` | | Up to 2,200 characters for a video, and up to 90 for photos. | | `tiktok_description` | `string` | | Up to 4,000 characters. Photo posts only. | | `privacy_level` | `string` | | Videos: `PUBLIC_TO_EVERYONE` or omitted. Photos: one of `PUBLIC_TO_EVERYONE`, `MUTUAL_FOLLOW_FRIENDS`, `FOLLOWER_OF_CREATOR`, `SELF_ONLY` that the creator currently allows; defaults to `PUBLIC_TO_EVERYONE`. | | `music_usage_confirmed` | `true` | Yes | Must be literally true. You are confirming the creator agreed to TikTok's music usage terms. | | `remove_editor_attribution` | `boolean` | | Strip CapCut and other video editors' tags before TikTok receives the video, so TikTok does not credit that editor. Defaults to true. | | `disable_comment` | `boolean` | | Defaults to false. | | `disable_duet` | `boolean` | | Video only. Defaults to false. | | `disable_stitch` | `boolean` | | Video only. Defaults to false. | | `cover_timestamp` | `integer` | | Video only. Milliseconds into the video to use as the cover. Defaults to 1000. | | `photo_cover_index` | `integer` | | Photos only. Defaults to 0, and must be less than the number of photos. | | `auto_add_music` | `boolean` | | Photos only. Defaults to false. | | `is_aigc` | `boolean` | | Marks the content as AI-generated. Defaults to false. | | `brand_content_toggle` | `boolean` | | Paid partnership. Requires `privacy_level: \"PUBLIC_TO_EVERYONE\"` on a Direct Post. | | `brand_organic_toggle` | `boolean` | | Promotes the creator's own brand. | | `video` | `object` | | Either `{ content_type: "video/mp4", base64 }` or `{ url }` pointing at public HTTPS. Mutually exclusive with `photos`. | | `photos` | `object[]` | | 1 to 35 photos, each `{ content_type, base64 }`. Remote photo URLs are not accepted. Mutually exclusive with `video`. | > **Note: Exactly one of video or photos** > > Sending both, or neither, is `400 invalid_request`. The request example sends a video from a public URL to the creator's inbox. A video published publicly: ```json { "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "tiktok_title": "Morning chorus #birds", "privacy_level": "PUBLIC_TO_EVERYONE", "disable_duet": false, "disable_stitch": true, "music_usage_confirmed": true, "video": { "url": "https://media.example/video.mp4" } } ``` A photo carousel posted directly, visible only to the creator: ```json { "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "post_mode": "DIRECT_POST", "tiktok_title": "Backyard birds", "tiktok_description": "Cardinal, Titmouse, and Robin", "privacy_level": "SELF_ONLY", "photo_cover_index": 0, "auto_add_music": false, "music_usage_confirmed": true, "photos": [ { "content_type": "image/webp", "base64": "..." }, { "content_type": "image/jpeg", "base64": "..." } ] } ``` ## Multipart uploads For large videos, send `multipart/form-data` instead. Scalar fields use the same names, booleans must be the strings `"true"` or `"false"`, and the media is either one `video` file or 1–35 repeated `photos[]` files. Multipart is TikTok only. ```bash curl -X POST "https://app.tryadeli.com/api/v1/posts" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -F 'platform=tiktok' \ -F "accountId=$ACCOUNT_ID" \ -F 'post_mode=DIRECT_POST' \ -F 'privacy_level=PUBLIC_TO_EVERYONE' \ -F 'tiktok_title=Morning chorus' \ -F 'music_usage_confirmed=true' \ -F 'video=@video.mp4;type=video/mp4' ``` ```bash curl -X POST "https://app.tryadeli.com/api/v1/posts" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -F 'platform=tiktok' \ -F "accountId=$ACCOUNT_ID" \ -F 'post_mode=MEDIA_UPLOAD' \ -F 'music_usage_confirmed=true' \ -F 'photos[]=@cardinal.webp;type=image/webp' \ -F 'photos[]=@robin.jpg;type=image/jpeg' ``` ## The response Success returns `202` with a `publishId`. Pass it to [TikTok publish status](https://www.tryadeli.com/docs/api/posts/get-tiktok-publish-status) to learn whether the post went live. > **Note: statusUrl is a relative path** > > Join it to your base URL before requesting it. `warnings` is present only when > non-empty — inbox uploads report the settings TikTok ignored, since a video > sent to the inbox carries media and nothing else. ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/posts" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "post_mode": "MEDIA_UPLOAD", "tiktok_title": "Bird video", "music_usage_confirmed": true, "video": { "url": "https://media.example/video.mp4" } }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/posts", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ platform: "tiktok", accountId: "00000000-0000-0000-0000-000000000000", post_mode: "MEDIA_UPLOAD", tiktok_title: "Bird video", music_usage_confirmed: true, video: { url: "https://media.example/video.mp4", }, }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/posts", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "post_mode": "MEDIA_UPLOAD", "tiktok_title": "Bird video", "music_usage_confirmed": True, "video": { "url": "https://media.example/video.mp4", }, }, ) print(response.json()) ``` ## Responses ### 202 ```json { "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "publishId": "v_pub_url~v1.2345123456789123456", "status": "ACCEPTED", "statusUrl": "/api/v1/posts/tiktok/status?accountId=...&profileId=...&publishId=...", "warnings": [ { "code": "video_draft_media_only", "message": "TikTok video drafts receive media only; post settings must be completed in TikTok" } ] } ``` ### 422 ```json { "error": { "code": "privacy_level_unsupported", "message": "TikTok videos publish publicly; use PUBLIC_TO_EVERYONE, or post_mode MEDIA_UPLOAD to send a draft" } } ``` ## TikTok publish status URL: https://www.tryadeli.com/docs/api/posts/get-tiktok-publish-status Markdown: https://www.tryadeli.com/docs/api/posts/get-tiktok-publish-status.md Poll a TikTok publish until it completes or fails. # TikTok publish status > Poll a TikTok publish until it completes or fails. Canonical: `GET https://app.tryadeli.com/api/v1/posts/tiktok/status` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Polls a post that [Publish to TikTok](https://www.tryadeli.com/docs/api/posts/publish-tiktok) accepted with `202`. **Query parameters** | Name | Type | Required | Description | | ----------- | -------- | -------- | --------------------------------------------------------------------------------- | | `accountId` | `uuid` | Yes | | | `publishId` | `string` | Yes | From the publish response. 1–200 characters of \[A-Za-z0-9.\_\~-]. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | **Fields** | Name | Type | Required | Description | | ------------------- | ------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `status` | `string` | | `PROCESSING_DOWNLOAD` while TikTok fetches the media; then `PUBLISH_COMPLETE`, `SEND_TO_USER_INBOX` (a draft was delivered), or `FAILED`. The last three are final. | | `publicPostIds` | `string[]` | | The TikTok post ids, once the post is public. They can arrive up to a few minutes after PUBLISH\_COMPLETE, so keep polling until they do. Absent for posts that are not public. | | `failureReason` | `string \| null` | | TikTok's machine-readable reason when `FAILED`, such as `frame_rate_check_failed`, `video_pull_failed`, or `spam_risk_too_many_posts` (the daily limit). | | `publiclyAvailable` | `boolean \| null` | | Whether the post is publicly viewable. `false` after TikTok reports it is no longer public — moderation, or the creator made it private. `null` when not yet known. | | `source` | `"webhook" \| "provider"` | | Whether the answer came from a TikTok webhook Adeli received or a live status call. | ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/posts/tiktok/status?accountId=00000000-0000-0000-0000-000000000000&publishId=v_pub_url%7Ev1.2345123456789123456" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/posts/tiktok/status?accountId=00000000-0000-0000-0000-000000000000&publishId=v_pub_url%7Ev1.2345123456789123456", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/posts/tiktok/status", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", "publishId": "v_pub_url~v1.2345123456789123456", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "publishId": "v_pub_url~v1.2345123456789123456", "status": "PUBLISH_COMPLETE", "publicPostId": "7300000000000000000", "publicPostIds": ["7300000000000000000"], "failureReason": null, "publiclyAvailable": true, "source": "webhook" } ``` ### 429 ```json { "error": { "code": "rate_limited", "message": "TikTok rate limit reached; retry later" } } ``` ## Publish to YouTube URL: https://www.tryadeli.com/docs/api/posts/publish-youtube Markdown: https://www.tryadeli.com/docs/api/posts/publish-youtube.md Upload a YouTube video or Short from a URL or base64. # Publish to YouTube > Upload a YouTube video or Short from a URL or base64. Canonical: `POST https://app.tryadeli.com/api/v1/posts` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) For local media, first [prepare direct uploads](https://www.tryadeli.com/docs/api/posts/create-media-uploads), then send a staged `{ "upload_id": "..." }` video and optional staged thumbnail. Adeli inspects and sends bounded S3 ranges through YouTube’s resumable protocol. Legacy URL, base64, and multipart inputs remain compatible. YouTube takes one video per post. There is no separate Shorts endpoint: a vertical or square video up to three minutes long becomes a Short. Send `application/json` with a public HTTPS `video.url` (Adeli downloads it, up to 1 GB) or base64, or upload the file itself with [multipart](https://www.tryadeli.com/docs/api/posts/upload-youtube-video-file). > **Note: Adeli has passed YouTube's API audit** > > YouTube locks videos uploaded through an unaudited app to private. Adeli's > app has passed the YouTube API Services audit, so the visibility you ask for > is applied. If YouTube applies something else anyway, the response reports > it in `appliedPrivacy`, and `privacyRestricted` is `true`. **Body** | Name | Type | Required | Description | | -------------------------- | ------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | `platform` | `"youtube"` | Yes | | | `accountId` | `uuid` | Yes | A connected YouTube channel in your organization. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `title` | `string` | Yes | 1–100 characters, with no `<` or `>`. | | `privacy_status` | `"public" \| "unlisted" \| "private"` | Yes | Who can see the video. There is no default. | | `made_for_kids` | `boolean` | Yes | Whether the video is made for kids, as YouTube requires under COPPA. This is the channel owner's own declaration: ask them, never guess. | | `video` | `object` | Yes | `{ url }`, a public HTTPS URL of up to 1 GB, or `{ content_type, base64 }` with `video/mp4`, `video/quicktime`, or `video/webm`. | | `description` | `string` | | Up to 5,000 bytes of UTF-8, with no `<` or `>`. | | `tags` | `string[]` | | Up to 500 characters in total, counting the commas YouTube puts between them. | | `category_id` | `string` | | A numeric YouTube category id. Defaults to `22`, People & Blogs. | | `contains_synthetic_media` | `boolean` | | Discloses realistic altered or synthetic content. | | `publish_at` | `string` | | An ISO 8601 time in the future. Requires `privacy_status: "private"`: YouTube makes the video public at that time. | | `notify_subscribers` | `boolean` | | Defaults to true. | Returns `202` once YouTube has the file. Processing continues after; poll [YouTube upload status](https://www.tryadeli.com/docs/api/posts/get-youtube-upload-status) with the `publishId`. **Fields** | Name | Type | Required | Description | | ---------------- | -------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------ | | `publishId` | `string` | | The YouTube video id, the same as `videoId`. Pass it to the status endpoint. | | `appliedPrivacy` | `string` | | The visibility YouTube applied. `privacyRestricted` is true when it is `private` but you asked for something else. | | `thumbnail` | `"set" \| "not_allowed" \| "failed" \| null` | | `null` when no thumbnail was sent; `not_allowed` when the channel cannot use custom thumbnails. | | `warnings` | `object[]` | | Present only when non-empty: `privacy_restricted`, `thumbnail_not_allowed`, or `thumbnail_failed`. | ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/posts" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "platform": "youtube", "accountId": "00000000-0000-0000-0000-000000000000", "title": "Heron fishing at dawn", "privacy_status": "public", "made_for_kids": false, "video": { "url": "https://cdn.example/heron.mp4" } }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/posts", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ platform: "youtube", accountId: "00000000-0000-0000-0000-000000000000", title: "Heron fishing at dawn", privacy_status: "public", made_for_kids: false, video: { url: "https://cdn.example/heron.mp4", }, }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/posts", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "platform": "youtube", "accountId": "00000000-0000-0000-0000-000000000000", "title": "Heron fishing at dawn", "privacy_status": "public", "made_for_kids": False, "video": { "url": "https://cdn.example/heron.mp4", }, }, ) print(response.json()) ``` ## Responses ### 202 ```json { "id": "youtube_post_00000000-0000-0000-0000-000000000000_dQw4w9WgXcQ", "platform": "youtube", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "publishId": "dQw4w9WgXcQ", "videoId": "dQw4w9WgXcQ", "permalink": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", "status": "ACCEPTED", "requestedPrivacy": "public", "appliedPrivacy": "private", "privacyRestricted": true, "publishAt": null, "thumbnail": null, "statusUrl": "/api/v1/posts/youtube/status?accountId=...&profileId=...&videoId=dQw4w9WgXcQ", "warnings": [ { "code": "privacy_restricted", "message": "YouTube locked this upload to private: the app has not yet passed the YouTube API Services audit" } ] } ``` ### 422 ```json { "error": { "code": "upload_limit_exceeded", "message": "This channel has reached YouTube's upload limit; try again later" } } ``` ## Upload YouTube file URL: https://www.tryadeli.com/docs/api/posts/upload-youtube-video-file Markdown: https://www.tryadeli.com/docs/api/posts/upload-youtube-video-file.md Upload a YouTube video as a multipart file. # Upload YouTube file > Upload a YouTube video as a multipart file. Canonical: `POST https://app.tryadeli.com/api/v1/posts/youtube` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) > **Compatibility endpoint.** New integrations should [prepare a direct S3 upload](https://www.tryadeli.com/docs/api/posts/create-media-uploads) and publish staged JSON. Multipart remains available for older clients, but large bodies can be rejected by Vercel before Adeli runs. [`POST /api/v1/posts`](https://www.tryadeli.com/docs/api/posts/publish-youtube) takes multipart for TikTok only, so a YouTube file upload has its own route. Fields use the same names; booleans are the strings `"true"` or `"false"`, and `tags` is comma-separated. Send one `video` file of up to 4 GiB and, optionally, a `thumbnail` (JPEG or PNG, up to 50 MB). YouTube allows custom thumbnails only on verified channels; a refused thumbnail is a warning, not a failed upload. It returns `202` once YouTube has the file, with the same response as [Publish to YouTube](https://www.tryadeli.com/docs/api/posts/publish-youtube). Processing continues after; poll [YouTube upload status](https://www.tryadeli.com/docs/api/posts/get-youtube-upload-status). ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/posts/youtube" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -F 'platform=youtube' \ -F 'accountId=00000000-0000-0000-0000-000000000000' \ -F 'title=Heron fishing at dawn' \ -F 'privacy_status=unlisted' \ -F 'made_for_kids=false' \ -F 'tags=birds,herons' \ -F "video=@heron.mp4;type=video/mp4" \ -F "thumbnail=@heron.jpg;type=image/jpeg" ``` **JavaScript** ```javascript import { openAsBlob } from "node:fs"; const form = new FormData(); form.append("platform", "youtube"); form.append("accountId", "00000000-0000-0000-0000-000000000000"); form.append("title", "Heron fishing at dawn"); form.append("privacy_status", "unlisted"); form.append("made_for_kids", "false"); form.append("tags", "birds,herons"); form.append("video", await openAsBlob("heron.mp4", { type: "video/mp4" }), "heron.mp4"); form.append("thumbnail", await openAsBlob("heron.jpg", { type: "image/jpeg" }), "heron.jpg"); const response = await fetch("https://app.tryadeli.com/api/v1/posts/youtube", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, body: form, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/posts/youtube", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, data={ "platform": "youtube", "accountId": "00000000-0000-0000-0000-000000000000", "title": "Heron fishing at dawn", "privacy_status": "unlisted", "made_for_kids": "false", "tags": "birds,herons", }, files={ "video": ("heron.mp4", open("heron.mp4", "rb"), "video/mp4"), "thumbnail": ("heron.jpg", open("heron.jpg", "rb"), "image/jpeg"), }, ) print(response.json()) ``` ## Responses ### 202 ```json { "id": "youtube_post_00000000-0000-0000-0000-000000000000_dQw4w9WgXcQ", "platform": "youtube", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "publishId": "dQw4w9WgXcQ", "videoId": "dQw4w9WgXcQ", "permalink": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", "status": "ACCEPTED", "requestedPrivacy": "unlisted", "appliedPrivacy": "private", "privacyRestricted": true, "publishAt": null, "thumbnail": "set", "statusUrl": "/api/v1/posts/youtube/status?accountId=...&profileId=...&videoId=dQw4w9WgXcQ", "warnings": [ { "code": "privacy_restricted", "message": "YouTube locked this upload to private: the app has not yet passed the YouTube API Services audit" } ] } ``` ### 429 ```json { "error": { "code": "quota_exhausted", "message": "YouTube's daily API quota is used up; it resets at 2026-10-10T07:00:00.000Z" } } ``` ## YouTube upload status URL: https://www.tryadeli.com/docs/api/posts/get-youtube-upload-status Markdown: https://www.tryadeli.com/docs/api/posts/get-youtube-upload-status.md Poll a YouTube upload until processing finishes. # YouTube upload status > Poll a YouTube upload until processing finishes. Canonical: `GET https://app.tryadeli.com/api/v1/posts/youtube/status` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Polls a video uploaded with [Publish to YouTube](https://www.tryadeli.com/docs/api/posts/publish-youtube) or [Upload YouTube file](https://www.tryadeli.com/docs/api/posts/upload-youtube-video-file). **Query parameters** | Name | Type | Required | Description | | ----------- | -------- | -------- | --------------------------------------------------------------------------------- | | `accountId` | `uuid` | Yes | | | `videoId` | `string` | Yes | The publishId from the upload response. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | `status` is `processing` until YouTube finishes, then `published` (live, scheduled, unlisted, or private — see `privacyStatus`) or `failed`, with YouTube's `failureReason`. `published` and `failed` are final. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/posts/youtube/status?accountId=00000000-0000-0000-0000-000000000000&videoId=dQw4w9WgXcQ" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/posts/youtube/status?accountId=00000000-0000-0000-0000-000000000000&videoId=dQw4w9WgXcQ", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/posts/youtube/status", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", "videoId": "dQw4w9WgXcQ", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "youtube", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "videoId": "dQw4w9WgXcQ", "status": "published", "uploadStatus": "processed", "processingStatus": "succeeded", "failureReason": null, "privacyStatus": "private", "publishAt": null, "permalink": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" } ``` ### 404 ```json { "error": { "code": "post_not_found", "message": "Video not found on this channel" } } ``` ## Publish to X URL: https://www.tryadeli.com/docs/api/posts/publish-x Markdown: https://www.tryadeli.com/docs/api/posts/publish-x.md Publish an X post or thread, with text, media, or both. # Publish to X > Publish an X post or thread, with text, media, or both. Canonical: `POST https://app.tryadeli.com/api/v1/posts` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) For local media, first [prepare direct uploads](https://www.tryadeli.com/docs/api/posts/create-media-uploads) and use `{ "upload_id": "..." }` media references. Adeli sends bounded 5 MB ranges from verified S3 objects to X. Legacy base64 and URL forms remain compatible and stage internally first. An X post is text, media, or both. Send `thread` to publish several posts, each a reply to the one before. X publishes synchronously, so the response is the finished post. > **Warning: Every X post is billed** > > X charges per API call, and Adeli passes the charge on at X's price: $0.015 a > post, or $0.20 for a post containing a link. See [X API pricing](https://www.tryadeli.com/docs/pricing/x). On > Free, this returns `402 x_billing_required`: X needs a paid plan. **Body** | Name | Type | Required | Description | | ----------- | ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `platform` | `"x"` | Yes | | | `accountId` | `uuid` | Yes | A connected X account in your organization. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `text` | `string` | Yes | Up to 280 characters, counted as X counts them: every link is 23. Send `""` for a media-only post. Adeli cannot tell which accounts have X Premium, so the 280 limit applies to all. | | `media` | `object[]` | | Up to 4 images, or 1 GIF, or 1 video. Each is `{ content_type, base64 }` with `image/jpeg`, `image/png`, `image/webp`, `image/gif`, or `video/mp4`, or a video as `{ url }`, a public HTTPS MP4 or MOV. | | `thread` | `object[]` | | Up to 24 further posts, each `{ text, media }` with the same rules, published in order as replies. | `201` when every post is live. X cannot publish a thread atomically. When a post after the first fails, the posts before it are already live and stay live: the response is `207` with `status: "partial"`, the failed post's `error`, and `not_attempted` for the rest. Publish the remainder yourself as replies to the last `providerId` that went live. A failure on the first post publishes nothing and is an ordinary error. ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/posts" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "platform": "x", "accountId": "00000000-0000-0000-0000-000000000000", "text": "Herons fish at dawn. A thread:", "thread": [ { "text": "They stand still for minutes at a time." } ] }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/posts", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ platform: "x", accountId: "00000000-0000-0000-0000-000000000000", text: "Herons fish at dawn. A thread:", thread: [ { text: "They stand still for minutes at a time.", }, ], }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/posts", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "platform": "x", "accountId": "00000000-0000-0000-0000-000000000000", "text": "Herons fish at dawn. A thread:", "thread": [ { "text": "They stand still for minutes at a time.", }, ], }, ) print(response.json()) ``` ## Responses ### 201 ```json { "id": "x_post_00000000-0000-0000-0000-000000000000_1840000000000000000", "platform": "x", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "status": "published", "providerId": "1840000000000000000", "permalink": "https://x.com/adeli/status/1840000000000000000", "posts": [ { "index": 0, "status": "published", "providerId": "1840000000000000000", "url": "https://x.com/adeli/status/1840000000000000000" }, { "index": 1, "status": "published", "providerId": "1840000000000000001", "url": "https://x.com/adeli/status/1840000000000000001" } ] } ``` ### 207 ```json { "status": "partial", "posts": [ { "index": 0, "status": "published", "providerId": "1840000000000000000", "url": "https://x.com/adeli/status/1840000000000000000" }, { "index": 1, "status": "failed", "error": { "code": "duplicate_post", "message": "X refused a duplicate of a recent post" } }, { "index": 2, "status": "not_attempted" } ] } ``` ### 402 ```json { "error": { "code": "x_billing_required", "message": "X requires billing to be set up for this account" } } ``` ## Delete X post URL: https://www.tryadeli.com/docs/api/posts/delete-x-post Markdown: https://www.tryadeli.com/docs/api/posts/delete-x-post.md Delete a post from an X account. # Delete X post > Delete a post from an X account. Canonical: `DELETE https://app.tryadeli.com/api/v1/posts/x/{postId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Deletes a post from the X account. `postId` is the post's `providerId`. It cannot be undone, and X bills the delete. **Path parameters** | Name | Type | Required | Description | | -------- | -------- | -------- | ------------------------------------------------------------------- | | `postId` | `string` | Yes | The post's providerId, as returned when it was published or listed. | **Query parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | --------------------------------------------------------------------------------- | | `accountId` | `uuid` | Yes | The X account the post belongs to. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | ## Request examples **cURL** ```bash curl -X DELETE "https://app.tryadeli.com/api/v1/posts/x/1840000000000000000?accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/posts/x/1840000000000000000?accountId=00000000-0000-0000-0000-000000000000", { method: "DELETE", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.delete( "https://app.tryadeli.com/api/v1/posts/x/1840000000000000000", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "id": "x_post_00000000-0000-0000-0000-000000000000_1840000000000000000", "platform": "x", "accountId": "00000000-0000-0000-0000-000000000000", "providerId": "1840000000000000000", "deleted": true } ``` ### 404 ```json { "error": { "code": "post_not_found", "message": "Post not found on this account" } } ``` ## Publish to Bluesky URL: https://www.tryadeli.com/docs/api/posts/publish-bluesky Markdown: https://www.tryadeli.com/docs/api/posts/publish-bluesky.md Publish a Bluesky post or thread, with up to four images or one video. # Publish to Bluesky > Publish a Bluesky post or thread, with up to four images or one video. Canonical: `POST https://app.tryadeli.com/api/v1/posts` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) For local media, first [prepare direct uploads](https://www.tryadeli.com/docs/api/posts/create-media-uploads) and use `{ "upload_id": "..." }` image or video references. Adeli reads only the platform-bounded verified S3 object before uploading to Bluesky. Legacy base64 and URL forms remain compatible and stage internally first. A Bluesky post is text with up to four images or one video. Send `thread` to publish several posts, each a reply to the one before. Bluesky publishes synchronously, so the response is the finished post. Bluesky's API is free: nothing is billed per post. Links, `@mentions`, and `#hashtags` in `text` become links on Bluesky. A mention of a handle that doesn't exist stays plain text. **Body** | Name | Type | Required | Description | | ----------- | ----------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `platform` | `"bluesky"` | Yes | | | `accountId` | `uuid` | Yes | A connected Bluesky account in your organization. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `text` | `string` | Yes | Up to 300 characters, counted as a reader sees them (an emoji is one), and 3,000 bytes. Links count at full length. Send `""` for an images-only post. | | `images` | `object[]` | | Up to 4, each `{ content_type, base64, altText }` with `image/jpeg`, `image/png`, or `image/webp`. Images over 2 MB are resized to fit, and the response lists them in `resizedImages`. `altText` is optional but recommended. | | `video` | `object` | | One MP4, never with `images`: `{ content_type: "video/mp4", base64, altText }` or `{ url, altText }` for a public HTTPS URL, up to 100 MB. Bluesky processes it before the post is created, which can take a minute. Bluesky limits videos per account per day and needs a verified email first; past that, this returns `422 upload_limit_exceeded` with Bluesky's reason. | | `langs` | `string[]` | | Up to 3 language tags, such as `en` or `pt-BR`, which Bluesky uses for feeds and translation. | | `thread` | `object[]` | | Up to 24 further posts, each `{ text, images, video }` with the same rules, published in order as replies. | `201` when every post is live. `providerId` is the post's AT URI. A thread that fails part-way returns `207` with `status: "partial"`, exactly as [for X](https://www.tryadeli.com/docs/api/posts/publish-x). ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/posts" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "platform": "bluesky", "accountId": "00000000-0000-0000-0000-000000000000", "text": "Herons fish at dawn. A thread:", "thread": [ { "text": "They stand still for minutes at a time." } ] }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/posts", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ platform: "bluesky", accountId: "00000000-0000-0000-0000-000000000000", text: "Herons fish at dawn. A thread:", thread: [ { text: "They stand still for minutes at a time.", }, ], }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/posts", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "platform": "bluesky", "accountId": "00000000-0000-0000-0000-000000000000", "text": "Herons fish at dawn. A thread:", "thread": [ { "text": "They stand still for minutes at a time.", }, ], }, ) print(response.json()) ``` ## Responses ### 201 ```json { "id": "bluesky_post_00000000-0000-0000-0000-000000000000_3l6oveex3ii2l", "platform": "bluesky", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "status": "published", "providerId": "at://did:plc:abc123/app.bsky.feed.post/3l6oveex3ii2l", "permalink": "https://bsky.app/profile/adeli.bsky.social/post/3l6oveex3ii2l", "posts": [ { "index": 0, "status": "published", "providerId": "at://did:plc:abc123/app.bsky.feed.post/3l6oveex3ii2l", "url": "https://bsky.app/profile/adeli.bsky.social/post/3l6oveex3ii2l" }, { "index": 1, "status": "published", "providerId": "at://did:plc:abc123/app.bsky.feed.post/3l6ovefa2kq2k", "url": "https://bsky.app/profile/adeli.bsky.social/post/3l6ovefa2kq2k" } ] } ``` ### 422 ```json { "error": { "code": "invalid_media", "message": "The image could not be made small enough for Bluesky" } } ``` ## Publish to LinkedIn URL: https://www.tryadeli.com/docs/api/posts/publish-linkedin Markdown: https://www.tryadeli.com/docs/api/posts/publish-linkedin.md Publish text or one image to a connected LinkedIn profile or organization Page. # Publish to LinkedIn > Publish text or one image to a connected LinkedIn profile or organization Page. Canonical: `POST https://app.tryadeli.com/api/v1/posts` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Connect a LinkedIn account first: either the member's personal profile or an organization Page they administer. Then publish commentary with at most one kind of media: one image, 2–20 images, one video, or one PDF document. Upload media with [`POST /api/v1/media/uploads`](https://www.tryadeli.com/docs/api/posts/create-media-uploads) using `platform: "linkedin"` and pass each `uploadId` as `upload_id`. The post is public. LinkedIn returns its URN straight away, but it can take a minute for the post to show on LinkedIn. > **Note: Rate limits** > > LinkedIn limits how many calls each app and each member can make in a day. Once a limit is reached, LinkedIn answers `429` until the next day, and Adeli returns `429 rate_limited`. **Body** | Name | Type | Required | Description | | ------------ | ------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `platform` | `"linkedin"` | Yes | | | `accountId` | `uuid` | Yes | A connected LinkedIn account in your workspace: a personal profile or an organization Page. | | `profileId` | `uuid` | | Optional because accountId names its profile. If both are sent, they must agree. | | `commentary` | `string` | Yes | The public post text. Send `""` for a media-only post. Write plain text: Adeli escapes LinkedIn's reserved characters, and `#word` becomes a hashtag. | | `mentions` | `array` | | Up to 20 `{ urn, name, offset }` mentions. `name` must appear in `commentary` at character `offset`; `urn` is `urn:li:organization:` or `urn:li:person:`. LinkedIn offers apps no way to look people up, so a person mention needs a URN you already have. | | `image` | `object` | | One image: `{ upload_id, title? }`, or `{ content_type, base64, title? }` for compatibility. JPEG, PNG, or GIF, at most 20 MB and fewer than 36 million pixels. | | `images` | `array` | | A multi-image post: 2 to 20 `{ upload_id, alt_text? }` images, shown in order. | | `video` | `object` | | One `{ upload_id, title? }` MP4, 75 KB to 500 MB and 3 seconds to 30 minutes. Adeli waits for LinkedIn to finish processing before it creates the post. | | `document` | `object` | | One `{ upload_id, title }` PDF of up to 100 MB, shown as swipeable slides. The title is required. | Add one kind of media. A multi-image post: ```json { "images": [{ "upload_id": "linkedin/staging/…", "alt_text": "The new dashboard" }, { "upload_id": "linkedin/staging/…" }] } ``` A video, or a PDF document carousel: ```json { "video": { "upload_id": "linkedin/staging/…", "title": "Launch demo" } } { "document": { "upload_id": "linkedin/staging/…", "title": "Q3 results" } } ``` Sending more than one of `image`, `images`, `video`, and `document` returns `400`. To mention a Page, include its name in the commentary and point at it: ```json { "commentary": "Thanks to Acme for the launch", "mentions": [{ "urn": "urn:li:organization:42", "name": "Acme", "offset": 10 }] } ``` Adeli does not automatically retry post creation: if LinkedIn's answer is ambiguous, retrying could publish a duplicate. An expired connection returns `connection_expired`; reconnect the account before publishing again. ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/posts" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "platform": "linkedin", "accountId": "00000000-0000-0000-0000-000000000000", "commentary": "We just shipped a faster publishing workflow." }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/posts", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ platform: "linkedin", accountId: "00000000-0000-0000-0000-000000000000", commentary: "We just shipped a faster publishing workflow.", }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/posts", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "platform": "linkedin", "accountId": "00000000-0000-0000-0000-000000000000", "commentary": "We just shipped a faster publishing workflow.", }, ) print(response.json()) ``` ## Responses ### 201 ```json { "id": "linkedin_post_00000000-0000-0000-0000-000000000000_dXJuOmxpOnNoYXJlOjEyMw", "platform": "linkedin", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "status": "published", "providerId": "urn:li:share:123", "caption": "We just shipped a faster publishing workflow.", "media": [], "permalink": "https://www.linkedin.com/feed/update/urn:li:share:123/", "engagement": { "likes": null, "comments": null, "shares": null, "views": null }, "publishedAt": "2026-10-23T18:00:00.000Z" } ``` ### 403 ```json { "error": { "code": "permission_required", "message": "LinkedIn denied the post: the account needs an eligible Page role or an additional permission. Reconnect after restoring access." } } ``` ### 503 ```json { "error": { "code": "processing_timeout", "message": "LinkedIn is still processing the video. Nothing was posted; try again shortly." } } ``` ### 429 ```json { "error": { "code": "rate_limited", "message": "LinkedIn rate limit reached; retry later", "details": { "retryAfterSeconds": 60 } } } ``` ## Delete Bluesky post URL: https://www.tryadeli.com/docs/api/posts/delete-bluesky-post Markdown: https://www.tryadeli.com/docs/api/posts/delete-bluesky-post.md Delete a post from a Bluesky account. # Delete Bluesky post > Delete a post from a Bluesky account. Canonical: `DELETE https://app.tryadeli.com/api/v1/posts/bluesky/{postId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Deletes a post from the Bluesky account. `postId` is the post's record key, the last segment of its `providerId` (`3l6oveex3ii2l` in [the publish example](https://www.tryadeli.com/docs/api/posts/publish-bluesky)), or the whole AT URI, URL-encoded. It cannot be undone. **Path parameters** | Name | Type | Required | Description | | -------- | -------- | -------- | -------------------------------------------------------- | | `postId` | `string` | Yes | The post's record key, or its whole AT URI, URL-encoded. | **Query parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | --------------------------------------------------------------------------------- | | `accountId` | `uuid` | Yes | The Bluesky account the post belongs to. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | ## Request examples **cURL** ```bash curl -X DELETE "https://app.tryadeli.com/api/v1/posts/bluesky/3l6oveex3ii2l?accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/posts/bluesky/3l6oveex3ii2l?accountId=00000000-0000-0000-0000-000000000000", { method: "DELETE", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.delete( "https://app.tryadeli.com/api/v1/posts/bluesky/3l6oveex3ii2l", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "id": "bluesky_post_00000000-0000-0000-0000-000000000000_3l6oveex3ii2l", "platform": "bluesky", "accountId": "00000000-0000-0000-0000-000000000000", "providerId": "at://did:plc:abc123/app.bsky.feed.post/3l6oveex3ii2l", "deleted": true } ``` ### 404 ```json { "error": { "code": "post_not_found", "message": "Post not found on this account" } } ``` --- # Comments ## Comments URL: https://www.tryadeli.com/docs/api/comments Markdown: https://www.tryadeli.com/docs/api/comments.md Read, reply to, hide, like, and delete comments on Instagram, Facebook, TikTok, and YouTube posts. # Comments > Read, reply to, hide, like, and delete comments on Instagram, Facebook, TikTok, and YouTube posts. Canonical: Moderate the comments on your customer's own posts: read them, reply, hide the ones that should not be seen, and delete. > **Note:** > > The dashboard currently supports Comments for TikTok and YouTube. Facebook and > Instagram are omitted from its platform filter because fresh approved-only Meta > grants do not include comment permissions, and the dashboard makes no Meta > comment request. The API retains its permission-gated Meta implementation for direct or > legacy tokens whose actual grant still supports it. **Reads come from Adeli's copy; writes go to the platform.** Adeli keeps each connected account's recent posts and their comments, so listing comments answers immediately instead of waiting on the platform. The copy is refreshed from the platform in the background whenever it is read and is more than a minute old (ten minutes on YouTube, whose quota is shared by every Adeli customer), and Adeli updates it as soon as you reply, hide, like, or delete through this API. Every response says when its comments were last refreshed (`syncedAt`) and whether every thread is held yet (`complete`). Changes made outside Adeli, such as a comment hidden in the Instagram app, appear after the next refresh. The four platforms do not allow the same things: | | Instagram | Facebook | TikTok | YouTube | | --------------------------------- | ---------------------------------- | ------------------------------- | ------------------------------- | --------------------------------------------------------------------------- | | List comments and replies | Yes | Yes | Yes, paged with `cursor` | Yes, paged with `cursor` | | Reply to a comment | Yes | Yes | Yes | Yes | | Comment on the account's own post | No | Yes | Yes | Yes | | Hide and unhide | Yes | Yes | Yes | Yes, by holding for review | | Like and unlike | No | No | Yes | No | | Delete | Any comment on the account's posts | Any comment on the Page's posts | Only comments the account wrote | The channel's own; anyone else's is rejected, optionally banning its author | Comment ids and post ids are the provider's own: numeric strings everywhere but YouTube, whose ids are URL-safe base64 (a reply's is `{parent}.{reply}`). Post ids come from [`GET /api/v1/posts`](https://www.tryadeli.com/docs/api/posts) (`providerId`), or from the `posts` that [List comments](https://www.tryadeli.com/docs/api/comments/list-comments) returns. Comments are answered from Adeli's copy, so a read can lag new comments: on TikTok by up to 10 minutes (see [Freshness](https://www.tryadeli.com/docs/api/comments/list-comments#freshness)). To hear about new comments as they arrive, subscribe to the [`comment.created`](https://www.tryadeli.com/docs/api/webhooks) webhook rather than polling. ## Endpoints - `GET /api/v1/comments` — [List comments](https://www.tryadeli.com/docs/api/comments/list-comments.md) - `POST /api/v1/comments` — [Reply or comment](https://www.tryadeli.com/docs/api/comments/create-comment.md) - `PATCH /api/v1/comments/{commentId}` — [Hide or like comment](https://www.tryadeli.com/docs/api/comments/update-comment.md) - `DELETE /api/v1/comments/{commentId}` — [Delete comment](https://www.tryadeli.com/docs/api/comments/delete-comment.md) ## Permissions Comment management needs a permission that connections made before it was requested may lack. A read or write against such a connection returns `422 connection_expired`; [reconnecting](https://www.tryadeli.com/docs/api/connect) the account and approving the permission fixes it. On TikTok, reading needs `comment.list` and writing needs `comment.list.manage`. On YouTube, both need `youtube.force-ssl`, which every YouTube connection holds. ## YouTube quota Adeli's YouTube app has passed Google's API Services audit and is approved for higher quota tiers. The quota belongs to Adeli's Google Cloud project, is shared by every connected channel, and resets at midnight Pacific. A read costs 1 unit; every reply, comment, hide, and delete costs 50. Once the day's quota is spent, YouTube calls return `429 quota_exhausted` with the reset time, and reads keep answering from Adeli's copy. ## Comment permission Cached comment history remains readable where the endpoint supports it, but provider refreshes and mutations check the account's comment scopes/resources before calling the provider. Missing authorization returns `403 permission_required` with exact requirements and `restart_oauth` guidance; revoked credentials remain connection-expiry errors. ## List comments URL: https://www.tryadeli.com/docs/api/comments/list-comments Markdown: https://www.tryadeli.com/docs/api/comments/list-comments.md An account's recent posts and the comments on one of them. # List comments > An account's recent posts and the comments on one of them. Canonical: `GET https://app.tryadeli.com/api/v1/comments` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Returns the account's recent posts and the comments on one of them — the post named by `postId`, or the newest post when it is omitted. Replies are returned alongside top-level comments and carry `parentId`. Comments are newest first. `posts` holds the account's newest 25 posts on Instagram and Facebook, and its newest 20 on TikTok, and its newest 25 videos on YouTube. `postId` may name an older post of the account's too. YouTube sends no notice of new comments. While you keep reading a channel's comments, Adeli checks the channel's newest comments across every video at most every two minutes, and re-reads only the videos that have new ones. The first time a post is read, Adeli fetches its newest comments from the platform while you wait and the rest in the background, so that response has `complete: false`. Read again a few seconds later for the remainder. ## Freshness Comments are answered from Adeli's copy, refreshed from the platform in the background. On TikTok, Adeli reads each post's comments from TikTok at most every 10 minutes, and its post list just as often, so a read can lag new comments by that long. Reading more often returns the same comments. Don't poll this endpoint to learn about new comments. Subscribe to the [`comment.created`](https://www.tryadeli.com/docs/api/webhooks) webhook, which arrives within seconds of a comment being posted. **Query parameters** | Name | Type | Required | Description | | ----------- | ---------------------------------------------------- | -------- | --------------------------------------------------------------------------------- | | `platform` | `"instagram" \| "facebook" \| "tiktok" \| "youtube"` | Yes | | | `accountId` | `uuid` | Yes | A connected account on that platform. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `postId` | `string` | | One of the account's posts. Defaults to the newest. | | `cursor` | `string` | | TikTok and YouTube only: the `nextCursor` of the previous page. | **Comment fields** | Name | Type | Required | Description | | ------------ | ---------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `authorId` | `string \| null` | | The platform's id for the author, or null where the platform gives none. On Instagram it is the commenter's Instagram-scoped id, which [Send message](https://www.tryadeli.com/docs/api/messages/send-message) accepts as the recipient. | | `isCreator` | `boolean` | | Written by the connected account itself. | | `isHidden` | `boolean` | | Hidden from everyone but its author. On YouTube, held for review or flagged as likely spam: visible only to the channel. | | `liked` | `boolean` | | TikTok only: the connected account has liked it. | | `deletable` | `boolean` | | TikTok and YouTube: false for comments TikTok will not delete. Always true on YouTube, where any comment can be removed. | | `replyCount` | `number` | | TikTok and YouTube: how many replies the platform reports for the comment, which can exceed the replies returned so far. | | `nextCursor` | `string \| null` | | TikTok and YouTube: pass as cursor for the next page of comments. Null once every thread is held, and always null on Instagram and Facebook. | | `complete` | `boolean` | | Whether every top-level comment on the post is held. False on a post's first read, and on a TikTok post Adeli has read only the newest page of. | | `syncedAt` | `string \| null` | | When these comments were last refreshed from the platform. | On TikTok each page holds up to 30 top-level comments. TikTok returns three replies per thread inline; Adeli fetches the rest of a few threads with each background refresh, so `replyCount` can briefly exceed the replies returned. A `cursor` request returns that page alone. It is answered from Adeli's copy when Adeli holds that page, and can then include more than three replies per thread; otherwise it is fetched from TikTok while you wait. New comments can shift later pages between requests, so a comment can appear on two pages: dedupe by `id`. On YouTube each page holds up to 100 top-level comments, and YouTube returns up to five replies per thread inline. `cursor` works the same way as on TikTok. **Errors** — `401 unauthorized`, `400 invalid_request`, `404 account_not_found`, `404 post_not_found`, `404 profile_not_found`, `409 page_not_selected`, `422 connection_expired`, `422 not_supported`, `429 rate_limited`, `429 quota_exhausted`, `502 provider_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/comments?platform=tiktok&accountId=00000000-0000-0000-0000-000000000000&postId=7300000000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/comments?platform=tiktok&accountId=00000000-0000-0000-0000-000000000000&postId=7300000000000000000", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/comments", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "postId": "7300000000000000000", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "postId": "7300000000000000000", "posts": [ { "id": "7300000000000000000", "caption": "Backyard birds", "thumbnailUrl": "https://...", "permalink": "https://www.tiktok.com/@creator/video/7300000000000000000", "publishedAt": "2026-09-30T12:00:00.000Z", "commentsCount": 2 } ], "comments": [ { "id": "7301000000000000001", "mediaId": "7300000000000000000", "parentId": null, "authorName": "Bird Fan", "authorFullName": "Bird Fan", "authorHandle": "birdfan", "avatarUrl": "https://...", "profileUrl": "https://www.tiktok.com/@birdfan", "body": "What a cardinal!", "likeCount": 3, "isCreator": false, "isHidden": false, "createdAt": "2026-09-30T13:00:00.000Z", "authorId": null, "liked": false, "deletable": false }, { "id": "7301000000000000002", "mediaId": "7300000000000000000", "parentId": "7301000000000000001", "authorName": "Creator", "authorFullName": "Creator", "authorHandle": "creator", "avatarUrl": null, "profileUrl": "https://www.tiktok.com/@creator", "body": "Thank you!", "likeCount": 0, "isCreator": true, "isHidden": false, "createdAt": "2026-09-30T13:05:00.000Z", "authorId": null, "liked": false, "deletable": true } ], "nextCursor": "30", "complete": false, "syncedAt": "2026-09-30T13:06:00.000Z" } ``` ### 404 ```json { "error": { "code": "post_not_found", "message": "Post not found on this account" } } ``` ## Reply or comment URL: https://www.tryadeli.com/docs/api/comments/create-comment Markdown: https://www.tryadeli.com/docs/api/comments/create-comment.md Reply to a comment, or comment on one of the account's own posts. # Reply or comment > Reply to a comment, or comment on one of the account's own posts. Canonical: `POST https://app.tryadeli.com/api/v1/comments` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Send `parentId` to reply to a comment, or `postId` alone to comment on one of the account's own posts. Instagram supports replies only. TikTok and YouTube need `postId` for a reply too. Comments are public as soon as the provider accepts them. **Body** | Name | Type | Required | Description | | ----------- | ---------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------- | | `platform` | `"instagram" \| "facebook" \| "tiktok" \| "youtube"` | Yes | | | `accountId` | `uuid` | Yes | | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `postId` | `string` | | The post. Required for a top-level comment, and for any TikTok or YouTube comment. | | `parentId` | `string` | | The comment being replied to. Required on Instagram. | | `message` | `string` | Yes | Up to 2,200 characters on Instagram, 1,200 on TikTok, 8,000 on Facebook, 10,000 on YouTube. | Returns `201` with `{ platform, accountId, profileId, comment }`. On Instagram, TikTok and YouTube `comment` is the full comment in the shape [List comments](https://www.tryadeli.com/docs/api/comments/list-comments) returns; on Instagram its `authorId` is the connected account's own id. Facebook returns the new comment's id. **Errors** — [`402 usage_limit_reached`](https://www.tryadeli.com/docs/billing#usage-limits), `401 unauthorized`, `400 invalid_request`, `404 account_not_found`, `409 page_not_selected`, `422 connection_expired`, `429 rate_limited`, `429 quota_exhausted`, `502 provider_error`. ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/comments" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "postId": "7300000000000000000", "parentId": "7301000000000000001", "message": "Thank you!" }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/comments", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ platform: "tiktok", accountId: "00000000-0000-0000-0000-000000000000", postId: "7300000000000000000", parentId: "7301000000000000001", message: "Thank you!", }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/comments", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "postId": "7300000000000000000", "parentId": "7301000000000000001", "message": "Thank you!", }, ) print(response.json()) ``` ## Responses ### 201 ```json { "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "comment": { "id": "7301000000000000002", "mediaId": "7300000000000000000", "parentId": "7301000000000000001", "authorName": "Creator", "authorFullName": "Creator", "authorHandle": "creator", "avatarUrl": null, "profileUrl": "https://www.tiktok.com/@creator", "body": "Thank you!", "likeCount": 0, "isCreator": true, "isHidden": false, "createdAt": "2026-09-30T13:05:00.000Z", "authorId": null, "liked": false, "deletable": true } } ``` ### 400 ```json { "error": { "code": "invalid_request", "message": "Instagram supports replies only", "details": [ { "code": "custom", "path": ["parentId"], "message": "Instagram supports replies only" } ] } } ``` ## Hide or like comment URL: https://www.tryadeli.com/docs/api/comments/update-comment Markdown: https://www.tryadeli.com/docs/api/comments/update-comment.md Hide, unhide, like, or unlike a comment. # Hide or like comment > Hide, unhide, like, or unlike a comment. Canonical: `PATCH https://app.tryadeli.com/api/v1/comments/{commentId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) **Path parameters** | Name | Type | Required | Description | | ----------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `commentId` | `string` | Yes | The provider's comment id: a numeric string everywhere but YouTube, whose ids are URL-safe base64. One that does not match the platform's format returns 400 invalid\_request. | **Body** | Name | Type | Required | Description | | ----------- | ---------------------------------------------------- | -------- | --------------------------------------------------------------------------------- | | `platform` | `"instagram" \| "facebook" \| "tiktok" \| "youtube"` | Yes | | | `accountId` | `uuid` | Yes | | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `hidden` | `boolean` | | Hide (true) or unhide (false). | | `liked` | `boolean` | | TikTok only. Like (true) or unlike (false). | | `postId` | `string` | | TikTok only, required with hidden: the post the comment is on. | On YouTube, `hidden: true` holds the comment for review, where only the channel sees it, and `hidden: false` publishes it again. `liked` returns `422 not_supported` on every platform but TikTok. Send at least one of `hidden` and `liked`. Returns `200` with the new state: `{ platform, accountId, profileId, comment: { id, hidden?, liked? } }`. **Errors** — `401 unauthorized`, `400 invalid_request`, `404 account_not_found`, `422 connection_expired`, `422 not_supported`, `429 rate_limited`, `502 provider_error`. ## Request examples **cURL** ```bash curl -X PATCH "https://app.tryadeli.com/api/v1/comments/7301000000000000001" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "postId": "7300000000000000000", "hidden": true }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/comments/7301000000000000001", { method: "PATCH", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ platform: "tiktok", accountId: "00000000-0000-0000-0000-000000000000", postId: "7300000000000000000", hidden: true, }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.patch( "https://app.tryadeli.com/api/v1/comments/7301000000000000001", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "postId": "7300000000000000000", "hidden": True, }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "comment": { "id": "7301000000000000001", "hidden": true } } ``` ### 422 ```json { "error": { "code": "not_supported", "message": "Instagram comments cannot be liked through this API" } } ``` ## Delete comment URL: https://www.tryadeli.com/docs/api/comments/delete-comment Markdown: https://www.tryadeli.com/docs/api/comments/delete-comment.md Delete a comment. # Delete comment > Delete a comment. Canonical: `DELETE https://app.tryadeli.com/api/v1/comments/{commentId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) **Path parameters** | Name | Type | Required | Description | | ----------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `commentId` | `string` | Yes | The provider's comment id: a numeric string everywhere but YouTube, whose ids are URL-safe base64. One that does not match the platform's format returns 400 invalid\_request. | **Query parameters** | Name | Type | Required | Description | | ----------- | ---------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------- | | `platform` | `"instagram" \| "facebook" \| "tiktok" \| "youtube"` | Yes | | | `accountId` | `uuid` | Yes | | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `banAuthor` | `"true" \| "false"` | | YouTube only: also hide the author's future comments on the channel, when the comment is someone else's. | Returns `204`. Deleting cannot be undone. > **Note: TikTok deletes only your own comments** > > On TikTok the account can delete only comments it wrote; anything else is > `422 comment_not_owned`. Hide other people's comments instead — a hidden > comment is visible only to its author. > **Note: YouTube rejects other people's comments** > > On YouTube the channel's own comments are deleted. Anyone else's is rejected, > which removes it for good — it cannot be published again — and, with > `banAuthor=true`, also bans its author from commenting on the channel. **Errors** — `401 unauthorized`, `400 invalid_request`, `404 account_not_found`, `422 comment_not_owned`, `422 connection_expired`, `429 rate_limited`, `502 provider_error`. ## Request examples **cURL** ```bash curl -X DELETE "https://app.tryadeli.com/api/v1/comments/7301000000000000002?platform=tiktok&accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/comments/7301000000000000002?platform=tiktok&accountId=00000000-0000-0000-0000-000000000000", { method: "DELETE", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(response.status); // 204: no body ``` **Python** ```python import os import requests response = requests.delete( "https://app.tryadeli.com/api/v1/comments/7301000000000000002", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", }, ) print(response.status_code) # 204: no body ``` ## Responses ### 204 No Content ```text (empty body) ``` ### 422 ```json { "error": { "code": "comment_not_owned", "message": "TikTok can delete only comments this account wrote; hide other comments instead" } } ``` --- # Messages ## Messages URL: https://www.tryadeli.com/docs/api/messages Markdown: https://www.tryadeli.com/docs/api/messages.md Read Instagram and Facebook message history, and send text replies to both. # Messages > Read Instagram and Facebook message history, and send text replies to both. Canonical: Instagram direct messages and Facebook Page messages, normalized into one shape. Adeli refreshes history from the provider before returning it, at most once a minute per account; reads in between return what Adeli has stored, which incoming messages keep current as they arrive. > **Warning: Meta providers only** > > TikTok messaging is not supported, and YouTube has no messaging API at all — > its direct messages were retired in 2019. WhatsApp sends free text inside its > 24-hour window and approved templates outside it — see [WhatsApp](https://www.tryadeli.com/docs/api/messages#whatsapp) below. > **Note: Free text only inside a 24-hour window** > > Meta only permits a free-text reply within 24 hours of the person's last > message, on Instagram, Facebook and WhatsApp alike. When Meta refuses a send because the window > has closed, Adeli returns `409 window_closed`; you cannot open one by sending > first. ## Endpoints - `GET /api/v1/messages` — [List messages](https://www.tryadeli.com/docs/api/messages/list-messages.md) - `POST /api/v1/messages` — [Send message](https://www.tryadeli.com/docs/api/messages/send-message.md) - `POST /api/v1/messages/instagram` — [Send Instagram message](https://www.tryadeli.com/docs/api/messages/send-instagram-message.md) - `GET /api/v1/messages/instagram/users/{igsid}` — [Get Instagram user](https://www.tryadeli.com/docs/api/messages/get-instagram-user.md) ## Conversations Every message carries a `conversationKey`: `:`, such as `instagram:17841400000000001`, `facebook:6200000000000001` or `whatsapp:15551234567` (the WhatsApp number as digits, without `+`). With the message's `accountId` it identifies one conversation. Pass both to [List messages](https://www.tryadeli.com/docs/api/messages/list-messages) to read that conversation a page at a time, newest page first, following `nextCursor` toward older messages. ## WhatsApp Each profile can hold one WhatsApp number that the business connected itself, through Embedded Signup on the dashboard's **Accounts** page. It appears in `GET /api/v1/accounts` with `platform: "whatsapp"`, the phone number ID as `providerId`, and the display number as `displayIdentifier`, and its history is included in `GET /api/v1/messages`. WhatsApp history is what Adeli has received by webhook and sent, so a read makes no provider call. Through the API, WhatsApp sends **free text** inside the 24-hour window that opens when the customer writes, and one of the business's **approved templates** at any time — the only message WhatsApp allows when starting a conversation or more than 24 hours after the customer last wrote. A body carries `text` or `template`, never both (`400 invalid_request`). ```json { "platform": "whatsapp", "accountId": "00000000-0000-0000-0000-000000000000", "recipient": "+15551234567", "text": "Your order is ready for pickup." } ``` `text` is 1–4,096 characters. Outside the window, or to someone who has never written to the number, the response is `409 window_closed` and nothing is sent; send a template instead. Success returns `201` with `type: "text"`. **WhatsApp template body** | Name | Type | Required | Description | | ------------------------- | ------------ | -------- | --------------------------------------------------------------------------------------------------------------------- | | `platform` | `"whatsapp"` | Yes | | | `accountId` | `uuid` | Yes | The WhatsApp account in your organization. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `recipient` | `string` | Yes | An E.164 phone number, such as `+15551234567`. | | `text` | `string` | | Free text, 1–4,096 characters, inside the 24-hour window only. Give `text` or `template`. | | `template.name` | `string` | Yes | An approved template on the business's WhatsApp Business Account: lowercase letters, digits, and underscores. | | `template.language` | `string` | Yes | The template's language, such as `en_US`. | | `template.bodyParameters` | `string[]` | | Values for the body's `{{1}}`, `{{2}}`, … placeholders, in order. Up to 20; omit for a template without placeholders. | ```json { "platform": "whatsapp", "accountId": "00000000-0000-0000-0000-000000000000", "recipient": "+15551234567", "template": { "name": "order_update", "language": "en_US", "bodyParameters": ["Jane", "A-42"] } } ``` Success returns `201` with `type: "template"`. A number whose setup has not finished returns `422 setup_incomplete`; one whose access the business revoked returns `422 reconnect_required`. An unknown or unapproved template fails at Meta and surfaces as `502 provider_error`. WhatsApp numbers cannot be connected through `POST /api/v1/profiles/{profileId}/connect` yet — that returns `422 provider_not_supported`. Instagram/Facebook inbox reads and sends, and WhatsApp sends, check their own messaging scope plus provider-confirmed Page task or WABA/phone binding before provider calls. A partial connection lacking that authorization returns `403 permission_required` with the exact missing items and profile OAuth restart guidance. Existing stored conversation history is not reclassified as a broken connection. ## Compatibility Every existing request and response keeps working unchanged. Conversation reads, WhatsApp free text and the `message.created` webhook add new values to fields you may switch on: - `POST /api/v1/messages` takes a fourth body, WhatsApp `text`, so a client that handles every `sendMessage` body variant gains one. - Messages carry `conversationKey`, and `GET /api/v1/messages` responses filtered by it carry `nextCursor`. Unfiltered responses have no `nextCursor`. - [Webhooks](https://www.tryadeli.com/docs/api/webhooks) gain the `message.created` event `type` and the `facebook` and `whatsapp` values of `platform`. A receiver that switches exhaustively on `type` or `platform` should ignore, rather than reject, values it does not know. ## List messages URL: https://www.tryadeli.com/docs/api/messages/list-messages Markdown: https://www.tryadeli.com/docs/api/messages/list-messages.md Instagram, Facebook, and WhatsApp message history, oldest first. # List messages > Instagram, Facebook, and WhatsApp message history, oldest first. Canonical: `GET https://app.tryadeli.com/api/v1/messages` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Returns a flat array across the profile's Instagram, Facebook, and WhatsApp conversations, oldest first by `occurredAt`. Uses the [aggregate response contract](https://www.tryadeli.com/docs/concepts#partial-responses). Before answering, Adeli refreshes each Instagram and Facebook account from Meta at most once a minute. A read inside that minute returns the history Adeli has stored, which incoming messages keep current as they arrive, so polling more often does not reach Meta more often. Pass `accountId` and a `conversationKey` to read one conversation instead, a page at a time. Each page holds the conversation's newest `limit` messages before `cursor`, oldest first within the page, and `nextCursor` points at the next, older page — `null` once you reach the start of the conversation. Conversation pages are read from the history Adeli has stored, which Meta's webhooks keep current, so they do not wait on a provider refresh. Pass a `storyId` to get every reply to one of the account's Instagram stories. A reply carries that id in `story.id`. Each reply's `sender` is the person to message back with [Send an Instagram message](https://www.tryadeli.com/docs/api/messages/send-instagram-message). Their reply opens Instagram's 24-hour messaging window, so follow up within a day. **Query parameters** | Name | Type | Required | Description | | ----------------- | ----------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `platform` | `"instagram" \| "facebook" \| "whatsapp"` | | Return one provider's messages only. `facebook` covers every connected Facebook Page's Messenger conversations. Anything else, including `tiktok` and `youtube`, returns `422 unsupported_platform`. | | `accountId` | `uuid` | | Narrow to one connected account. | | `profileId` | `uuid` | | Required unless you pass accountId, which names its profile. If you pass both, they must agree. | | `conversationKey` | `string` | | One conversation: a message's `conversationKey`. Requires `accountId`; without it the response is `400 invalid_request`. | | `cursor` | `string` | | The previous page's `nextCursor`, to read older messages. Requires `conversationKey`. | | `limit` | `integer` | | Messages per conversation page, 1–100. Defaults to 50. Requires `conversationKey`. | | `storyId` | `string` | | Only the inbound messages that replied to this Instagram story: a message's `story.id`. Instagram only, so it can't be combined with another `platform` or with `conversationKey` (`400 invalid_request`). Never served from the cache below. | **Message fields** | Name | Type | Required | Description | | ----------------- | --------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `id` | `string` | | Adeli's identifier for this message. | | `providerId` | `string \| null` | | The provider's message id. | | `direction` | `"inbound" \| "outbound"` | | Relative to the connected account. | | `type` | `"text" \| "template" \| "unsupported"` | | `unsupported` covers media and other payloads Adeli does not normalize. | | `sender` | `string \| null` | | Set on inbound messages — the provider-scoped participant id (an IGSID on Instagram, a PSID on Facebook). | | `recipient` | `string \| null` | | Set on outbound messages. | | `status` | `string` | | Provider delivery state, such as `received` or `sent`. | | `occurredAt` | `ISO 8601` | | When the provider recorded the message. Sort on this. | | `conversationKey` | `string \| null` | | The platform, a colon, and the counterparty's id — the IGSID, PSID, or WhatsApp number as digits without `+` — such as `instagram:17841400000000001`. With `accountId` it names the conversation, on inbound and outbound messages alike. | | `story` | `object \| null` | | Set when an Instagram message replies to one of the account's stories (`type: "reply"`) or mentions the account in someone else's story (`type: "mention"`), with the story's `id` and `url`. The `url` stops working when the story expires. `null` on every other message. A story is recorded for replies Adeli stores from the time it started keeping them, and for the most recent messages of each conversation when it refreshes. | **Response fields with conversationKey** | Name | Type | Required | Description | | ------------ | ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------- | | `nextCursor` | `string \| null` | | Pass as `cursor` for the next, older page. `null` when there are no older messages. Absent without `conversationKey`. | If a provider sync fails, Adeli still returns the messages it has already persisted and reports the failure in `errors`, which makes the response `207`. > **Note: Complete responses may be 15 seconds old** > > After authenticating and authorizing the requested profile or account, Adeli > may replay a complete `200` response from its internal cache for 15 > seconds. Accepted sends and verified incoming message, status, and delete > changes normally invalidate affected entries sooner, but cache failures leave > the 15-second TTL as the fallback freshness bound. Partial and error responses > are never cached. Public responses remain `Cache-Control: private, no-store`, > so browsers and CDNs do not store message data. Polling more frequently is not > a force-refresh mechanism. **Errors** — `401 unauthorized`, `400 invalid_request`, `422 unsupported_platform`, `404 profile_not_found`, `404 account_not_found`, `502 provider_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/messages?platform=instagram&accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/messages?platform=instagram&accountId=00000000-0000-0000-0000-000000000000", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/messages", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "status": "complete", "messages": [ { "id": "instagram_message_aWdfbWlk", "providerId": "aWdfbWlk", "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "direction": "inbound", "type": "text", "recipient": null, "sender": "17841400000000001", "body": "Do you ship to Canada?", "status": "received", "occurredAt": "2026-04-01T12:00:00.000Z", "createdAt": "2026-04-01T12:00:01.000Z", "conversationKey": "instagram:17841400000000001", "story": null } ], "errors": [] } ``` ### 422 ```json { "error": { "code": "unsupported_platform", "message": "Unsupported platform" } } ``` ## Send message URL: https://www.tryadeli.com/docs/api/messages/send-message Markdown: https://www.tryadeli.com/docs/api/messages/send-message.md Send a text reply on Instagram or Facebook, or a WhatsApp template. # Send message > Send a text reply on Instagram or Facebook, or a WhatsApp template. Canonical: `POST https://app.tryadeli.com/api/v1/messages` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) **Body** | Name | Type | Required | Description | | ----------- | ----------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- | | `platform` | `"instagram" \| "facebook" \| "whatsapp"` | Yes | For `whatsapp`, see below. | | `accountId` | `uuid` | Yes | A connected Instagram account or Facebook Page in your organization. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `recipient` | `string` | Yes | The provider-scoped participant id, 1–200 characters. Take it from the `sender` field of an inbound message, not from a username. | | `text` | `string` | Yes | 1–1,000 characters on Instagram and Facebook, 1–4,096 on WhatsApp. | A Facebook reply has the same shape. `accountId` is the connected Page, and `recipient` is the person's PSID, from the `sender` field of their inbound message: ```json { "platform": "facebook", "accountId": "00000000-0000-0000-0000-000000000002", "recipient": "6200000000000001", "text": "Yes, we deliver on Saturdays." } ``` To send an Instagram private reply to a comment, or a message with buttons, use [Send Instagram message](https://www.tryadeli.com/docs/api/messages/send-instagram-message). WhatsApp sends free text to a customer inside the 24-hour window their last message opened. `accountId` is the connected WhatsApp number and `recipient` is the customer's number in E.164 form: ```json { "platform": "whatsapp", "accountId": "00000000-0000-0000-0000-000000000003", "recipient": "+15551234567", "text": "Your order is ready for pickup." } ``` Outside the window, or to someone who has never written, Adeli answers `409 window_closed` without sending; so does a send that WhatsApp refuses at the window's edge. Other WhatsApp refusals, such as an undeliverable recipient, are `422 provider_rejected` with WhatsApp's reason, and do not count against your monthly messages. Send an approved template instead, with `template` in place of `text` (never both); see [WhatsApp](https://www.tryadeli.com/docs/api/messages#whatsapp) for its body. Success returns `201` and a bare message object with `direction: "outbound"`, `type: "text"` (or `"template"`), `status: "sent"`, and the `conversationKey` of the conversation it went to. > **Note: Meta's messaging rules still apply** > > A business can message a person only inside the window Meta's policy opens, > which begins when that person messages the business. When Meta refuses a send > because that window has closed, the response is `409 window_closed`. Wait for > the person to message again before retrying. **Errors** — [`402 usage_limit_reached`](https://www.tryadeli.com/docs/billing#usage-limits), `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`, `404 account_not_found`, `409 window_closed`, `409 page_not_selected` (Facebook), `403 permission_required` with missing permission/resource and reconnect details, `422 connection_expired`, `422 provider_not_configured`, `422 provider_not_supported`, `422 setup_incomplete`, `422 reconnect_required` and `422 provider_rejected` (WhatsApp), `502 provider_error`. ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/messages" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "recipient": "17841400000000001", "text": "Yes, we ship to Canada." }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/messages", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ platform: "instagram", accountId: "00000000-0000-0000-0000-000000000000", recipient: "17841400000000001", text: "Yes, we ship to Canada.", }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/messages", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "recipient": "17841400000000001", "text": "Yes, we ship to Canada.", }, ) print(response.json()) ``` ## Responses ### 201 ```json { "id": "instagram_message_aWdfbWlkMg", "providerId": "aWdfbWlkMg", "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "direction": "outbound", "type": "text", "recipient": "17841400000000001", "sender": "17841400000000000", "body": "Yes, we ship to Canada.", "status": "sent", "occurredAt": "2026-04-01T12:05:00.000Z", "createdAt": "2026-04-01T12:05:00.000Z", "conversationKey": "instagram:17841400000000001" } ``` ### 409 ```json { "error": { "code": "window_closed", "message": "Instagram's 24-hour reply window has closed for this recipient" } } ``` ## Send Instagram message URL: https://www.tryadeli.com/docs/api/messages/send-instagram-message Markdown: https://www.tryadeli.com/docs/api/messages/send-instagram-message.md Send an Instagram DM or a private reply to a comment, with optional buttons. # Send Instagram message > Send an Instagram DM or a private reply to a comment, with optional buttons. Canonical: `POST https://app.tryadeli.com/api/v1/messages/instagram` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Send an Instagram DM, or a **private reply** to the author of a comment, as text or with up to three buttons. This is how a comment-to-DM flow works: reply privately to a comment with a button, and when the person taps it, send them a follow-up. **Body** | Name | Type | Required | Description | | ----------- | ------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `accountId` | `uuid` | Yes | A connected Instagram account in your organization. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `recipient` | `{ id } \| { commentId }` | Yes | `{ id }` is a person's Instagram-scoped id, such as a comment's `authorId` from [List comments](https://www.tryadeli.com/docs/api/comments/list-comments). `{ commentId }` sends a private reply to that comment's author. | | `text` | `string` | Yes | 1–1,000 characters, or up to 640 with buttons. | | `buttons` | `Button[]` | | 1–3 buttons. `{ type: "postback", title, payload }` sends `payload` back to you when tapped; `{ type: "url", title, url }` opens an `https` link. Titles are up to 20 characters, payloads up to 1,000. | Success returns `201` and a message object with `type: "text"` or `type: "buttons"`. `recipient` is the person's Instagram-scoped id, even for a private reply, so you can message them again once they respond. > **Note: Private replies** > > Instagram allows **one** private reply per comment, within 7 days of the > comment. A second attempt returns `409 private_reply_already_sent`. An account > connected through a Facebook Page (`authMethod: "facebook_login"`) returns > `400 unsupported_for_platform`; disconnect it and connect again with > Instagram. After a private reply you can > message the person again only once they respond, for example by tapping a > postback button; until then a DM returns `409 window_closed`. **Errors** — [`402 usage_limit_reached`](https://www.tryadeli.com/docs/billing#usage-limits), `401 unauthorized`, `400 invalid_request`, `400 unsupported_for_platform`, `404 profile_not_found`, `404 account_not_found`, `409 window_closed`, `409 private_reply_already_sent`, `403 permission_required` with missing permission and reconnect details, `422 connection_expired`, `502 provider_error`. ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/messages/instagram" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "accountId": "00000000-0000-0000-0000-000000000000", "recipient": { "commentId": "17966240925214757" }, "text": "Thanks for the comment! Tap below and I'\''ll send you the guide.", "buttons": [ { "type": "postback", "title": "Send it", "payload": "guide-request-42" } ] }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/messages/instagram", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ accountId: "00000000-0000-0000-0000-000000000000", recipient: { commentId: "17966240925214757", }, text: "Thanks for the comment! Tap below and I'll send you the guide.", buttons: [ { type: "postback", title: "Send it", payload: "guide-request-42", }, ], }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/messages/instagram", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "accountId": "00000000-0000-0000-0000-000000000000", "recipient": { "commentId": "17966240925214757", }, "text": "Thanks for the comment! Tap below and I'll send you the guide.", "buttons": [ { "type": "postback", "title": "Send it", "payload": "guide-request-42", }, ], }, ) print(response.json()) ``` ## Responses ### 201 ```json { "id": "instagram_message_aWdfbWlkMw", "providerId": "aWdfbWlkMw", "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "direction": "outbound", "type": "buttons", "recipient": "17841400000000001", "sender": "17841400000000000", "body": "Thanks for the comment! Tap below and I'll send you the guide.", "status": "sent", "occurredAt": "2026-10-27T21:20:00.000Z", "createdAt": "2026-10-27T21:20:00.000Z" } ``` ### 409 ```json { "error": { "code": "private_reply_already_sent", "message": "This comment has already received its one private reply" } } ``` ## Get Instagram user URL: https://www.tryadeli.com/docs/api/messages/get-instagram-user Markdown: https://www.tryadeli.com/docs/api/messages/get-instagram-user.md Read someone who messaged the account, and whether they follow it. # Get Instagram user > Read someone who messaged the account, and whether they follow it. Canonical: `GET https://app.tryadeli.com/api/v1/messages/instagram/users/{igsid}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Read someone who has messaged an Instagram account: their username and name, and whether they follow the account. Use it to gate a comment-to-DM flow on a follow: when the person taps your button, check `isFollowing` before sending the link, and ask them to follow first if it is `false`. The answer comes live from Instagram on every call, so a follow made a moment ago shows up straight away. **Path parameters** | Name | Type | Required | Description | | ------- | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `igsid` | `string` | Yes | The person's Instagram-scoped id: `from.id` on a [`message.created`](https://www.tryadeli.com/docs/api/webhooks#direct-messages) event or `senderId` on a `message.postback`. | **Query parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | --------------------------------------------------------------------------------- | | `accountId` | `uuid` | Yes | The connected Instagram account they messaged. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | `isFollowing` is whether the person follows the account, and `isFollowedByAccount` whether the account follows them. Either is null when Instagram does not say. > **Note: Only after they message you** > > Instagram shares a person's profile only once they have sent the account a > message or tapped one of its buttons. Before that, the response is > `409 user_consent_required`. Someone who taps a button on your private reply > has already done so. **Errors** — `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`, `404 account_not_found`, `404 user_not_found`, `409 user_consent_required`, `403 permission_required` with missing permission and reconnect details, `422 connection_expired`, `502 provider_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/messages/instagram/users/17841400000000001?accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/messages/instagram/users/17841400000000001?accountId=00000000-0000-0000-0000-000000000000", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/messages/instagram/users/17841400000000001", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000001", "user": { "id": "17841400000000001", "username": "maya.makes", "name": "Maya", "followerCount": 812, "isFollowing": true, "isFollowedByAccount": false } } ``` ### 409 ```json { "error": { "code": "user_consent_required", "message": "Instagram shares this person's profile only after they have sent the account a message or tapped one of its buttons" } } ``` --- # Webhooks ## Webhooks URL: https://www.tryadeli.com/docs/api/webhooks Markdown: https://www.tryadeli.com/docs/api/webhooks.md Signed callbacks for new Instagram and TikTok comments, inbound Instagram, Facebook and WhatsApp messages, and postback button taps. # Webhooks > Signed callbacks for new Instagram and TikTok comments, inbound Instagram, Facebook and WhatsApp messages, and postback button taps. Canonical: Register a URL and Adeli POSTs a signed JSON event to it when someone comments on a connected Instagram or TikTok account's post, sends a direct message to a connected Instagram account, Facebook Page or WhatsApp number, or taps a postback button you sent with [Send Instagram message](https://www.tryadeli.com/docs/api/messages/send-instagram-message). Together they are everything a comment-to-DM automation or a chat bot needs. Webhooks belong to one profile, and cover its Instagram, TikTok, Facebook and WhatsApp accounts. Pass `platform` when you [create one](https://www.tryadeli.com/docs/api/webhooks/create-webhook) to receive a single platform's events; without it, a webhook receives every supported platform. A webhook created before `platform` existed receives every platform. An Instagram account connected through a Facebook Page (`facebook_login`) lacks the comments permission, and a TikTok account connected without comment access lacks it too; neither sends events until it is connected with that access. ## Endpoints - `GET /api/v1/webhooks` — [List webhooks](https://www.tryadeli.com/docs/api/webhooks/list-webhooks.md) - `POST /api/v1/webhooks` — [Create webhook](https://www.tryadeli.com/docs/api/webhooks/create-webhook.md) - `DELETE /api/v1/webhooks/{webhookId}` — [Delete webhook](https://www.tryadeli.com/docs/api/webhooks/delete-webhook.md) - `POST /api/v1/webhooks/{webhookId}/test` — [Send a test event](https://www.tryadeli.com/docs/api/webhooks/test-webhook.md) ## Events Every event has the same envelope: ```json { "id": "evt_3f1c2b9a8d7e6f5a4b3c2d1e0f9a8b7c", "type": "comment.created", "createdAt": "2026-10-27T21:08:59.000Z", "profileId": "00000000-0000-4000-8000-000000000001", "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "data": {} } ``` `platform` is `instagram`, `tiktok`, `facebook` or `whatsapp`. An event sent by [Send a test event](https://www.tryadeli.com/docs/api/webhooks/test-webhook) also has `"test": true`. | `type` | When | `data` | | ------------------ | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `comment.created` | Someone comments on, or replies under, one of the account's posts. | `commentId`, `mediaId`, `parentId` (null for a top-level comment), `text`, `from: { id, username }`, and `isSelf`, true when the account commented itself. `from.id` is the commenter's Instagram-scoped id: send it a private reply with `recipient: { commentId }`. | | `message.postback` | Someone taps a postback button the account sent. Instagram only. | `senderId` (their Instagram-scoped id, for `recipient: { id }`), `payload` (the button's payload), `title` (the button's title), `messageId`. | | `message.created` | Someone sends a direct message to the account. Instagram, Facebook and WhatsApp. | `messageId`, `conversationKey`, `from: { id, username }`, `text` (null for an attachment-only message), `attachments: [{ type, url }]`, `replyTo: { messageId }` or null, `story` (an Instagram story reply or mention) or null, and `isEcho`, always false. See [Direct messages](https://www.tryadeli.com/docs/api/webhooks#direct-messages). | Each platform sends only some events: | `platform` | Events | | ----------- | -------------------------------------------------------- | | `instagram` | `comment.created`, `message.postback`, `message.created` | | `tiktok` | `comment.created` | | `facebook` | `message.created` | | `whatsapp` | `message.created` | Events arrive for every new comment, whether or not anyone has opened the post in Adeli. ### TikTok comments A TikTok `comment.created` is sent once TikTok has made the comment public. TikTok moderates every new comment within a few seconds of it being written, and a comment it hides is never sent. Adeli fetches each comment before sending it, so expect events within about a minute of the comment; TikTok itself allows up to five minutes to notify Adeli. ```json { "id": "evt_9b2e4c1d0a8f7e6d5c4b3a2f1e0d9c8b", "type": "comment.created", "createdAt": "2026-11-02T17:29:08.000Z", "profileId": "00000000-0000-4000-8000-000000000001", "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "data": { "commentId": "7703627334771688223", "mediaId": "7692110307367423245", "parentId": null, "text": "they sound awesome!", "from": { "id": "+ZMA647RQ04dWKwheRsYq", "username": "a.commenter", "displayName": "A Commenter" }, "isSelf": false } } ``` `mediaId` is the TikTok video id. `from.id` is TikTok's id for the commenter, and `from.displayName` appears only on TikTok events. `username` and `displayName` are null in the rare case that TikTok would not return the comment to Adeli but had already made it public. Reply with [Create comment](https://www.tryadeli.com/docs/api/comments/create-comment) using `parentId`. ### Direct messages A `message.created` is sent for each message someone sends to a connected Instagram account, Facebook Page or WhatsApp number. Messages the account sends itself, including replies you send through Adeli or from the Instagram, Facebook or WhatsApp apps, are never sent, so a bot that answers every `message.created` does not answer itself. Unsent and deleted messages, WhatsApp delivery and read receipts, and WhatsApp reactions and orders are not sent either. The message is stored before its event is sent, so you can read the conversation back with [List messages](https://www.tryadeli.com/docs/api/messages/list-messages) and `conversationKey` as soon as the event arrives. The one exception is a first Instagram or Facebook message from someone new while Meta is rate-limiting the account: it appears in the list shortly after. ```json { "id": "evt_7c1d9e2f3a4b5c6d7e8f9a0b1c2d3e4f", "type": "message.created", "createdAt": "2026-11-06T15:04:05.000Z", "profileId": "00000000-0000-4000-8000-000000000001", "platform": "instagram", "accountId": "00000000-0000-0000-0000-000000000000", "data": { "messageId": "aWdfZAG1faXRlbToxOklHTWVzc2FnZAWQ", "conversationKey": "instagram:1784000000000001", "from": { "id": "1784000000000001", "username": null }, "text": "Hi, is this still available?", "attachments": [{ "type": "image", "url": "https://lookaside.fbsbx.com/…" }], "replyTo": null, "story": null, "isEcho": false } } ``` - `messageId` is the platform's own message id: the Instagram or Facebook `mid`, or the WhatsApp `wamid`. - `from.id` is the sender: their Instagram-scoped id, Page-scoped id, or WhatsApp number as digits with no `+`. Reply to it with [Send message](https://www.tryadeli.com/docs/api/messages/send-message). `from.username` is null. - `conversationKey` is `:`, and together with `accountId` identifies the conversation. Every message in a thread has the same key. - `attachments[].type` is `image`, `video`, `audio` or `file`; a shared post or anything else is a `file`. `url` may be null. WhatsApp sends media without a link, so a WhatsApp attachment's `url` is always null, and a media caption is the `text`. A WhatsApp location arrives as text such as `[location] Central Park, New York, NY 40.7812,-73.9665`, and a contact card as `[contact] `. - `replyTo.messageId` is the message the sender replied to, when they used Reply. - `story` is set when an Instagram message is about one of the account's stories, and null otherwise (always null on Facebook and WhatsApp). `{ "type": "reply", "id", "url" }` is a reply to the account's story; `{ "type": "mention", "id", "url" }` is a mention of the account in someone else's story, which also arrives as a `file` attachment. `id` and `url` may be null, and the story's `url` expires. To check whether the sender follows the account, use [Get Instagram user](https://www.tryadeli.com/docs/api/messages/get-instagram-user). Instagram sends message events only for accounts connected with Instagram's Unified Login or Instagram Login, like comments. Each message is sent once per connected account; Meta's redeliveries keep the same event `id`. ## Verifying signatures Each request carries three headers: | Header | Value | | ------------------ | --------------------------------------- | | `Adeli-Signature` | `t=,v1=` | | `Adeli-Event-Id` | The event's `id` | | `Adeli-Event-Type` | The event's `type` | `v1` is the HMAC-SHA256 of `.`, keyed with the webhook's signing secret, which [Create webhook](https://www.tryadeli.com/docs/api/webhooks/create-webhook) returns once. Compute it over the raw body before parsing JSON, compare in constant time, and reject a `t` more than five minutes from your clock, so a captured request cannot be replayed: ```ts import { createHmac, timingSafeEqual } from "node:crypto"; export function verify(rawBody: string, header: string | null, secret: string) { const parts = new Map((header ?? "").split(",").map((part) => part.split("=", 2) as [string, string])); const t = Number(parts.get("t")); const v1 = parts.get("v1") ?? ""; if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > 300 || !/^[0-9a-f]{64}$/.test(v1)) return false; const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest(); return timingSafeEqual(expected, Buffer.from(v1, "hex")); } ``` ## Delivery and retries Answer with any `2xx` within 10 seconds; do slow work afterwards. Any other status, a timeout or a network error is retried after 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours, six attempts in all. Redirects are not followed. A `410 Gone` disables the webhook; create it again to resume. Delivery is **at least once**, and Meta itself sometimes sends the same comment or message twice. The same event always has the same `id`, so record the ids you have handled and ignore repeats. To rotate a secret, delete the webhook and create it again. ## Setting up a webhook A webhook is a URL on your server that accepts Adeli's `POST` requests. To set one up: 1. **Write a receiver.** An HTTPS endpoint that reads the raw request body, [verifies the signature](https://www.tryadeli.com/docs/api/webhooks#verifying-signatures), handles the event, and answers `2xx` within 10 seconds. The [example below](https://www.tryadeli.com/docs/api/webhooks#testing-a-webhook) is a complete receiver. 2. **Make it reachable.** Adeli sends from its own servers, so the URL must be public `https`. `http://localhost` is refused with `422 url_not_reachable`. For a receiver on your laptop, use an HTTPS tunnel such as `ngrok http 4242` and register the tunnel's URL. 3. **Register it.** In the dashboard, open **Webhooks**, click **Add webhook**, choose the platform, enter the URL and tick the events you want. Or call [Create webhook](https://www.tryadeli.com/docs/api/webhooks/create-webhook). A webhook belongs to one profile. 4. **Store the signing secret.** It is shown once, when the webhook is created. Keep it in your server's environment, for example `ADELI_WEBHOOK_SECRET`. To change it, delete the webhook and create it again. ## Testing a webhook You don't have to wait for a real comment. Adeli can send a signed sample event, marked `"test": true`, to any webhook on demand. ### 1. Run a receiver Save this as `receiver.mjs`. It needs Node.js 18 or later and no packages. It verifies each request's signature, prints the event, and answers `204`, or `401` when the signature is wrong: ```js import { createHmac, timingSafeEqual } from "node:crypto"; import { createServer } from "node:http"; const secret = process.env.ADELI_WEBHOOK_SECRET; if (!secret) throw new Error("Set ADELI_WEBHOOK_SECRET to the webhook's signing secret"); function verify(rawBody, header) { const parts = new Map((header ?? "").split(",").map((part) => part.split("=", 2))); const t = Number(parts.get("t")); const v1 = parts.get("v1") ?? ""; if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > 300 || !/^[0-9a-f]{64}$/.test(v1)) return false; const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest(); return timingSafeEqual(expected, Buffer.from(v1, "hex")); } createServer((request, response) => { let body = ""; request.on("data", (chunk) => (body += chunk)); request.on("end", () => { if (!verify(body, request.headers["adeli-signature"])) { console.log("Rejected: bad signature"); return response.writeHead(401).end(); } const event = JSON.parse(body); console.log(`${event.test ? "Test " : ""}${event.type} from ${event.platform}:`, event.data); response.writeHead(204).end(); }); }).listen(4242, () => console.log("Listening on http://localhost:4242")); ``` ### 2. Expose it In a second terminal, give it a public HTTPS URL: ```sh ngrok http 4242 ``` Copy the `https://….ngrok-free.app` URL that ngrok prints. ### 3. Register the URL and start the receiver Add a webhook for the ngrok URL ([Setting up a webhook](https://www.tryadeli.com/docs/api/webhooks#setting-up-a-webhook)), then start the receiver with the secret Adeli shows you: ```sh ADELI_WEBHOOK_SECRET=whsec_... node receiver.mjs ``` ### 4. Send a test event In the dashboard, click **Send test event** on the webhook's row. A webhook with more than one event or platform lets you choose which sample to send. Or call [Send a test event](https://www.tryadeli.com/docs/api/webhooks/test-webhook): ```sh curl -s -X POST https://app.tryadeli.com/api/v1/webhooks//test \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "content-type: application/json" \ -d '{"type":"comment.created","platform":"tiktok"}' ``` The receiver prints `Test comment.created from tiktok:` and the sample data. The dashboard row turns green and reads **Reachable** with `HTTP 204`, and the API answers `{"delivered":true,"statusCode":204,...}`. ### If it fails | You see | It means | | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | | `HTTP 401` | The receiver rejected the signature. Start it with this webhook's signing secret, and verify the raw body before parsing it. | | `timed out` or `request failed` | Adeli could not reach the URL in 10 seconds. Check that the receiver and the tunnel are running and the URL matches. | | Another status, such as `404` or `500` | The receiver answered with an error. Check the path and its logs. | | `429 rate_limited` | One test per webhook every five seconds. Wait and send again. | The dashboard keeps the last result, so the status stays after you reload. It shows the last attempt, test or real, not continuous monitoring. Editing a webhook's URL, platform or events resets it to **Not checked**. ## List webhooks URL: https://www.tryadeli.com/docs/api/webhooks/list-webhooks Markdown: https://www.tryadeli.com/docs/api/webhooks/list-webhooks.md A profile's webhooks, without their secrets. # List webhooks > A profile's webhooks, without their secrets. Canonical: `GET https://app.tryadeli.com/api/v1/webhooks` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) List a profile's webhooks. Signing secrets are never returned here. **Query** | Name | Type | Required | Description | | ----------- | ------ | -------- | ----------------------------------- | | `profileId` | `uuid` | Yes | The profile whose webhooks to list. | Returns `200` with `{ webhooks }`. A webhook's `platform` is the one platform it receives events from, or `null` for every supported platform. Its `status` is `active`, or `disabled` after its URL answered `410 Gone`; it says whether Adeli delivers to the URL, not whether the URL is reachable. Use [Send a test event](https://www.tryadeli.com/docs/api/webhooks/test-webhook) to check that. **Errors** — `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/webhooks?profileId=00000000-0000-4000-8000-000000000001" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/webhooks?profileId=00000000-0000-4000-8000-000000000001", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/webhooks", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "profileId": "00000000-0000-4000-8000-000000000001", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "webhooks": [ { "id": "00000000-0000-4000-8000-000000000009", "profileId": "00000000-0000-4000-8000-000000000001", "url": "https://example.com/webhooks/adeli", "events": ["comment.created", "message.postback"], "platform": null, "status": "active", "createdAt": "2026-10-27T21:30:00.000Z" } ] } ``` ### 404 ```json { "error": { "code": "profile_not_found", "message": "Profile not found" } } ``` ## Create webhook URL: https://www.tryadeli.com/docs/api/webhooks/create-webhook Markdown: https://www.tryadeli.com/docs/api/webhooks/create-webhook.md Register a URL for events and get its signing secret, once. # Create webhook > Register a URL for events and get its signing secret, once. Canonical: `POST https://app.tryadeli.com/api/v1/webhooks` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Register a URL for a profile's events. The response holds the signing secret, **the only time it is shown**: store it, and use it to [verify every delivery](https://www.tryadeli.com/docs/api/webhooks#verifying-signatures). **Body** | Name | Type | Required | Description | | ----------- | ---------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `profileId` | `uuid` | Yes | The profile whose accounts' events to send. | | `url` | `string` | Yes | An `https` URL. `http://localhost` and `http://127.0.0.1` are accepted only by an Adeli running on your own machine; from `app.tryadeli.com`, expose a local receiver through an HTTPS tunnel instead. No credentials or fragment. | | `events` | `string[]` | Yes | One or more of `comment.created`, `message.postback` and `message.created`. | | `platform` | `string` | | `instagram`, `tiktok`, `facebook` or `whatsapp`: send only that platform's events. Omit it to receive every supported platform. Each platform sends only some events: `comment.created` needs `instagram` or `tiktok`, `message.postback` needs `instagram`, and `message.created` needs `instagram`, `facebook` or `whatsapp`, or no platform. | Returns `201` with `{ webhook, secret }`. `webhook.platform` is the platform you passed, or `null` for every platform. **Errors** — `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`, `422 url_not_reachable` (a loopback URL Adeli cannot reach from where it runs), `422 unsupported_for_platform` (an event the platform does not send, such as `message.postback` or `message.created` with `platform: "tiktok"`). ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/webhooks" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "profileId": "00000000-0000-4000-8000-000000000001", "url": "https://example.com/webhooks/adeli", "events": [ "comment.created", "message.postback" ], "platform": "instagram" }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/webhooks", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ profileId: "00000000-0000-4000-8000-000000000001", url: "https://example.com/webhooks/adeli", events: [ "comment.created", "message.postback", ], platform: "instagram", }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/webhooks", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "profileId": "00000000-0000-4000-8000-000000000001", "url": "https://example.com/webhooks/adeli", "events": [ "comment.created", "message.postback", ], "platform": "instagram", }, ) print(response.json()) ``` ## Responses ### 201 ```json { "webhook": { "id": "00000000-0000-4000-8000-000000000009", "profileId": "00000000-0000-4000-8000-000000000001", "url": "https://example.com/webhooks/adeli", "events": ["comment.created", "message.postback"], "platform": "instagram", "status": "active", "createdAt": "2026-10-27T21:30:00.000Z" }, "secret": "whsec_4Jx0m2v8QyRZbq1hT6nUWc3kLp9sAdEf7GiHoNrVtYz" } ``` ### 400 ```json { "error": { "code": "invalid_request", "message": "Invalid webhook" } } ``` ## Delete webhook URL: https://www.tryadeli.com/docs/api/webhooks/delete-webhook Markdown: https://www.tryadeli.com/docs/api/webhooks/delete-webhook.md Delete a webhook. # Delete webhook > Delete a webhook. Canonical: `DELETE https://app.tryadeli.com/api/v1/webhooks/{webhookId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Delete a webhook. Events not yet delivered to it are dropped. To rotate a signing secret, delete the webhook and create it again. Returns `204` with no body. **Errors** — `401 unauthorized`, `404 webhook_not_found`. ## Request examples **cURL** ```bash curl -X DELETE "https://app.tryadeli.com/api/v1/webhooks/00000000-0000-4000-8000-000000000009" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/webhooks/00000000-0000-4000-8000-000000000009", { method: "DELETE", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(response.status); // 204: no body ``` **Python** ```python import os import requests response = requests.delete( "https://app.tryadeli.com/api/v1/webhooks/00000000-0000-4000-8000-000000000009", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, ) print(response.status_code) # 204: no body ``` ## Responses ### 204 No Content ```text (empty body) ``` ### 404 ```json { "error": { "code": "webhook_not_found", "message": "Webhook not found" } } ``` ## Send a test event URL: https://www.tryadeli.com/docs/api/webhooks/test-webhook Markdown: https://www.tryadeli.com/docs/api/webhooks/test-webhook.md Send one signed sample event now and see what your receiver answered. # Send a test event > Send one signed sample event now and see what your receiver answered. Canonical: `POST https://app.tryadeli.com/api/v1/webhooks/{webhookId}/test` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Send one signed sample event to a webhook now, and get back what your receiver answered. Use it to check a receiver before any real comment arrives: the event has exactly the envelope and headers of a real one, with ids prefixed `test_` and `"test": true` at the top level. There is one attempt, with the same 10-second timeout as a real delivery and no redirects, and no retries. Test events are not queued, and a failing answer (even `410`) never disables the webhook. Each webhook accepts one test event every few seconds. **Body** | Name | Type | Required | Description | | ---------- | -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `type` | `string` | | `comment.created` (default), `message.postback` or `message.created`. | | `platform` | `string` | | `tiktok` (default), `instagram`, `facebook` or `whatsapp`. The platform must send the type: `message.postback` is Instagram-only, and `message.created` needs `instagram`, `facebook` or `whatsapp`. | The body is optional. Returns `200` with `{ eventId, delivered, statusCode, error }`: `delivered` is true for any `2xx`, `statusCode` is null when the request never got an answer, and `error` says why (`timed out`, `request failed`, or `HTTP `). **Errors** — `401 unauthorized`, `400 invalid_request`, `404 webhook_not_found`, `422 unsupported_for_platform` (a type the platform does not send), `429 rate_limited` (with `Retry-After`). The event your receiver gets: ```json { "id": "evt_test_5f0c2a9e7b1d4c3a2f1e0d9c", "type": "comment.created", "createdAt": "2026-11-02T17:00:00.000Z", "profileId": "00000000-0000-4000-8000-000000000001", "platform": "tiktok", "accountId": "00000000-0000-0000-0000-000000000000", "test": true, "data": { "commentId": "test_7400000000000000001", "mediaId": "test_7400000000000000000", "parentId": null, "text": "Test comment from Adeli", "from": { "id": "test_user", "username": "adeli.test", "displayName": "Adeli Test" }, "isSelf": false } } ``` ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/webhooks/00000000-0000-4000-8000-000000000009/test" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "comment.created", "platform": "tiktok" }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/webhooks/00000000-0000-4000-8000-000000000009/test", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ type: "comment.created", platform: "tiktok", }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/webhooks/00000000-0000-4000-8000-000000000009/test", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, json={ "type": "comment.created", "platform": "tiktok", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "eventId": "evt_test_5f0c2a9e7b1d4c3a2f1e0d9c", "delivered": true, "statusCode": 204, "error": null } ``` ### 200 Receiver rejected it ```json { "eventId": "evt_test_5f0c2a9e7b1d4c3a2f1e0d9c", "delivered": false, "statusCode": 401, "error": "HTTP 401" } ``` ### 429 ```json { "error": { "code": "rate_limited", "message": "One test event per webhook every few seconds; retry shortly", "details": { "retryAfterSeconds": 3 } } } ``` --- # Analytics ## Analytics URL: https://www.tryadeli.com/docs/api/analytics Markdown: https://www.tryadeli.com/docs/api/analytics.md Instagram account insights, Facebook Page metrics, TikTok profile statistics, account insights, and post insights, and YouTube channel and video insights. # Analytics > Instagram account insights, Facebook Page metrics, TikTok profile statistics, account insights, and post insights, and YouTube channel and video insights. Canonical: Platform-specific endpoints. Unlike accounts, posts, and messages, these are deliberately **not** normalized into a shared shape — the providers measure genuinely different things, and flattening them would invent numbers none of them reports. All of them are single-account reads, so none uses the aggregate envelope. > **Note:** > > The dashboard currently loads Analytics for TikTok and YouTube only. Facebook > and Instagram are omitted from its platform filter, requests, and All-platform > totals because fresh approved-only Meta grants omit Insights permissions. The API retains its permission-gated Meta implementation for a > direct or legacy token whose actual grant still supports it. ## Endpoints - `GET /api/v1/analytics/instagram/account-insights` — [Instagram account insights](https://www.tryadeli.com/docs/api/analytics/instagram-account-insights.md) - `GET /api/v1/analytics/tiktok/account-analytics` — [TikTok account analytics](https://www.tryadeli.com/docs/api/analytics/tiktok-account-analytics.md) - `GET /api/v1/analytics/tiktok/account-insights` — [TikTok account insights](https://www.tryadeli.com/docs/api/analytics/tiktok-account-insights.md) - `GET /api/v1/analytics/tiktok/video-insights` — [TikTok post insights](https://www.tryadeli.com/docs/api/analytics/tiktok-post-insights.md) - `GET /api/v1/analytics/facebook/page-metrics` — [Facebook Page metrics](https://www.tryadeli.com/docs/api/analytics/facebook-page-metrics.md) - `GET /api/v1/analytics/youtube/channel-insights` — [YouTube channel insights](https://www.tryadeli.com/docs/api/analytics/youtube-channel-insights.md) - `GET /api/v1/analytics/youtube/video-insights` — [YouTube video insights](https://www.tryadeli.com/docs/api/analytics/youtube-video-insights.md) - `GET /api/v1/analytics/linkedin/account-insights` — [LinkedIn account insights](https://www.tryadeli.com/docs/api/analytics/linkedin-account-insights.md) - `GET /api/v1/analytics/linkedin/post-insights` — [LinkedIn post insights](https://www.tryadeli.com/docs/api/analytics/linkedin-post-insights.md) ## Not available Instagram media-level insights and Facebook per-post insights are not part of v1. TikTok and YouTube per-post insights are: [TikTok post insights](https://www.tryadeli.com/docs/api/analytics/tiktok-post-insights) and [YouTube video insights](https://www.tryadeli.com/docs/api/analytics/youtube-video-insights). LinkedIn post insights cover a personal profile's posts only when they were published through Adeli: [LinkedIn post insights](https://www.tryadeli.com/docs/api/analytics/linkedin-post-insights). ## Analytics permission Analytics scopes are feature requirements, not connection gates. An account with a usable token can stay Connected while Analytics returns `403 permission_required` naming the exact scope/resource and a profile OAuth restart action. Other granted reads continue to work, and aggregate responses retain their successful providers. ## Instagram account insights URL: https://www.tryadeli.com/docs/api/analytics/instagram-account-insights Markdown: https://www.tryadeli.com/docs/api/analytics/instagram-account-insights.md Views, reach, interactions, and accounts engaged over 28 days. # Instagram account insights > Views, reach, interactions, and accounts engaged over 28 days. Canonical: `GET https://app.tryadeli.com/api/v1/analytics/instagram/account-insights` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Returns Instagram's own insight records for a rolling 28-day window, covering `views`, `reach`, `total_interactions`, and `accounts_engaged`. **Query parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | --------------------------------------------------------------------------------- | | `accountId` | `uuid` | Yes | A connected Instagram account. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | > **Note: An empty insights array is normal** > > Instagram omits metrics entirely for accounts with too few followers or too > little history, and its data lags by up to 48 hours. Render a missing metric as > unavailable rather than as zero — they mean different things. `insights` is Instagram's array, passed through unchanged. Adeli does not store history, so each call is a live read. **Errors** — `401 unauthorized`, `400 invalid_request`, `404 account_not_found`, `404 profile_not_found`, `422 connection_expired`, `422 provider_not_configured`, `502 provider_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/analytics/instagram/account-insights?accountId=00000000-0000-4000-8000-000000000003" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/analytics/instagram/account-insights?accountId=00000000-0000-4000-8000-000000000003", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/analytics/instagram/account-insights", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-4000-8000-000000000003", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "instagram", "accountId": "00000000-0000-4000-8000-000000000003", "profileId": "00000000-0000-4000-8000-000000000001", "insights": [{ "name": "reach", "values": [] }], "fetchedAt": "2026-04-01T12:00:00.000Z" } ``` ### 422 ```json { "error": { "code": "connection_expired", "message": "Instagram connection has expired" } } ``` ## TikTok account analytics URL: https://www.tryadeli.com/docs/api/analytics/tiktok-account-analytics Markdown: https://www.tryadeli.com/docs/api/analytics/tiktok-account-analytics.md A TikTok account's profile and lifetime counters. # TikTok account analytics > A TikTok account's profile and lifetime counters. Canonical: `GET https://app.tryadeli.com/api/v1/analytics/tiktok/account-analytics` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Returns the TikTok account's profile and lifetime counters, read from TikTok API for Business. For daily figures and audience demographics use [TikTok account insights](https://www.tryadeli.com/docs/api/analytics/tiktok-account-insights). **Query parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | --------------------------------------------------------------------------------- | | `accountId` | `uuid` | Yes | A connected TikTok account. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | `openId` is TikTok's app-scoped id for the account. `isBusinessAccount` tells a TikTok Business Account from a personal one; some insight fields in [TikTok account insights](https://www.tryadeli.com/docs/api/analytics/tiktok-account-insights) exist only for business accounts. **Errors** — `401 unauthorized`, `400 invalid_request`, `404 account_not_found`, `404 profile_not_found`, `422 connection_expired`, `422 provider_not_configured`, `429 rate_limited`, `502 provider_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/analytics/tiktok/account-analytics?accountId=00000000-0000-4000-8000-000000000003" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/analytics/tiktok/account-analytics?accountId=00000000-0000-4000-8000-000000000003", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/analytics/tiktok/account-analytics", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-4000-8000-000000000003", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "tiktok", "accountId": "00000000-0000-4000-8000-000000000003", "profileId": "00000000-0000-4000-8000-000000000001", "profile": { "openId": "app-scoped-open-id", "username": "creator", "displayName": "Creator", "avatarUrl": "https://example.com/avatar.jpg", "profileDeepLink": "https://www.tiktok.com/@creator", "bioDescription": "Profile bio", "isVerified": false, "isBusinessAccount": true }, "analytics": { "followers": 1200, "following": 80, "likes": 5400, "videos": 42 }, "fetchedAt": "2026-04-01T12:00:00.000Z" } ``` ### 404 ```json { "error": { "code": "account_not_found", "message": "TikTok account not found" } } ``` ### 429 ```json { "error": { "code": "rate_limited", "message": "TikTok rate limit reached; retry later" } } ``` ## TikTok account insights URL: https://www.tryadeli.com/docs/api/analytics/tiktok-account-insights Markdown: https://www.tryadeli.com/docs/api/analytics/tiktok-account-insights.md Daily metrics and follower demographics for a TikTok account. # TikTok account insights > Daily metrics and follower demographics for a TikTok account. Canonical: `GET https://app.tryadeli.com/api/v1/analytics/tiktok/account-insights` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Returns the account's daily metrics and follower demographics for a window of complete UTC days. Needs the `user.insights` permission, which every connection made since Adeli moved to TikTok API for Business has granted. **Query parameters** | Name | Type | Required | Description | | ----------- | ------------ | -------- | ---------------------------------------------------------------------------------------------------------- | | `accountId` | `uuid` | Yes | A connected TikTok account. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `startDate` | `YYYY-MM-DD` | | First day, UTC. At most 60 days ago. Give both dates or neither; the default is the last 28 complete days. | | `endDate` | `YYYY-MM-DD` | | Last day, UTC, before today and on or after startDate. | > **Note: null means TikTok did not report it** > > TikTok's daily figures lag by 24 to 48 hours and exist only while Analytics is > turned on in the TikTok app. Unique views, follower gains and losses, engaged > audience, and `activity` are reported for Business Accounts only; the click > metrics need a verified or registered business; demographics and `activity` > need at least 100 followers. Anything TikTok withholds is `null` or an empty > list, never `0`. `activity` is when followers were active, by hour. `percentage` values are fractions of 1. **Errors** — `401 unauthorized`, `400 invalid_request`, `404 account_not_found`, `404 profile_not_found`, `422 connection_expired` (also returned when the connection lacks `user.insights`; reconnecting fixes it), `422 provider_not_configured`, `429 rate_limited`, `502 provider_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/analytics/tiktok/account-insights?accountId=00000000-0000-4000-8000-000000000003&startDate=2026-09-01&endDate=2026-09-28" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/analytics/tiktok/account-insights?accountId=00000000-0000-4000-8000-000000000003&startDate=2026-09-01&endDate=2026-09-28", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/analytics/tiktok/account-insights", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-4000-8000-000000000003", "startDate": "2026-09-01", "endDate": "2026-09-28", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "tiktok", "accountId": "00000000-0000-4000-8000-000000000003", "profileId": "00000000-0000-4000-8000-000000000001", "isBusinessAccount": true, "startDate": "2026-09-01", "endDate": "2026-09-28", "daily": [ { "date": "2026-09-01", "videoViews": 1126, "uniqueVideoViews": 900, "profileViews": 40, "likes": 26, "comments": 4, "shares": 1, "followers": 1204, "newFollowers": 6, "lostFollowers": 2, "engagedAudience": 120, "bioLinkClicks": 3, "emailClicks": 0, "phoneNumberClicks": 0, "addressClicks": 0, "appDownloadClicks": 0, "leadSubmissions": 0, "activity": [{ "hour": "18", "count": 52 }] } ], "audience": { "ages": [{ "key": "18-24", "percentage": 0.42 }], "genders": [{ "key": "Female", "percentage": 0.6 }], "countries": [{ "key": "US", "percentage": 0.75 }], "cities": [{ "key": "Austin", "percentage": 0.08 }] }, "fetchedAt": "2026-09-29T12:00:00.000Z" } ``` ### 400 ```json { "error": { "code": "invalid_request", "message": "endDate must be before today (UTC); TikTok reports complete days only", "details": [ { "code": "custom", "message": "endDate must be before today (UTC); TikTok reports complete days only", "path": ["endDate"] } ] } } ``` ### 422 ```json { "error": { "code": "connection_expired", "message": "TikTok connection requires reconnecting" } } ``` ## TikTok post insights URL: https://www.tryadeli.com/docs/api/analytics/tiktok-post-insights Markdown: https://www.tryadeli.com/docs/api/analytics/tiktok-post-insights.md Counters and watch metrics for TikTok posts. # TikTok post insights > Counters and watch metrics for TikTok posts. Canonical: `GET https://app.tryadeli.com/api/v1/analytics/tiktok/video-insights` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Returns counters and watch metrics for specific TikTok posts, or for the most recent page of posts when `videoIds` is omitted. Needs the `video.insights` permission. **Query parameters** | Name | Type | Required | Description | | ----------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------ | | `accountId` | `uuid` | Yes | A connected TikTok account. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `videoIds` | `string` | | Comma-separated TikTok post ids (providerId from GET /api/v1/posts, or postIds from a publish status), at most 20. | A post that has barely been watched may have no `reach` or watch metrics yet; those come back `null` or empty. `coverImageUrl` is a signed TikTok URL that expires, so fetch it again rather than storing it. TikTok stops updating a post's figures 365 days after it is published. **Errors** — `401 unauthorized`, `400 invalid_request`, `404 account_not_found`, `404 profile_not_found`, `422 connection_expired` (also returned when the connection lacks `video.insights`), `422 provider_not_configured`, `429 rate_limited`, `502 provider_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/analytics/tiktok/video-insights?accountId=00000000-0000-4000-8000-000000000003&videoIds=6990565363377392901" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/analytics/tiktok/video-insights?accountId=00000000-0000-4000-8000-000000000003&videoIds=6990565363377392901", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/analytics/tiktok/video-insights", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-4000-8000-000000000003", "videoIds": "6990565363377392901", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "tiktok", "accountId": "00000000-0000-4000-8000-000000000003", "profileId": "00000000-0000-4000-8000-000000000001", "videos": [ { "id": "6990565363377392901", "mediaType": "VIDEO", "isAd": false, "caption": "little coco", "coverImageUrl": "https://p16-sign-va.tiktokcdn.com/...", "shareUrl": "https://www.tiktok.com/@creator/video/6990565363377392901", "embedUrl": "https://www.tiktok.com/player/v1/6990565363377392901", "durationSeconds": 20, "likeCount": 10, "commentCount": 2, "shareCount": 0, "favoriteCount": 1, "viewCount": 1231, "reach": 154, "createdAt": "2021-07-30T04:03:55.000Z", "insights": { "totalTimeWatchedSeconds": 695.9, "averageTimeWatchedSeconds": 4.1, "fullVideoWatchedRate": 0.0237, "newFollowers": 2, "profileViews": 9, "retention": [{ "second": "1", "percentage": 0.82 }], "impressionSources": [{ "key": "For You", "percentage": 0.8983 }], "audienceGenders": [], "audienceCountries": [{ "key": "US", "percentage": 0.7574 }], "audienceCities": [], "audienceTypes": [] } } ], "fetchedAt": "2026-09-29T12:00:00.000Z" } ``` ### 422 ```json { "error": { "code": "connection_expired", "message": "TikTok connection requires reconnecting" } } ``` ## Facebook Page metrics URL: https://www.tryadeli.com/docs/api/analytics/facebook-page-metrics Markdown: https://www.tryadeli.com/docs/api/analytics/facebook-page-metrics.md A Page's audience, engagement on recent posts, and 28-day insights. # Facebook Page metrics > A Page's audience, engagement on recent posts, and 28-day insights. Canonical: `GET https://app.tryadeli.com/api/v1/analytics/facebook/page-metrics` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Returns the Page's own details and audience size, engagement totalled across its recent posts, and Page Insights for the last 28 days. **Query parameters** | Name | Type | Required | Description | | ----------- | ------ | -------- | ----------------------------------------------------------------------------------------------- | | `accountId` | `uuid` | | A connected Facebook Page. Defaults to the profile's Page. | | `profileId` | `uuid` | | Required unless you pass accountId, which names its profile. If you pass both, they must agree. | **insights** | Name | Type | Required | Description | | ------------- | ---------------- | -------- | ---------------------------------------------------------------------------------------------- | | `views` | `number \| null` | | Times the Page's content was on screen over the window (Meta's page\_media\_view), summed. | | `engagements` | `number \| null` | | Reactions, comments, shares, and clicks on the Page's posts (page\_post\_engagements), summed. | | `pageViews` | `number \| null` | | Visits to the Page itself (page\_views\_total), summed. | | `followers` | `number \| null` | | Followers on the latest day Meta reported (page\_follows). | | `daily` | `array` | | Daily views, oldest first, as { date, value }. | > **Note: When insights is null** > > Page Insights need the `read_insights` permission. A Facebook connection made > before Adeli requested it, or one where it was declined, returns > `"insights": null` with `"insightsUnavailable": "permission_missing"`; > reconnecting Facebook fixes it. `"analyze_task_missing"` means Meta refused > even with the permission, because the person who connected the Page cannot > view its insights. `"provider_error"` means Meta failed the request. The rest > of the response is returned either way. A figure Meta did not report is > `null`, not `0`; small or new Pages often have none yet. **Errors** — `401 unauthorized`, `400 invalid_request`, `404 account_not_found`, `409 page_not_selected`, `422 connection_expired`, `422 provider_not_configured`, `502 provider_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/analytics/facebook/page-metrics?accountId=00000000-0000-4000-8000-000000000003" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/analytics/facebook/page-metrics?accountId=00000000-0000-4000-8000-000000000003", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/analytics/facebook/page-metrics", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-4000-8000-000000000003", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "facebook", "accountId": "00000000-0000-4000-8000-000000000003", "profileId": "00000000-0000-4000-8000-000000000001", "page": { "id": "1234567890", "name": "Jasper’s Market", "username": "jaspers", "category": "Grocery Store", "link": "https://www.facebook.com/jaspers" }, "metrics": { "followers": 980, "fans": 960, "recentPosts": 10, "recentPostLikes": 42, "recentPostComments": 7, "recentPostShares": 3 }, "insights": { "periodDays": 28, "views": 4200, "engagements": 310, "pageViews": 75, "followers": 990, "daily": [{ "date": "2026-09-20T07:00:00+0000", "value": 150 }] }, "insightsUnavailable": null, "fetchedAt": "2026-09-21T12:00:00.000Z" } ``` ### 409 ```json { "error": { "code": "page_not_selected", "message": "Choose a Facebook Page first" } } ``` ### 404 ```json { "error": { "code": "account_not_found", "message": "Facebook account not found" } } ``` ## YouTube channel insights URL: https://www.tryadeli.com/docs/api/analytics/youtube-channel-insights Markdown: https://www.tryadeli.com/docs/api/analytics/youtube-channel-insights.md Daily metrics, top videos, and demographics for a YouTube channel. # YouTube channel insights > Daily metrics, top videos, and demographics for a YouTube channel. Canonical: `GET https://app.tryadeli.com/api/v1/analytics/youtube/channel-insights` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Returns the channel's stored details and, from YouTube Analytics, its daily metrics, top ten videos, and viewer demographics over a window. YouTube's figures lag by two to three days, so the default window is the 28 days ending three days ago. Needs the `yt-analytics.readonly` grant; a connection without it returns `422 connection_expired` with "Reconnect YouTube to enable analytics". **Query parameters** | Name | Type | Required | Description | | ----------- | ------------ | -------- | --------------------------------------------------------------------------------- | | `accountId` | `uuid` | Yes | A connected YouTube channel. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `startDate` | `YYYY-MM-DD` | | First day, UTC. Give both dates or neither. A window covers at most 365 days. | | `endDate` | `YYYY-MM-DD` | | Last day, UTC, before today and on or after startDate. | `channel.subscribers` is `null` when the channel hides its subscriber count. YouTube withholds demographics for channels with too few viewers, so `audience` can be empty. **Errors** — `401 unauthorized`, `400 invalid_request`, `404 account_not_found`, `404 profile_not_found`, `422 connection_expired`, `422 provider_not_configured`, `429 rate_limited`, `502 provider_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/analytics/youtube/channel-insights?accountId=00000000-0000-4000-8000-000000000003&startDate=2026-09-05&endDate=2026-10-02" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/analytics/youtube/channel-insights?accountId=00000000-0000-4000-8000-000000000003&startDate=2026-09-05&endDate=2026-10-02", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/analytics/youtube/channel-insights", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-4000-8000-000000000003", "startDate": "2026-09-05", "endDate": "2026-10-02", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "youtube", "accountId": "00000000-0000-4000-8000-000000000003", "profileId": "00000000-0000-4000-8000-000000000001", "channel": { "channelId": "UCxxxxxxxxxxxxxxxxxxxxxx", "title": "Bird Channel", "handle": "@birds", "avatarUrl": "https://yt3.ggpht.com/...", "subscribers": 1500, "views": 90000, "videos": 12 }, "insights": { "startDate": "2026-09-05", "endDate": "2026-10-02", "daily": [ { "date": "2026-10-02", "views": 600, "minutesWatched": 1100, "averageViewDurationSeconds": 70, "subscribersGained": 5, "subscribersLost": 1, "likes": 20, "comments": 2, "shares": 0 } ], "topVideos": [{ "videoId": "dQw4w9WgXcQ", "views": 400, "minutesWatched": 800, "averageViewDurationSeconds": 65, "likes": 15, "comments": 2 }], "audience": { "ageGender": [{ "ageGroup": "age25-34", "gender": "female", "percentage": 31.5 }], "countries": [{ "country": "US", "views": 750 }] } }, "fetchedAt": "2026-10-05T12:00:00.000Z" } ``` ### 422 ```json { "error": { "code": "connection_expired", "message": "Reconnect YouTube to enable analytics" } } ``` ## YouTube video insights URL: https://www.tryadeli.com/docs/api/analytics/youtube-video-insights Markdown: https://www.tryadeli.com/docs/api/analytics/youtube-video-insights.md Watch metrics for specific YouTube videos. # YouTube video insights > Watch metrics for specific YouTube videos. Canonical: `GET https://app.tryadeli.com/api/v1/analytics/youtube/video-insights` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Returns watch metrics for specific videos, or for the channel's 20 newest, over the same kind of window as [channel insights](https://www.tryadeli.com/docs/api/analytics/youtube-channel-insights). Needs `yt-analytics.readonly`, like channel insights. **Query parameters** | Name | Type | Required | Description | | ----------- | ------------ | -------- | ---------------------------------------------------------------------------------------------------------- | | `accountId` | `uuid` | Yes | A connected YouTube channel. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `videoIds` | `string` | | Comma-separated YouTube video ids (providerId from GET /api/v1/posts), at most 50. Omit for the 20 newest. | | `startDate` | `YYYY-MM-DD` | | Give both dates or neither; the default is the 28 days ending three days ago. | | `endDate` | `YYYY-MM-DD` | | | A video YouTube has no figures for in the window comes back with every metric `null`. **Errors** — `401 unauthorized`, `400 invalid_request`, `404 account_not_found`, `404 profile_not_found`, `422 connection_expired`, `422 provider_not_configured`, `429 rate_limited`, `502 provider_error`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/analytics/youtube/video-insights?accountId=00000000-0000-4000-8000-000000000003&videoIds=dQw4w9WgXcQ" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/analytics/youtube/video-insights?accountId=00000000-0000-4000-8000-000000000003&videoIds=dQw4w9WgXcQ", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/analytics/youtube/video-insights", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-4000-8000-000000000003", "videoIds": "dQw4w9WgXcQ", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "youtube", "accountId": "00000000-0000-4000-8000-000000000003", "profileId": "00000000-0000-4000-8000-000000000001", "insights": { "startDate": "2026-09-05", "endDate": "2026-10-02", "videos": [ { "videoId": "dQw4w9WgXcQ", "views": 400, "minutesWatched": 800, "averageViewDurationSeconds": 65, "averageViewPercentage": 54.2, "likes": 15, "comments": 2, "shares": 1, "subscribersGained": 3 } ] }, "fetchedAt": "2026-10-05T12:00:00.000Z" } ``` ### 404 ```json { "error": { "code": "account_not_found", "message": "YouTube account not found" } } ``` ## LinkedIn account insights URL: https://www.tryadeli.com/docs/api/analytics/linkedin-account-insights Markdown: https://www.tryadeli.com/docs/api/analytics/linkedin-account-insights.md Followers and daily impressions and engagement for a LinkedIn Page or personal profile. # LinkedIn account insights > Followers and daily impressions and engagement for a LinkedIn Page or personal profile. Canonical: `GET https://app.tryadeli.com/api/v1/analytics/linkedin/account-insights` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Returns followers and a daily series for a connected LinkedIn Page or personal profile, over the last 1 to 30 complete UTC days. LinkedIn limits how many API calls an app can make each day, so Adeli does not call LinkedIn on every request. It serves a snapshot that is refreshed at most every six hours. `fetchedAt` is when the snapshot was taken. When LinkedIn rate-limits a refresh, the previous snapshot is returned with `stale: true`. A Page needs `rw_organization_admin`. A personal profile needs `r_member_postAnalytics` and `r_member_profileAnalytics`; accounts connected before Adeli requested them get `403 permission_required` until they reconnect. **Query parameters** | Name | Type | Required | Description | | ----------- | --------- | -------- | --------------------------------------------------------------------------------- | | `accountId` | `uuid` | Yes | A connected LinkedIn account. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `days` | `integer` | | The most recent complete UTC days, 1 to 30. Defaults to 28. | Each day has `impressions`, `reactions`, `comments`, `shares`, and `followerGain`. Pages also report `clicks` and `pageViews`; for a personal profile those are always `null`. A metric LinkedIn did not return is `null`, never zero, and its name is listed in `unavailable`. **Errors** — `401 unauthorized`, `400 invalid_request`, `403 permission_required`, `404 account_not_found`, `404 profile_not_found`, `422 connection_expired`, `422 provider_not_available`, `422 provider_not_configured`, `429 rate_limited`, `502 provider_error`, `503 temporarily_unavailable`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/analytics/linkedin/account-insights?accountId=00000000-0000-4000-8000-000000000004&days=7" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/analytics/linkedin/account-insights?accountId=00000000-0000-4000-8000-000000000004&days=7", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/analytics/linkedin/account-insights", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-4000-8000-000000000004", "days": "7", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "linkedin", "accountId": "00000000-0000-4000-8000-000000000004", "profileId": "00000000-0000-4000-8000-000000000001", "targetType": "organization", "followers": 1840, "startDate": "2026-10-21", "endDate": "2026-10-27", "daily": [ { "date": "2026-10-21", "impressions": 512, "clicks": 14, "reactions": 22, "comments": 3, "shares": 1, "followerGain": 4, "pageViews": 37 } ], "unavailable": [], "fetchedAt": "2026-10-28T09:00:00.000Z", "stale": false } ``` ### 403 ```json { "error": { "code": "permission_required", "message": "linkedin requires r_member_postAnalytics for analytics.read. Restart OAuth to grant the permission." } } ``` ## LinkedIn post insights URL: https://www.tryadeli.com/docs/api/analytics/linkedin-post-insights Markdown: https://www.tryadeli.com/docs/api/analytics/linkedin-post-insights.md Lifetime counters for specific LinkedIn posts. # LinkedIn post insights > Lifetime counters for specific LinkedIn posts. Canonical: `GET https://app.tryadeli.com/api/v1/analytics/linkedin/post-insights` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Returns lifetime counters for up to five LinkedIn posts, or for the account's recent posts when `postUrns` is omitted. Use the `providerId` that [publishing](https://www.tryadeli.com/docs/api/posts/publish-linkedin) returned, such as `urn:li:share:7251234567890123456`. LinkedIn does not let Adeli list a personal profile's posts, so a personal profile's analytics cover only posts published through Adeli. Any other post returns `404 post_not_found`. A Page's recent posts include those made directly on LinkedIn. **Query parameters** | Name | Type | Required | Description | | ----------- | -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- | | `accountId` | `uuid` | Yes | A connected LinkedIn account. | | `profileId` | `uuid` | | Optional, because accountId names its profile. If you pass both, they must agree. | | `postUrns` | `string` | | Comma-separated post URNs (urn:li:share:… or urn:li:ugcPost:…), at most 5. Omit for the recent posts in the cached snapshot. | Each post has `impressions`, `reactions`, and `comments`. Pages also report `clicks` and `shares`; for a personal profile those are `null`. A counter LinkedIn did not return is `null`. **Errors** — `401 unauthorized`, `400 invalid_request`, `403 permission_required`, `404 account_not_found`, `404 post_not_found`, `404 profile_not_found`, `422 connection_expired`, `422 provider_not_available`, `422 provider_not_configured`, `429 rate_limited`, `502 provider_error`, `503 temporarily_unavailable`. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/analytics/linkedin/post-insights?accountId=00000000-0000-4000-8000-000000000004&postUrns=urn%3Ali%3Ashare%3A7251234567890123456" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/analytics/linkedin/post-insights?accountId=00000000-0000-4000-8000-000000000004&postUrns=urn%3Ali%3Ashare%3A7251234567890123456", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/analytics/linkedin/post-insights", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-4000-8000-000000000004", "postUrns": "urn:li:share:7251234567890123456", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "linkedin", "accountId": "00000000-0000-4000-8000-000000000004", "profileId": "00000000-0000-4000-8000-000000000001", "targetType": "member", "posts": [ { "postUrn": "urn:li:share:7251234567890123456", "permalink": "https://www.linkedin.com/feed/update/urn:li:share:7251234567890123456/", "title": "We just shipped LinkedIn analytics.", "publishedAt": "2026-10-20T15:04:00.000Z", "hasImage": false, "impressions": 930, "clicks": null, "reactions": 41, "comments": 6, "shares": null } ], "fetchedAt": "2026-10-28T09:00:00.000Z" } ``` ### 404 ```json { "error": { "code": "post_not_found", "message": "LinkedIn post not found: a personal profile's analytics cover only posts published through Adeli" } } ``` --- # Ads ## Ads URL: https://www.tryadeli.com/docs/api/ads Markdown: https://www.tryadeli.com/docs/api/ads.md Meta, TikTok and LinkedIn ad accounts, full campaign creation with targeting, edits after launch, insights with breakdowns, and lead form submissions. # Ads > Meta, TikTok and LinkedIn ad accounts, full campaign creation with targeting, edits after launch, insights with breakdowns, and lead form submissions. Canonical: > **Note:** > > Ads runs on a profile's **Meta Ads** account, which is connected separately from > its Facebook Page: [connect](https://www.tryadeli.com/docs/api/connect) with `platform: "meta_ads"`, then > pass that account's `accountId` (or the `profileId`) to these endpoints. A > Facebook Pages `accountId` is not accepted and returns `404 account_not_found`. The same endpoints serve **Meta Ads**, **TikTok Ads** and **LinkedIn Ads**. `accountId` names the ads connection, a `meta_ads`, `tiktok_ads` or `linkedin_ads` account, and through it the network. With only `profileId`, Adeli uses the profile's single ads connection; when a profile has more than one, pass `accountId` or `platform` (`meta_ads`, `tiktok_ads` or `linkedin_ads`), or the request fails with `400 ambiguous_account`. Responses carry the network in `platform`. Meta ad account ids look like `act_`; TikTok advertiser ids are digits only. TikTok calls ad sets _ad groups_; they are returned in the same `adSets` field. Some endpoints exist on some networks only and answer `400 unsupported_for_platform` on the others: businesses, ad account details and settings, lead forms, campaign updates, ad set and ad deletion, reach estimates and Instagram accounts are Meta only; ad identities are TikTok only. ## Meta Ads campaigns [Create campaign](https://www.tryadeli.com/docs/api/ads/create-campaign) builds a Meta campaign from an objective (traffic, engagement, awareness, video views, leads, conversions or app installs), a daily or lifetime budget, a schedule, a bid strategy, targeting found with [Targeting options](https://www.tryadeli.com/docs/api/ads/list-targeting) and sized with [Estimate reach](https://www.tryadeli.com/docs/api/ads/estimate-reach), and a new image, video or carousel ad, or it boosts a Page or Instagram post. `validateOnly: true` has Meta check it without creating anything. Everything is created **paused**; only [Update ad status](https://www.tryadeli.com/docs/api/ads/update-status) spends. After launch, [Update ad group](https://www.tryadeli.com/docs/api/ads/update-ad-group) changes an ad set's budget, bid, schedule and targeting, [Update campaign](https://www.tryadeli.com/docs/api/ads/update-campaign) a campaign's budget, bid strategy and spend cap, and single ad sets and ads can be deleted. [Insights](https://www.tryadeli.com/docs/api/ads/get-insights) break results down by age, gender, place and placement, with actions, values, ROAS and cost per result. ## LinkedIn Ads LinkedIn Ads is its own connection, separate from the LinkedIn account used for posting: connect it with `platform: "linkedin_ads"` on [Start a connection](https://www.tryadeli.com/docs/api/connect). It asks for `r_basicprofile`, `r_ads`, `rw_ads`, `r_ads_reporting`, and `r_organization_social`, and reaches every ad account the member has a role on. A member whose role on an account is Viewer can read it but not change it (`403 ad_account_read_only`). LinkedIn's levels map onto the same fields: `campaigns` are campaign groups, `adSets` are campaigns (which hold the budget and targeting), and `ads` are creatives. Pass `level` (`campaign`, `ad_group`, `ad`) when changing a status. [Create a campaign](https://www.tryadeli.com/docs/api/ads/create-campaign) sponsors an existing post by the ad account's own Page and creates every object as a **draft**: nothing spends until [Update ad status](https://www.tryadeli.com/docs/api/ads/update-status) activates the campaign group, which activates its campaign and ad with it. LinkedIn then reviews the ad. Audience breakdowns are professional demographics (job function, seniority, industry, company size, country), reported up to a day late. ## TikTok Ads TikTok Ads is its own connection, separate from the TikTok account used for posting: connect it with `platform: "tiktok_ads"` on [Start a connection](https://www.tryadeli.com/docs/api/connect). It authorizes an advertiser through the TikTok for Business Marketing API and reaches every ad account the authorizing user grants. TikTok Ads is in beta: it is not yet offered on the production API, where connect returns `422 provider_not_configured`. Campaigns are created with every object **disabled**: nothing spends until [Update ad status](https://www.tryadeli.com/docs/api/ads/update-status) activates the ad. TikTok reports ad metrics with a delay of a few hours. A Meta Ads account asks for `ads_management`, `business_management`, `pages_manage_ads`, `leads_retrieval`, `pages_show_list`, and `pages_read_engagement`. It uses `ads_management` for reads and management and does not request rejected `ads_read`. After authorizing, the person chooses the Page ads are created from; it can be the same Page as the profile's Facebook account or a different one, and ads are published as that Page. An ad can also run as an Instagram account connected to the ad account; Adeli finds those with the Ads permissions, and if Meta asks for `instagram_basic` to use one the response is `403 permission_required` naming it, since the Meta Ads connection does not request it today. Meta's Marketing API access tier and the user's ad-account role still apply in addition to these OAuth grants. A Meta Ads account is billed as its own connected account, separately from the profile's Facebook Page. > **Note:** > > Campaign and metric reads are live. Adeli stores no campaign structure and no > metrics, so every figure is as fresh as that response. The one exception is the > list of ad accounts, which is reused for up to 15 minutes. Meta or TikTok throttling returns `429 rate_limited` with a `Retry-After` header and structured limit details. A provider refusal returns `422 provider_rejected` with a safe explanation. ## Endpoints - `GET /api/v1/ads/accounts` — [List ad accounts](https://www.tryadeli.com/docs/api/ads/list-ad-accounts.md) - `POST /api/v1/ads/accounts` — [Create ad account](https://www.tryadeli.com/docs/api/ads/create-ad-account.md) - `GET /api/v1/ads/businesses` — [List businesses](https://www.tryadeli.com/docs/api/ads/list-businesses.md) - `GET /api/v1/ads/accounts/{adAccountId}` — [Get ad account](https://www.tryadeli.com/docs/api/ads/get-ad-account.md) - `PATCH /api/v1/ads/accounts/{adAccountId}` — [Update ad account](https://www.tryadeli.com/docs/api/ads/update-ad-account.md) - `GET /api/v1/ads/tree` — [Campaign tree](https://www.tryadeli.com/docs/api/ads/get-campaign-tree.md) - `GET /api/v1/ads/insights` — [Daily insights](https://www.tryadeli.com/docs/api/ads/get-insights.md) - `POST /api/v1/ads/campaigns` — [Create campaign](https://www.tryadeli.com/docs/api/ads/create-campaign.md) - `PATCH /api/v1/ads/campaigns/{campaignId}` — [Update campaign](https://www.tryadeli.com/docs/api/ads/update-campaign.md) - `DELETE /api/v1/ads/campaigns/{campaignId}` — [Delete campaign](https://www.tryadeli.com/docs/api/ads/delete-campaign.md) - `PUT /api/v1/ads/status` — [Update ad status](https://www.tryadeli.com/docs/api/ads/update-status.md) - `GET /api/v1/ads/leads` — [Lead forms and leads](https://www.tryadeli.com/docs/api/ads/list-leads.md) - `PATCH /api/v1/ads/ad-groups/{adGroupId}` — [Update ad group](https://www.tryadeli.com/docs/api/ads/update-ad-group.md) - `DELETE /api/v1/ads/ad-groups/{adGroupId}` — [Delete ad set](https://www.tryadeli.com/docs/api/ads/delete-ad-group.md) - `DELETE /api/v1/ads/ads/{adId}` — [Delete ad](https://www.tryadeli.com/docs/api/ads/delete-ad.md) - `GET /api/v1/ads/targeting` — [Targeting options](https://www.tryadeli.com/docs/api/ads/list-targeting.md) - `POST /api/v1/ads/reach-estimate` — [Estimate reach](https://www.tryadeli.com/docs/api/ads/estimate-reach.md) - `GET /api/v1/ads/instagram-accounts` — [Instagram accounts](https://www.tryadeli.com/docs/api/ads/list-instagram-accounts.md) - `GET /api/v1/ads/identities` — [List ad identities](https://www.tryadeli.com/docs/api/ads/list-identities.md) - `POST /api/v1/ads/identities` — [Create ad identity](https://www.tryadeli.com/docs/api/ads/create-identity.md) ## Ads and lead permissions Server operations remain capability-gated. Reads require `ads_management` and `business_management`; management also requires `pages_manage_ads`; lead retrieval requires `leads_retrieval`. A healthy credential without the required permission/resource returns `403 permission_required`; credential expiry remains a separate error. ## List ad accounts URL: https://www.tryadeli.com/docs/api/ads/list-ad-accounts Markdown: https://www.tryadeli.com/docs/api/ads/list-ad-accounts.md Every Meta ad account or TikTok advertiser the ads connection can reach. # List ad accounts > Every Meta ad account or TikTok advertiser the ads connection can reach. Canonical: `GET https://app.tryadeli.com/api/v1/ads/accounts` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Every ad account the connection can reach, both directly assigned and owned by a Business portfolio the authorizing person administers. `businessId` is `null` for a directly-assigned account. The list is reused for up to 15 minutes; `fetchedAt` is when the oldest part of it was read from Meta. Pass `refresh=true` after granting access to a new ad account to see it immediately. Other endpoints re-list on their own when given an ad account id the stored list does not contain. **Query parameters** | Name | Type | Required | Description | | ----------- | --------- | -------- | ----------------------------------------------------------------------------------------------- | | `accountId` | `uuid` | | The Meta Ads account. Defaults to the profile's. A Facebook account id is not accepted. | | `profileId` | `uuid` | | Required unless you pass accountId, which names its profile. If you pass both, they must agree. | | `refresh` | `boolean` | | true to ask Meta again instead of using the stored list. | ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/ads/accounts?accountId=00000000-0000-0000-0000-000000000000&refresh=true" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/accounts?accountId=00000000-0000-0000-0000-000000000000&refresh=true", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/ads/accounts", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", "refresh": True, }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "meta_ads", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000002", "adAccounts": [ { "id": "act_1234567890", "accountId": "1234567890", "name": "Client A — Ads", "currency": "USD", "timezoneName": "America/New_York", "accountStatus": 1, "minDailyBudget": 100, "businessId": "1122334455", "businessName": "Client A" }, { "id": "act_9876543210", "accountId": "9876543210", "name": "Personal ad account", "currency": "USD", "timezoneName": "America/Los_Angeles", "accountStatus": 1, "minDailyBudget": 100, "businessId": null, "businessName": null } ], "fetchedAt": "2026-10-09T16:00:00.000Z" } ``` ### 403 ```json { "error": { "code": "ads_permission_required", "message": "This Meta Ads connection has not granted the ads permissions", "details": { "missingScopes": ["ads_management", "business_management"] } } } ``` ## Create ad account URL: https://www.tryadeli.com/docs/api/ads/create-ad-account Markdown: https://www.tryadeli.com/docs/api/ads/create-ad-account.md Create an ad account in a Business portfolio. # Create ad account > Create an ad account in a Business portfolio. Canonical: `POST https://app.tryadeli.com/api/v1/ads/accounts` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Creates an ad account in a Business portfolio the authorizing person administers. Meta has no API for personal ad accounts. The currency and time zone cannot be changed afterwards, and a portfolio may only hold a limited number of ad accounts — commonly one until it has spend history — which Meta reports as `422 provider_rejected`. An `Idempotency-Key` header is required, since a retry would be a second ad account: the same key replays `200` with the same account, `409 ad_account_create_failed` if it failed, or `409 ad_account_create_in_progress`. A new account is `201`, and the account list is refreshed to include it. **Body** | Name | Type | Required | Description | | ------------ | -------- | -------- | ------------------------------------------------------------------------------------------- | | `businessId` | `string` | Yes | A portfolio from GET `/api/v1/ads/businesses`. | | `name` | `string` | Yes | Up to 100 characters. | | `timezone` | `string` | Yes | An IANA zone Adeli maps to Meta's time zone id, such as America/New\_York or Europe/London. | | `currency` | `string` | | ISO 4217. Defaults to USD. | ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/ads/accounts?accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: client-a-ad-account" \ -d '{ "businessId": "1122334455", "name": "Client A — Ads", "timezone": "America/New_York", "currency": "USD" }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/accounts?accountId=00000000-0000-0000-0000-000000000000", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", "Idempotency-Key": "client-a-ad-account", }, body: JSON.stringify({ businessId: "1122334455", name: "Client A — Ads", timezone: "America/New_York", currency: "USD", }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/ads/accounts", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}", "Idempotency-Key": "client-a-ad-account"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", }, json={ "businessId": "1122334455", "name": "Client A — Ads", "timezone": "America/New_York", "currency": "USD", }, ) print(response.json()) ``` ## Responses ### 201 ```json { "adAccount": { "id": "act_1234567890", "accountId": "1234567890", "name": "Client A — Ads", "currency": "USD", "timezoneName": "America/New_York", "accountStatus": 1, "minDailyBudget": 100, "businessId": "1122334455", "businessName": "Client A" }, "replayed": false } ``` ### 400 ```json { "error": { "code": "invalid_request", "message": "An Idempotency-Key header is required" } } ``` ### 409 ```json { "error": { "code": "ad_account_create_in_progress", "message": "This ad account is still being created", "details": { "replayed": true } } } ``` ## List businesses URL: https://www.tryadeli.com/docs/api/ads/list-businesses Markdown: https://www.tryadeli.com/docs/api/ads/list-businesses.md The Business portfolios an ad account can be created in. # List businesses > The Business portfolios an ad account can be created in. Canonical: `GET https://app.tryadeli.com/api/v1/ads/businesses` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) The portfolios the authorizing person administers — the ones an ad account can be created in. ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/ads/businesses?accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/businesses?accountId=00000000-0000-0000-0000-000000000000", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/ads/businesses", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "meta_ads", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000002", "businesses": [ { "id": "1122334455", "name": "Client A" } ] } ``` ### 403 ```json { "error": { "code": "ads_permission_required", "message": "This Meta Ads connection has not granted the ads permissions", "details": { "missingScopes": ["business_management"] } } } ``` ## Get ad account URL: https://www.tryadeli.com/docs/api/ads/get-ad-account Markdown: https://www.tryadeli.com/docs/api/ads/get-ad-account.md One ad account with its status, spend, and spending limit. # Get ad account > One ad account with its status, spend, and spending limit. Canonical: `GET https://app.tryadeli.com/api/v1/ads/accounts/{adAccountId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) The account as listed, plus `details`: `accountStatus`, `disableReason`, `amountSpent` and `spendCap` in whole currency units (`spendCap` is `null` when there is none), and `hasPaymentMethod` — `null` when Meta withholds it, which it does unless the person has the MANAGE task on the account. Always read live. **Path parameters** | Name | Type | Required | Description | | ------------- | -------- | -------- | ----------------------------------------------- | | `adAccountId` | `string` | Yes | An ad account id, in Meta's act\_ form. | ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/ads/accounts/act_1234567890?accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/accounts/act_1234567890?accountId=00000000-0000-0000-0000-000000000000", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/ads/accounts/act_1234567890", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "meta_ads", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000002", "adAccount": { "id": "act_1234567890", "accountId": "1234567890", "name": "Client A — Ads", "currency": "USD", "timezoneName": "America/New_York", "accountStatus": 1, "minDailyBudget": 100, "businessId": "1122334455", "businessName": "Client A" }, "details": { "id": "act_1234567890", "currency": "USD", "accountStatus": 1, "disableReason": 0, "spendCap": 500, "amountSpent": 182.4, "hasPaymentMethod": true } } ``` ### 404 ```json { "error": { "code": "account_not_found", "message": "Ad account is not available to this connection" } } ``` ## Update ad account URL: https://www.tryadeli.com/docs/api/ads/update-ad-account Markdown: https://www.tryadeli.com/docs/api/ads/update-ad-account.md Rename an ad account or set its spending limit. # Update ad account > Rename an ad account or set its spending limit. Canonical: `PATCH https://app.tryadeli.com/api/v1/ads/accounts/{adAccountId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Renames an account or sets its spending limit — Meta's hard stop, counted from the moment it is set: once the account has spent that much, all its ads stop delivering. Returns the same shape as the [details endpoint](https://www.tryadeli.com/docs/api/ads/get-ad-account). **Path parameters** | Name | Type | Required | Description | | ------------- | -------- | -------- | ----------------------------------------------- | | `adAccountId` | `string` | Yes | An ad account id, in Meta's act\_ form. | **Body** | Name | Type | Required | Description | | ---------- | ---------------- | -------- | --------------------------------------------- | | `name` | `string` | | Up to 100 characters. | | `spendCap` | `number \| null` | | Whole currency units; null removes the limit. | Payment methods and closing an account have no API; do those in Meta. ## Request examples **cURL** ```bash curl -X PATCH "https://app.tryadeli.com/api/v1/ads/accounts/act_1234567890?accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "spendCap": 500 }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/accounts/act_1234567890?accountId=00000000-0000-0000-0000-000000000000", { method: "PATCH", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ spendCap: 500, }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.patch( "https://app.tryadeli.com/api/v1/ads/accounts/act_1234567890", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", }, json={ "spendCap": 500, }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "meta_ads", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000002", "adAccount": { "id": "act_1234567890", "accountId": "1234567890", "name": "Client A — Ads", "currency": "USD", "timezoneName": "America/New_York", "accountStatus": 1, "minDailyBudget": 100, "businessId": "1122334455", "businessName": "Client A" }, "details": { "id": "act_1234567890", "currency": "USD", "accountStatus": 1, "disableReason": 0, "spendCap": 500, "amountSpent": 182.4, "hasPaymentMethod": true } } ``` ### 400 ```json { "error": { "code": "invalid_request", "message": "Invalid ad account update", "details": [ { "code": "custom", "path": [], "message": "Provide a name or a spendCap" } ] } } ``` ## Campaign tree URL: https://www.tryadeli.com/docs/api/ads/get-campaign-tree Markdown: https://www.tryadeli.com/docs/api/ads/get-campaign-tree.md Campaigns, ad sets (TikTok ad groups), and ads with performance at every level. # Campaign tree > Campaigns, ad sets (TikTok ad groups), and ads with performance at every level. Canonical: `GET https://app.tryadeli.com/api/v1/ads/tree` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) The Campaign → Ad set → Ad hierarchy for one ad account, with `spend`, `impressions`, `reach`, `clicks`, `ctr`, `cpc` and `cpm` rolled up at every level. An object that did not deliver in the range reports zeroes rather than being omitted. **Query parameters** | Name | Type | Required | Description | | ------------- | -------- | -------- | ----------------------------------------------------------------------------------------------- | | `adAccountId` | `string` | Yes | An ad account id, in Meta's act\_ form. | | `since` | `date` | | YYYY-MM-DD. Defaults to 28 days ago. | | `until` | `date` | | YYYY-MM-DD. Defaults to today. Ranges over 730 days are rejected. | | `accountId` | `uuid` | | The Meta Ads account. A Facebook account id is not accepted. | | `profileId` | `uuid` | | Required unless you pass accountId, which names its profile. If you pass both, they must agree. | ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/ads/tree?adAccountId=act_1234567890&since=2026-09-12&until=2026-10-09&accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/tree?adAccountId=act_1234567890&since=2026-09-12&until=2026-10-09&accountId=00000000-0000-0000-0000-000000000000", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/ads/tree", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "adAccountId": "act_1234567890", "since": "2026-09-12", "until": "2026-10-09", "accountId": "00000000-0000-0000-0000-000000000000", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "meta_ads", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000002", "adAccount": { "id": "act_1234567890", "accountId": "1234567890", "name": "Client A — Ads", "currency": "USD", "timezoneName": "America/New_York", "accountStatus": 1, "minDailyBudget": 100, "businessId": "1122334455", "businessName": "Client A" }, "campaigns": [ { "id": "120210000000000001", "name": "Fall launch", "status": "ACTIVE", "effectiveStatus": "ACTIVE", "metrics": { "spend": 182.4, "impressions": 41250, "reach": 30110, "clicks": 912, "ctr": 2.210909, "cpc": 0.2, "cpm": 4.421818, "conversions": 0 }, "objective": "OUTCOME_ENGAGEMENT", "adSets": [ { "id": "120210000000000002", "name": "Fall launch — ad set", "status": "ACTIVE", "effectiveStatus": "ACTIVE", "metrics": { "spend": 182.4, "impressions": 41250, "reach": 30110, "clicks": 912, "ctr": 2.210909, "cpc": 0.2, "cpm": 4.421818, "conversions": 0 }, "ads": [ { "id": "120210000000000004", "name": "Fall launch — ad", "status": "ACTIVE", "effectiveStatus": "ACTIVE", "metrics": { "spend": 182.4, "impressions": 41250, "reach": 30110, "clicks": 912, "ctr": 2.210909, "cpc": 0.2, "cpm": 4.421818, "conversions": 0 } } ] } ] } ], "range": { "since": "2026-09-12", "until": "2026-10-09" }, "fetchedAt": "2026-10-09T16:00:00.000Z" } ``` ### 400 ```json { "error": { "code": "invalid_request", "message": "since and until must be YYYY-MM-DD, with since on or before until" } } ``` ### 429 ```json { "error": { "code": "rate_limited", "message": "Facebook is rate limiting this ad account; try again in a minute", "details": { "retryAfterSeconds": 60, "limit": "ad_account" } } } ``` ## Daily insights URL: https://www.tryadeli.com/docs/api/ads/get-insights Markdown: https://www.tryadeli.com/docs/api/ads/get-insights.md Daily performance, or a breakdown by age, gender, place or placement, with results, ROAS and cost per result. # Daily insights > Daily performance, or a breakdown by age, gender, place or placement, with results, ROAS and cost per result. Canonical: `GET https://app.tryadeli.com/api/v1/ads/insights` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) One point per day for an ad account, or for a single campaign, ad set or ad when `objectId` is given. For Meta, every point also carries `reach`, `ctr`, `cpc` and `cpm`; every action Meta counted (`actions`), their value (`actionValues`, such as purchase revenue) and cost (`costPerAction`); `conversionValue`; `roas` (Meta's purchase ROAS when it reports one, otherwise `conversionValue / spend`); and `results` with `costPerResult`. A result is a conversion unless you name an action type with `resultActionType`, such as `link_click`. `attributionWindows` sets the windows those actions are counted in; the ad account's default otherwise. `breakdown` returns `rows` over the range instead, one per age band, gender, country, region, publisher platform, placement (labelled `platform:position`, such as `instagram:story`) or device platform, with the same figures. For TikTok, pass `level` with `objectId`, and pass `breakdown` to get an audience breakdown over the range instead of the daily series: the response then carries `rows`, one per `value` (an age band, gender, country code or platform), with `spend`, `impressions`, `clicks` and `reach`. For LinkedIn, `level` works the same way, and `breakdown` is a professional demographic: `job_function`, `seniority`, `industry`, `company_size` or `country_code`. Each row's `value` is a LinkedIn URN with its name in `label`. LinkedIn reports demographics up to a day late and leaves out small groups, so the response carries `delayed: true` and the rows need not add up to the totals. **Query parameters** | Name | Type | Required | Description | | -------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `adAccountId` | `string` | Yes | An ad account id. | | `objectId` | `string` | | A campaign, ad set or ad id. Defaults to the whole account. | | `level` | `string` | | TikTok and LinkedIn: campaign, ad\_group or ad, the level of objectId. Defaults to campaign. | | `breakdown` | `string` | | Meta: age, gender, country, region, publisher\_platform, platform\_position or device\_platform. TikTok: age, gender, country\_code or platform. LinkedIn: job\_function, seniority, industry, company\_size or country\_code. | | `attributionWindows` | `string` | | Meta: comma-separated, from 1d\_click, 7d\_click, 28d\_click, 1d\_view and 1d\_ev. | | `resultActionType` | `string` | | Meta: the action type that counts as a result, such as link\_click or offsite\_conversion.fb\_pixel\_purchase. Conversions when omitted. | | `since` | `date` | | YYYY-MM-DD. Defaults to 28 days ago. | | `until` | `date` | | YYYY-MM-DD. Defaults to today. | ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/ads/insights?adAccountId=act_1234567890&objectId=120210000000000001&since=2026-10-07&until=2026-10-07&attributionWindows=7d_click%2C1d_view&accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/insights?adAccountId=act_1234567890&objectId=120210000000000001&since=2026-10-07&until=2026-10-07&attributionWindows=7d_click%2C1d_view&accountId=00000000-0000-0000-0000-000000000000", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/ads/insights", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "adAccountId": "act_1234567890", "objectId": "120210000000000001", "since": "2026-10-07", "until": "2026-10-07", "attributionWindows": "7d_click,1d_view", "accountId": "00000000-0000-0000-0000-000000000000", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "meta_ads", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000002", "adAccountId": "act_1234567890", "objectId": "120210000000000001", "points": [ { "date": "2026-10-07", "spend": 24.81, "impressions": 5630, "clicks": 121, "conversions": 3, "reach": 4210, "ctr": 2.15, "cpc": 0.21, "cpm": 4.41, "actions": [{ "type": "link_click", "value": 121 }, { "type": "offsite_conversion.fb_pixel_purchase", "value": 3 }], "actionValues": [{ "type": "offsite_conversion.fb_pixel_purchase", "value": 96 }], "costPerAction": [{ "type": "link_click", "value": 0.21 }], "conversionValue": 96, "roas": 3.87, "results": 3, "costPerResult": 8.27 } ], "attributionWindows": ["7d_click", "1d_view"], "range": { "since": "2026-10-07", "until": "2026-10-07" }, "fetchedAt": "2026-10-09T16:00:00.000Z" } ``` ### 400 ```json { "error": { "code": "invalid_request", "message": "adAccountId is required" } } ``` ## Create campaign URL: https://www.tryadeli.com/docs/api/ads/create-campaign Markdown: https://www.tryadeli.com/docs/api/ads/create-campaign.md A paused Meta campaign with any objective, targeting and a new or boosted creative, or a paused TikTok or LinkedIn campaign. # Create campaign > A paused Meta campaign with any objective, targeting and a new or boosted creative, or a paused TikTok or LinkedIn campaign. Canonical: `POST https://app.tryadeli.com/api/v1/ads/campaigns` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) On Meta, a body with `objective` builds a full campaign: any of seven objectives, a daily or lifetime budget, a schedule, a bid strategy, targeting, and a new image, video or carousel ad, or a boosted Page or Instagram post (see [Meta full campaign body](https://www.tryadeli.com/docs/api/ads/create-campaign#meta-full-campaign-body)). A body without `objective` promotes a post the Meta Ads account's Page already published, creating a campaign, ad set, creative and ad. That is the Page chosen when Meta Ads was connected, which may differ from the profile's Facebook account's Page; pass a post from that Page. On TikTok, creates a campaign, ad group and video ad (see [TikTok body](https://www.tryadeli.com/docs/api/ads/create-campaign#tiktok-body) below). On LinkedIn, sponsors a Page post as a draft campaign group, campaign and creative (see [LinkedIn body](https://www.tryadeli.com/docs/api/ads/create-campaign#linkedin-body)). **Everything is created paused.** Nothing delivers and nothing spends until you activate it, which is [a separate call](https://www.tryadeli.com/docs/api/ads/update-status). An `Idempotency-Key` header is required. This is the only endpoint in the API where a retry has a cost, so the same key replays the original result rather than creating a second campaign: `200` with the same object ids when the campaign was built, `409 campaign_create_failed` with the original reason when it failed, and `409 campaign_create_in_progress` while it is still being created. To retry a failed create, send a new key. **Body** | Name | Type | Required | Description | | -------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `adAccountId` | `string` | Yes | The ad account to create in. | | `pagePostId` | `string` | Yes | The post id alone; the Page half of Meta's story id is server-derived. | | `dailyBudget` | `number` | Yes | Whole units of the ad account's currency: 25 means 25.00. Meta's API takes budgets in the currency's minor units (2500 cents for USD), and Adeli converts before sending. | | `startDate` | `date` | Yes | YYYY-MM-DD. | | `endDate` | `date` | Yes | YYYY-MM-DD, on or after startDate. | | `campaignName` | `string` | Yes | Shown in Ads Manager. | Responds `201` with the created object ids, Adeli's `campaign` record (its `id` is the `campaignRecordId` used by [Activate, pause or resume](https://www.tryadeli.com/docs/api/ads/update-status); `metaAdsConnectionId` names the Meta Ads account, and `facebookConnectionId` is set only on campaigns created before Meta Ads was a separate account), and a `preview` when Meta returns one: Meta's `body` markup, plus the `url`, `width` and `height` of the facebook.com preview page it wraps. Embed `url` in an iframe that allows scripts; the page renders blank without them. If a step fails, Adeli deletes what it already created and responds `502 campaign_create_failed` with the failing `step` and any `orphanedObjectIds` it could not remove — those are paused, so they cost nothing, but they are named so you can find them in Ads Manager. ## Meta full campaign body For a `meta_ads` account, a body with `objective` creates a campaign, an ad set and an ad, all **paused**, published as the Meta Ads account's Page. Name an existing `campaignId` to add a new ad set and ad to it, or an `adSetId` to add only an ad; Adeli checks either belongs to `adAccountId` and has the same objective, and never deletes it if a later step fails. **Body (Meta full campaign)** | Name | Type | Required | Description | | --------------------- | ---------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `adAccountId` | `string` | Yes | The ad account to create in. | | `objective` | `string` | Yes | traffic, engagement, awareness, video\_views, lead\_generation, conversions or app\_promotion. Each maps to Meta's outcome objective and optimization goal; video\_views is an engagement campaign optimized for ThruPlay. | | `campaignName` | `string` | Yes | Shown in Ads Manager; the ad set and creative are named after it. | | `adName` | `string` | | Defaults to the campaign name. | | `campaignId` | `string` | | Add to this existing campaign instead of creating one. | | `adSetId` | `string` | | Add only the ad, to this existing ad set. Leave out budget, targeting, bid and dates. | | `budget` | `object` | | { type: daily \| lifetime, amount } in whole currency units, converted with the currency's own offset (so 3000 is 3,000 yen). Required unless the ad set's campaign holds the budget. A daily budget is at most 10,000; a lifetime budget needs endDate. | | `budgetLevel` | `string` | | ad\_set (default), or campaign for Advantage campaign budget (CBO). | | `startDate` | `date` | | YYYY-MM-DD, tomorrow (UTC) or later. Required unless adSetId. | | `endDate` | `date` | | YYYY-MM-DD. The ad set runs through the end of that day (UTC). Optional for a daily budget. | | `bid` | `object` | | { strategy: lowest\_cost \| bid\_cap \| cost\_cap \| min\_roas, amount, roasFloor }. bid\_cap and cost\_cap need amount (whole currency units); min\_roas needs roasFloor (2 means 200%) and works only with conversions and app\_promotion. Lowest cost when omitted. | | `targeting` | `object` | | Required unless adSetId; see the table below. | | `creative` | `object` | Yes | One of the creative shapes below, by type. | | `instagramAccountId` | `string` | | Show the ad as this Instagram account, from [Instagram accounts](https://www.tryadeli.com/docs/api/ads/list-instagram-accounts). Required to boost an Instagram post. | | `pixelId` | `string` | | conversions: the Meta pixel. | | `conversionEvent` | `string` | | conversions: PURCHASE, LEAD, COMPLETE\_REGISTRATION, ADD\_TO\_CART, INITIATED\_CHECKOUT, ... | | `leadFormId` | `string` | | lead\_generation: a form from [Lead forms](https://www.tryadeli.com/docs/api/ads/list-leads). | | `applicationId` | `string` | | app\_promotion: the app's Meta app id. | | `appStoreUrl` | `string` | | app\_promotion: the App Store or Google Play URL. | | `specialAdCategories` | `string[]` | | HOUSING, EMPLOYMENT, CREDIT or FINANCIAL\_PRODUCTS\_SERVICES, with specialAdCategoryCountries. Political ads are not supported. | | `validateOnly` | `boolean` | | true asks Meta to check the campaign and create nothing; see Dry run. | **targeting** | Name | Type | Required | Description | | ------------------------------------------ | ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `locations` | `object` | Yes | { countries, regions, cities, zips }. Countries are ISO codes; the others are { key } objects from [Targeting options](https://www.tryadeli.com/docs/api/ads/list-targeting) (type locations), and a city may add radius and distanceUnit (mile or kilometer). At least one. | | `excludedLocations` | `object` | | The same shape, excluded. | | `ageMin, ageMax` | `number` | | 13 to 65. | | `gender` | `string` | | all (default), male or female. | | `interests, behaviors` | `object[]` | | { id, name } from Targeting options. | | `demographics` | `object[]` | | { id, type } from Targeting options (type demographics); type is the option's own, such as life\_events. | | `languages` | `number[]` | | Locale ids from Targeting options (type languages). | | `customAudiences, excludedCustomAudiences` | `string[]` | | Custom or lookalike audience ids in the ad account. | | `placements` | `string \| object` | | automatic (default), or { publisherPlatforms, facebookPositions, instagramPositions, audienceNetworkPositions, messengerPositions, devicePlatforms }. | | `advantageAudience` | `boolean` | | Let Meta reach beyond this audience. false unless you ask for it. | **creative** | Name | Type | Required | Description | | -------------------------------------------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `{ type: page_post, pagePostId }` | `object` | | Boost a post by the Meta Ads account's Page. | | `{ type: instagram_post, instagramMediaId }` | `object` | | Boost an Instagram post; needs instagramAccountId. | | `{ type: image, image, ... }` | `object` | | image is { uploadId } (media uploads, platform facebook) or { url } over HTTPS. With headline, body, description, callToAction and linkUrl. An image with no link runs as a photo post. | | `{ type: video, video, thumbnail, ... }` | `object` | | video is { uploadId }, { url } or { videoId } of a video already in the ad account. Adeli uploads it and waits up to 90 seconds for Meta to process it; if Meta is still processing, the response is 409 video\_processing with the videoId to retry with. The thumbnail defaults to Meta's own. | | `{ type: carousel, body, linkUrl, callToAction, cards }` | `object` | | 2 to 10 cards, each { image, headline, description, linkUrl, callToAction }. | callToAction is one of LEARN\_MORE, SHOP\_NOW, SIGN\_UP, BOOK\_NOW, CONTACT\_US, DOWNLOAD, GET\_OFFER, GET\_QUOTE, SUBSCRIBE, WATCH\_MORE, APPLY\_NOW, ORDER\_NOW, BUY\_NOW, INSTALL\_MOBILE\_APP, USE\_APP, DONATE\_NOW, GET\_DIRECTIONS, SEE\_MENU, PLAY\_GAME, LISTEN\_NOW or NO\_BUTTON, and needs a linkUrl except on lead and app ads, whose button opens the form or the store. traffic and conversions need a linkUrl on new creatives. The `201` response adds `platform`, `accountId`, `profileId`, `videoId` (the uploaded video, or null) and `reused` (whether the campaign and ad set already existed) to the boost's response. The `campaign` record's `source` says what the ad was built from and `objective` which objective it has. ### Dry run With `validateOnly: true` Meta checks the request with its `validate_only` option and nothing is created or recorded, so the call can be repeated. The response is `200` with each step's result. Meta checks an ad set only inside a campaign that exists, and an ad only with a real ad set and creative, so those steps report `skipped` with the reason; a video given by URL is not uploaded in a dry run, so its creative is skipped too. ```json { "platform": "meta_ads", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000002", "validateOnly": true, "steps": [ { "step": "campaign", "result": "valid" }, { "step": "ad set", "result": "skipped", "reason": "Meta validates an ad set only inside an existing campaign" }, { "step": "creative", "result": "valid" }, { "step": "ad", "result": "skipped", "reason": "Meta validates an ad only with a real ad set and creative" } ] } ``` ### Instagram `instagramAccountId` must be one of the ad account's connected Instagram accounts, read with the Meta Ads connection's own Ads permissions. If Meta refuses the Instagram account or post for want of a permission, the response is `403 permission_required` naming `instagram_basic`, which the Meta Ads connection does not request today. ## TikTok body For a `tiktok_ads` account the body describes a video ad. Adeli uploads the video and cover, creates the identity when you pass one inline, then creates the campaign (no campaign budget), the ad group (the daily budget, schedule and targeting) and the ad, all **disabled**. `startDate` must be after today in the ad account's timezone, which is how TikTok reads the schedule. **Body (TikTok)** | Name | Type | Required | Description | | ------------------------------- | ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------- | | `adAccountId` | `string` | Yes | A TikTok advertiser id. | | `campaignName` | `string` | Yes | Used for the campaign, ad group and ad. | | `goal` | `string` | Yes | traffic, reach or video\_views. | | `dailyBudget` | `number` | Yes | Whole currency units per day on the ad group. At least 20 USD. | | `startDate` | `date` | Yes | YYYY-MM-DD, after today in the ad account's timezone. | | `endDate` | `date` | Yes | YYYY-MM-DD, on or after startDate. | | `targeting.locationIds` | `string[]` | Yes | Location ids from [Targeting options](https://www.tryadeli.com/docs/api/ads/list-targeting). | | `targeting.ageGroups` | `string[]` | | AGE\_18\_24, AGE\_25\_34, ... Omit for all ages. | | `targeting.gender` | `string` | | GENDER\_MALE, GENDER\_FEMALE or GENDER\_UNLIMITED. | | `targeting.languages` | `string[]` | | Language codes from Targeting options. | | `targeting.interestCategoryIds` | `string[]` | | Interest ids from Targeting options. | | `creative.video` | `object` | Yes | { uploadId } from media uploads (platform tiktok), or { url } over HTTPS. 9:16, 5 to 60 seconds. | | `creative.coverImage` | `object` | | { uploadId } or { url }. Defaults to TikTok's own frame from the video. | | `creative.adText` | `string` | Yes | The caption, up to 100 characters. | | `creative.callToAction` | `string` | | LEARN\_MORE, SHOP\_NOW, SIGN\_UP, ... | | `creative.landingPageUrl` | `string` | | Required for traffic. | | `identity` | `object` | Yes | { identityId } from [ad identities](https://www.tryadeli.com/docs/api/ads/list-identities), or { displayName, avatar } to create one. | The `201` response carries `objects` (`campaignId`, `adGroupId`, `adId`) and the `campaign` record; its `id` is the `campaignRecordId` that lets [Update ad status](https://www.tryadeli.com/docs/api/ads/update-status) activate the whole campaign from its ad. ## LinkedIn body For a `linkedin_ads` account the body sponsors an existing post by the ad account's own LinkedIn Page. Adeli checks the post's author and format, then creates a campaign group, a campaign (the daily budget, bid, schedule and targeting) and a creative that references the post, all as **drafts**. A draft does not deliver and LinkedIn does not review it until it is activated. The schedule is in UTC, and `startDate` must be tomorrow (UTC) or later. **Body (LinkedIn)** | Name | Type | Required | Description | | --------------------------- | ---------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------- | | `adAccountId` | `string` | Yes | A LinkedIn ad account id (digits). Your role on it must be above Viewer. | | `campaignName` | `string` | Yes | Used for the campaign group, campaign and ad. | | `goal` | `string` | Yes | website\_visits, engagement, brand\_awareness or video\_views (video posts only). | | `postUrn` | `string` | Yes | urn:li:share: or urn:li:ugcPost:, by the ad account's Page. Text, image, article and video posts are supported. | | `dailyBudget` | `number` | Yes | Whole currency units per day on the campaign. At least 10 USD. | | `bid` | `number` | | Per click, thousand impressions or view, by goal. Defaults to LinkedIn's suggested bid; 400 bid\_required when LinkedIn suggests none. | | `startDate` | `date` | Yes | YYYY-MM-DD, tomorrow (UTC) or later. | | `endDate` | `date` | Yes | YYYY-MM-DD, on or after startDate. | | `targeting.locations` | `string[]` | Yes | Geo URNs from [Targeting options](https://www.tryadeli.com/docs/api/ads/list-targeting) (type locations). | | `targeting.jobFunctions` | `string[]` | | urn:li:function: URNs. | | `targeting.seniorities` | `string[]` | | urn:li:seniority: URNs. | | `targeting.industries` | `string[]` | | urn:li:industry: URNs. | | `targeting.companySizes` | `string[]` | | urn:li:staffCountRange:(,) URNs. | | `targeting.interfaceLocale` | `string` | | The audience's LinkedIn language, such as en\_US (the default). | | `politicalIntent` | `string` | Yes | NOT\_POLITICAL. LinkedIn requires the declaration on every campaign; Adeli does not run political ads. | The `201` response carries `objects`, where `campaignId` is the campaign group, `adGroupId` the LinkedIn campaign and `adId` the creative, and the `campaign` record. Activating the campaign group through [Update ad status](https://www.tryadeli.com/docs/api/ads/update-status) activates its campaign and ad with it. A post from another Page answers `400 post_not_in_account_organization` and an unsupported post `400 unsupported_post_format`, before anything is created. ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/ads/campaigns?accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: fall-launch-boost" \ -d '{ "adAccountId": "act_1234567890", "pagePostId": "987654321098765", "dailyBudget": 25, "startDate": "2026-11-01", "endDate": "2026-11-07", "campaignName": "Fall launch" }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/campaigns?accountId=00000000-0000-0000-0000-000000000000", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", "Idempotency-Key": "fall-launch-boost", }, body: JSON.stringify({ adAccountId: "act_1234567890", pagePostId: "987654321098765", dailyBudget: 25, startDate: "2026-11-01", endDate: "2026-11-07", campaignName: "Fall launch", }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/ads/campaigns", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}", "Idempotency-Key": "fall-launch-boost"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", }, json={ "adAccountId": "act_1234567890", "pagePostId": "987654321098765", "dailyBudget": 25, "startDate": "2026-11-01", "endDate": "2026-11-07", "campaignName": "Fall launch", }, ) print(response.json()) ``` ## Responses ### 201 ```json { "campaign": { "id": "00000000-0000-4000-8000-000000000020", "profileId": "00000000-0000-4000-8000-000000000002", "facebookConnectionId": null, "metaAdsConnectionId": "00000000-0000-4000-8000-000000000001", "adAccountId": "act_1234567890", "pageId": "123456789012345", "pagePostId": "987654321098765", "source": "page_post", "objective": null, "idempotencyKey": "fall-launch-boost", "campaignId": "120210000000000001", "adSetId": "120210000000000002", "creativeId": "120210000000000003", "adId": "120210000000000004", "status": "paused", "failureReason": null, "createdAt": "2026-10-09T16:00:00.000Z", "updatedAt": "2026-10-09T16:00:04.000Z" }, "objects": { "campaignId": "120210000000000001", "adSetId": "120210000000000002", "creativeId": "120210000000000003", "adId": "120210000000000004" }, "preview": { "format": "MOBILE_FEED_STANDARD", "body": "", "url": "https://www.facebook.com/ads/api/preview_iframe.php?d=AQ...&t=AQ...", "width": 320, "height": 570 }, "replayed": false } ``` ### 400 ```json { "error": { "code": "invalid_request", "message": "Invalid campaign request", "details": [ { "code": "custom", "path": ["startDate"], "message": "startDate must be tomorrow (UTC) or later" } ] } } ``` ### 409 ```json { "error": { "code": "campaign_create_in_progress", "message": "This campaign is still being created", "details": { "campaignRecordId": "00000000-0000-4000-8000-000000000020", "replayed": true } } } ``` ## Update campaign URL: https://www.tryadeli.com/docs/api/ads/update-campaign Markdown: https://www.tryadeli.com/docs/api/ads/update-campaign.md Change a Meta campaign's name, budget, bid strategy or spend cap. # Update campaign > Change a Meta campaign's name, budget, bid strategy or spend cap. Canonical: `PATCH https://app.tryadeli.com/api/v1/ads/campaigns/{campaignId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) **Meta Ads.** Renames a campaign, or changes its Advantage campaign budget (CBO), bid strategy or spend cap. Only the fields you send change. The campaign must belong to `adAccountId`, or the response is `404 object_not_found`. A campaign that budgets each ad set has no budget or bid strategy of its own: sending either returns `400 invalid_request`, and they change on the ad set with [Update ad group](https://www.tryadeli.com/docs/api/ads/update-ad-group). A budget keeps the type the campaign has, because Meta does not switch daily and lifetime budgets. **Body** | Name | Type | Required | Description | | ------------- | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------ | | `adAccountId` | `string` | Yes | The ad account the campaign belongs to. | | `name` | `string` | | Shown in Ads Manager. | | `budget` | `object` | | { type: daily \| lifetime, amount } in whole currency units. CBO campaigns only. | | `bidStrategy` | `string` | | lowest\_cost, bid\_cap, cost\_cap or min\_roas. CBO campaigns only; amounts and ROAS floors stay on each ad set. | | `spendCap` | `number \| null` | | Whole currency units: the most the campaign may ever spend. null removes the cap. Meta's minimum is about 100 USD. | Raising a budget on a running campaign spends more as soon as Meta applies it. ## Request examples **cURL** ```bash curl -X PATCH "https://app.tryadeli.com/api/v1/ads/campaigns/120210000000000001?accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "adAccountId": "act_1234567890", "budget": { "type": "daily", "amount": 40 } }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/campaigns/120210000000000001?accountId=00000000-0000-0000-0000-000000000000", { method: "PATCH", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ adAccountId: "act_1234567890", budget: { type: "daily", amount: 40, }, }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.patch( "https://app.tryadeli.com/api/v1/ads/campaigns/120210000000000001", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", }, json={ "adAccountId": "act_1234567890", "budget": { "type": "daily", "amount": 40, }, }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "meta_ads", "accountId": "00000000-0000-0000-0000-000000000000", "adAccountId": "act_1234567890", "campaign": { "campaignId": "120210000000000001", "updated": ["budget"] } } ``` ### 400 ```json { "error": { "code": "invalid_request", "message": "This campaign budgets each ad set; change the budget or bid on the ad set" } } ``` ## Delete campaign URL: https://www.tryadeli.com/docs/api/ads/delete-campaign Markdown: https://www.tryadeli.com/docs/api/ads/delete-campaign.md Delete a campaign with its ad sets and ads. # Delete campaign > Delete a campaign with its ad sets and ads. Canonical: `DELETE https://app.tryadeli.com/api/v1/ads/campaigns/{campaignId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Deletes a campaign together with its ad sets and ads, which stops any delivery immediately. It cannot be undone. The campaign must belong to `adAccountId`; otherwise the response is `404 campaign_not_found` and nothing is deleted. Responds `204`. Adeli's record of a campaign it created is marked `deleted`. **Path parameters** | Name | Type | Required | Description | | ------------ | -------- | -------- | ------------------- | | `campaignId` | `string` | Yes | A Meta campaign id. | **Query parameters** | Name | Type | Required | Description | | ------------- | -------- | -------- | --------------------------------------------------------------------------------------- | | `adAccountId` | `string` | Yes | The ad account the campaign belongs to. | | `accountId` | `uuid` | | The Meta Ads account. Defaults to the profile's. A Facebook account id is not accepted. | ## Request examples **cURL** ```bash curl -X DELETE "https://app.tryadeli.com/api/v1/ads/campaigns/120210000000000001?adAccountId=act_1234567890&accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/campaigns/120210000000000001?adAccountId=act_1234567890&accountId=00000000-0000-0000-0000-000000000000", { method: "DELETE", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(response.status); // 204: no body ``` **Python** ```python import os import requests response = requests.delete( "https://app.tryadeli.com/api/v1/ads/campaigns/120210000000000001", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "adAccountId": "act_1234567890", "accountId": "00000000-0000-0000-0000-000000000000", }, ) print(response.status_code) # 204: no body ``` ## Responses ### 204 No Content ```text (empty body) ``` ### 404 ```json { "error": { "code": "campaign_not_found", "message": "That campaign does not belong to this ad account" } } ``` ## Update ad status URL: https://www.tryadeli.com/docs/api/ads/update-status Markdown: https://www.tryadeli.com/docs/api/ads/update-status.md Activate, pause, or resume a campaign, ad set (ad group), or ad. # Update ad status > Activate, pause, or resume a campaign, ad set (ad group), or ad. Canonical: `PUT https://app.tryadeli.com/api/v1/ads/status` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Sets a campaign's, ad set's (TikTok ad group's) or ad's delivery status. Activating an ad is what starts spending. For TikTok, `level` is required, because TikTok has a separate endpoint per level. Activating the `ad` of a campaign Adeli created, with its `campaignRecordId`, also enables that campaign and ad group: TikTok delivers nothing while a parent is disabled. For LinkedIn, `level` is required too: `campaign` is a campaign group, `ad_group` a campaign, and `ad` a creative. Activating a draft campaign group Adeli created, named by its id or `campaignRecordId`, activates its creative, then its campaign, then the group, which is the switch that starts delivery. LinkedIn then reviews the ad. A member whose role on the ad account is Viewer gets `403 ad_account_read_only`. **Body** | Name | Type | Required | Description | | ------------------ | -------- | -------- | --------------------------------------------------------------------------------------------- | | `adAccountId` | `string` | Yes | The ad account the object belongs to. | | `objectId` | `string` | Yes | A campaign, ad set (ad group) or ad id. | | `level` | `string` | | campaign, ad\_group or ad. Required for TikTok and LinkedIn; ignored for Meta. | | `status` | `string` | Yes | ACTIVE or PAUSED. | | `campaignRecordId` | `uuid` | | Keeps Adeli's campaign record in step when the object came from POST `/api/v1/ads/campaigns`. | ## Request examples **cURL** ```bash curl -X PUT "https://app.tryadeli.com/api/v1/ads/status?accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "adAccountId": "act_1234567890", "objectId": "120210000000000004", "status": "PAUSED", "campaignRecordId": "00000000-0000-4000-8000-000000000020" }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/status?accountId=00000000-0000-0000-0000-000000000000", { method: "PUT", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ adAccountId: "act_1234567890", objectId: "120210000000000004", status: "PAUSED", campaignRecordId: "00000000-0000-4000-8000-000000000020", }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.put( "https://app.tryadeli.com/api/v1/ads/status", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", }, json={ "adAccountId": "act_1234567890", "objectId": "120210000000000004", "status": "PAUSED", "campaignRecordId": "00000000-0000-4000-8000-000000000020", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "meta_ads", "accountId": "00000000-0000-0000-0000-000000000000", "objectId": "120210000000000004", "status": "PAUSED" } ``` ### 404 ```json { "error": { "code": "account_not_found", "message": "Ad account is not available to this connection" } } ``` ## Lead forms and leads URL: https://www.tryadeli.com/docs/api/ads/list-leads Markdown: https://www.tryadeli.com/docs/api/ads/list-leads.md A Page's lead forms, or one form's submissions. # Lead forms and leads > A Page's lead forms, or one form's submissions. Canonical: `GET https://app.tryadeli.com/api/v1/ads/leads` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Without `formId`, the lead generation forms belonging to the connected Page. With it, that form's submissions, including the field data and the campaign, ad set and ad each lead came from. > **Note:** > > Adeli does not store lead data. Submissions are read from Facebook when you ask > for them and are not retained after the response. **Query parameters** | Name | Type | Required | Description | | ----------- | -------- | -------- | ----------------------------------------------------------------------------------------------- | | `formId` | `string` | | A lead form id. Omit to list the Page's forms. | | `accountId` | `uuid` | | The Meta Ads account. A Facebook account id is not accepted. | | `profileId` | `uuid` | | Required unless you pass accountId, which names its profile. If you pass both, they must agree. | ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/ads/leads?formId=555666777888999&accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/leads?formId=555666777888999&accountId=00000000-0000-0000-0000-000000000000", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/ads/leads", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "formId": "555666777888999", "accountId": "00000000-0000-0000-0000-000000000000", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "meta_ads", "accountId": "00000000-0000-0000-0000-000000000000", "profileId": "00000000-0000-4000-8000-000000000002", "leads": [ { "id": "1029384756473829", "createdAt": "2026-10-08T18:22:41+0000", "fields": [ { "name": "full_name", "values": ["Jordan Lee"] }, { "name": "email", "values": ["jordan@example.com"] } ], "campaignName": "Fall launch", "adSetName": "Fall launch — ad set", "adName": "Fall launch — ad" } ], "fetchedAt": "2026-10-09T16:00:00.000Z" } ``` ### 403 ```json { "error": { "code": "ads_permission_required", "message": "This Meta Ads connection has not granted the ads permissions", "details": { "missingScopes": ["leads_retrieval"] } } } ``` ## Update ad group URL: https://www.tryadeli.com/docs/api/ads/update-ad-group Markdown: https://www.tryadeli.com/docs/api/ads/update-ad-group.md Change a Meta ad set's budget, bid, dates or targeting, or a TikTok ad group's or LinkedIn campaign's budget, end date or name. # Update ad group > Change a Meta ad set's budget, bid, dates or targeting, or a TikTok ad group's or LinkedIn campaign's budget, end date or name. Canonical: `PATCH https://app.tryadeli.com/api/v1/ads/ad-groups/{adGroupId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) Changes a Meta ad set's name, budget, bid, schedule or targeting, or a TikTok ad group's or LinkedIn campaign's daily budget, end date or name. The `adGroupId` is an entry in a campaign's `adSets` from the [campaign tree](https://www.tryadeli.com/docs/api/ads/get-campaign-tree); TikTok calls ad sets ad groups, and on LinkedIn they are the campaigns inside a campaign group. LinkedIn's minimum is 10 USD a day, and its end date is the end of that day in UTC. **Body** | Name | Type | Required | Description | | ------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | | `adAccountId` | `string` | Yes | The TikTok advertiser id the ad group belongs to. | | `dailyBudget` | `number` | | Whole units of the ad account's currency. TikTok's minimum is 20 USD a day; Adeli refuses less for a USD account with 400 before calling TikTok. | | `endDate` | `date` | | YYYY-MM-DD. The ad group stops delivering at the end of that day in the ad account's timezone. | | `name` | `string` | | Shown in TikTok Ads Manager. | Give at least one of `dailyBudget`, `endDate` or `name`. ## Meta body Only the fields you send change. The ad set must belong to `adAccountId`, or the response is `404 object_not_found`. **Body (Meta)** | Name | Type | Required | Description | | ------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `adAccountId` | `string` | Yes | The Meta ad account the ad set belongs to. | | `name` | `string` | | Shown in Ads Manager. | | `budget` | `object` | | { type, amount } in whole currency units. The type must be the one the ad set has: Meta does not switch daily and lifetime. An ad set whose campaign holds the budget (CBO) returns 400; change it with Update campaign. | | `bid` | `object` | | { strategy: lowest\_cost \| bid\_cap \| cost\_cap \| min\_roas, amount, roasFloor }, as on Create campaign. | | `startDate` | `date` | | YYYY-MM-DD; the ad set starts at midnight UTC. | | `endDate` | `date` | | YYYY-MM-DD; the ad set runs through the end of that day (UTC). | | `targeting` | `object` | | The whole targeting spec, as on Create campaign. It replaces the current one. | The response is `{ platform: "meta_ads", accountId, adAccountId, adGroup: { adSetId, updated } }`, where `updated` lists the fields sent. To delete one Meta ad set with its ads, send `DELETE` to the same path with `adAccountId` in the query; see [Delete ad set](https://www.tryadeli.com/docs/api/ads/delete-ad-group). ## Request examples **cURL** ```bash curl -X PATCH "https://app.tryadeli.com/api/v1/ads/ad-groups/1800000000000000002?accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "adAccountId": "7000000000000000001", "dailyBudget": 25 }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/ad-groups/1800000000000000002?accountId=00000000-0000-0000-0000-000000000000", { method: "PATCH", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ adAccountId: "7000000000000000001", dailyBudget: 25, }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.patch( "https://app.tryadeli.com/api/v1/ads/ad-groups/1800000000000000002", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", }, json={ "adAccountId": "7000000000000000001", "dailyBudget": 25, }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "tiktok_ads", "accountId": "00000000-0000-0000-0000-000000000000", "adAccountId": "7000000000000000001", "adGroup": { "adGroupId": "1800000000000000002", "dailyBudget": 25 } } ``` ### 400 ```json { "error": { "code": "invalid_request", "message": "TikTok's minimum ad group budget is $20 a day" } } ``` ## Delete ad set URL: https://www.tryadeli.com/docs/api/ads/delete-ad-group Markdown: https://www.tryadeli.com/docs/api/ads/delete-ad-group.md Delete one Meta ad set with its ads. # Delete ad set > Delete one Meta ad set with its ads. Canonical: `DELETE https://app.tryadeli.com/api/v1/ads/ad-groups/{adGroupId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) **Meta Ads.** Deletes one ad set together with its ads, which stops their delivery immediately. It cannot be undone; the campaign stays. The ad set must belong to `adAccountId`; otherwise the response is `404 object_not_found` and nothing is deleted. Responds `204`. **Path parameters** | Name | Type | Required | Description | | ----------- | -------- | -------- | -------------------------------------------------- | | `adGroupId` | `string` | Yes | A Meta ad set id, from the campaign tree's adSets. | **Query parameters** | Name | Type | Required | Description | | ------------- | -------- | -------- | ------------------------------------------------ | | `adAccountId` | `string` | Yes | The ad account the ad set belongs to. | | `accountId` | `uuid` | | The Meta Ads account. Defaults to the profile's. | ## Request examples **cURL** ```bash curl -X DELETE "https://app.tryadeli.com/api/v1/ads/ad-groups/120210000000000002?adAccountId=act_1234567890&accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/ad-groups/120210000000000002?adAccountId=act_1234567890&accountId=00000000-0000-0000-0000-000000000000", { method: "DELETE", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(response.status); // 204: no body ``` **Python** ```python import os import requests response = requests.delete( "https://app.tryadeli.com/api/v1/ads/ad-groups/120210000000000002", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "adAccountId": "act_1234567890", "accountId": "00000000-0000-0000-0000-000000000000", }, ) print(response.status_code) # 204: no body ``` ## Responses ### 204 No Content ```text (empty body) ``` ### 404 ```json { "error": { "code": "object_not_found", "message": "That ad set does not belong to this ad account", "details": { "object": "ad set" } } } ``` ## Delete ad URL: https://www.tryadeli.com/docs/api/ads/delete-ad Markdown: https://www.tryadeli.com/docs/api/ads/delete-ad.md Delete one Meta ad. # Delete ad > Delete one Meta ad. Canonical: `DELETE https://app.tryadeli.com/api/v1/ads/ads/{adId}` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) **Meta Ads.** Deletes one ad, which stops its delivery immediately. It cannot be undone; its ad set and campaign stay. The ad must belong to `adAccountId`; otherwise the response is `404 object_not_found` and nothing is deleted. Responds `204`. **Path parameters** | Name | Type | Required | Description | | ------ | -------- | -------- | ------------------------------------- | | `adId` | `string` | Yes | A Meta ad id, from the campaign tree. | **Query parameters** | Name | Type | Required | Description | | ------------- | -------- | -------- | ------------------------------------------------ | | `adAccountId` | `string` | Yes | The ad account the ad belongs to. | | `accountId` | `uuid` | | The Meta Ads account. Defaults to the profile's. | ## Request examples **cURL** ```bash curl -X DELETE "https://app.tryadeli.com/api/v1/ads/ads/120210000000000004?adAccountId=act_1234567890&accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/ads/120210000000000004?adAccountId=act_1234567890&accountId=00000000-0000-0000-0000-000000000000", { method: "DELETE", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(response.status); // 204: no body ``` **Python** ```python import os import requests response = requests.delete( "https://app.tryadeli.com/api/v1/ads/ads/120210000000000004", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "adAccountId": "act_1234567890", "accountId": "00000000-0000-0000-0000-000000000000", }, ) print(response.status_code) # 204: no body ``` ## Responses ### 204 No Content ```text (empty body) ``` ### 404 ```json { "error": { "code": "object_not_found", "message": "That ad does not belong to this ad account", "details": { "object": "ad" } } } ``` ## Targeting options URL: https://www.tryadeli.com/docs/api/ads/list-targeting Markdown: https://www.tryadeli.com/docs/api/ads/list-targeting.md Search Meta interests, behaviors, demographics, locations and languages, or list TikTok and LinkedIn options. # Targeting options > Search Meta interests, behaviors, demographics, locations and languages, or list TikTok and LinkedIn options. Canonical: `GET https://app.tryadeli.com/api/v1/ads/targeting` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) The targeting options a campaign can use. For Meta: search `interests` or `locations` by name with `q`, or list `behaviors`, `demographics` and `languages` (which `q` filters). A location's `id` is its key and comes with its `locationType` (country, region, city or zip), `countryCode` and `region`; a language's `id` is the locale number targeting takes; a demographic's `type` goes back with its `id`. Interests and behaviors carry Meta's audience size estimate. For TikTok: locations (`regions`), `languages`, or `interests`. For LinkedIn: `locations`, `job_functions`, `seniorities`, `industries`, or `company_sizes`, with `q` to search locations and industries by name; each `id` is the URN to target. Pass the returned `id`s in the `targeting` of [Create campaign](https://www.tryadeli.com/docs/api/ads/create-campaign). **Query parameters** | Name | Type | Required | Description | | --------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `adAccountId` | `string` | Yes | A Meta ad account id, TikTok advertiser id or LinkedIn ad account id. | | `type` | `string` | Yes | Meta: interests, behaviors, demographics, locations or languages. TikTok: regions, languages or interests. LinkedIn: locations, job\_functions, seniorities, industries or company\_sizes. | | `goal` | `string` | | TikTok: traffic, reach or video\_views. Location availability depends on the goal; defaults to traffic. | | `q` | `string` | | Meta: search by name; required for interests and locations. LinkedIn: search locations or industries by name. | | `locationTypes` | `string` | | Meta locations: comma-separated from country, region, city and zip. All four by default. | | `countryCode` | `string` | | Meta locations: limit to one country, such as US. | ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/ads/targeting?accountId=00000000-0000-0000-0000-000000000000&adAccountId=7000000000000000001&type=regions" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/targeting?accountId=00000000-0000-0000-0000-000000000000&adAccountId=7000000000000000001&type=regions", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/ads/targeting", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", "adAccountId": "7000000000000000001", "type": "regions", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "tiktok_ads", "accountId": "00000000-0000-0000-0000-000000000000", "adAccountId": "7000000000000000001", "type": "regions", "options": [ { "id": "6252001", "name": "United States", "parentId": null, "level": "COUNTRY" } ] } ``` ### 200 Meta locations ```json { "platform": "meta_ads", "accountId": "00000000-0000-0000-0000-000000000000", "adAccountId": "act_1234567890", "type": "locations", "options": [ { "id": "2490299", "name": "New York", "type": null, "locationType": "city", "countryCode": "US", "region": "New York" } ] } ``` ### 400 ```json { "error": { "code": "invalid_request", "message": "adAccountId and type (interests, behaviors, demographics, locations or languages) are required" } } ``` ## Estimate reach URL: https://www.tryadeli.com/docs/api/ads/estimate-reach Markdown: https://www.tryadeli.com/docs/api/ads/estimate-reach.md How many people a Meta targeting spec reaches. # Estimate reach > How many people a Meta targeting spec reaches. Canonical: `POST https://app.tryadeli.com/api/v1/ads/reach-estimate` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) **Meta Ads.** Meta's estimate of how many people a targeting spec reaches, to size an audience before creating a campaign or changing an ad set's targeting. It is a read sent as `POST` because a targeting spec does not fit in a query string; it creates nothing. `lower` and `upper` are `null` when Meta cannot estimate, as for some custom audiences, and `ready` is false while Meta is still working one out. **Body** | Name | Type | Required | Description | | ------------- | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------- | | `adAccountId` | `string` | Yes | The ad account to estimate in. | | `targeting` | `object` | Yes | The same targeting as [Create campaign](https://www.tryadeli.com/docs/api/ads/create-campaign#meta-full-campaign-body). | ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/ads/reach-estimate?accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "adAccountId": "act_1234567890", "targeting": { "ageMin": 25, "ageMax": 44, "locations": { "countries": [ "US" ] }, "interests": [ { "id": "6003127206524", "name": "Coffee" } ] } }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/reach-estimate?accountId=00000000-0000-0000-0000-000000000000", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ adAccountId: "act_1234567890", targeting: { ageMin: 25, ageMax: 44, locations: { countries: [ "US", ], }, interests: [ { id: "6003127206524", name: "Coffee", }, ], }, }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/ads/reach-estimate", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", }, json={ "adAccountId": "act_1234567890", "targeting": { "ageMin": 25, "ageMax": 44, "locations": { "countries": [ "US", ], }, "interests": [ { "id": "6003127206524", "name": "Coffee", }, ], }, }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "meta_ads", "accountId": "00000000-0000-0000-0000-000000000000", "adAccountId": "act_1234567890", "estimate": { "lower": 1200000, "upper": 1400000, "ready": true } } ``` ### 400 ```json { "error": { "code": "invalid_request", "message": "Invalid reach estimate request" } } ``` ## Instagram accounts URL: https://www.tryadeli.com/docs/api/ads/list-instagram-accounts Markdown: https://www.tryadeli.com/docs/api/ads/list-instagram-accounts.md The Instagram accounts a Meta ad account can run ads as. # Instagram accounts > The Instagram accounts a Meta ad account can run ads as. Canonical: `GET https://app.tryadeli.com/api/v1/ads/instagram-accounts` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) **Meta Ads.** The Instagram accounts an ad account can run ads as. Pass an `id` as `instagramAccountId` to [Create campaign](https://www.tryadeli.com/docs/api/ads/create-campaign) to show the ad as that account on Instagram, or to boost one of its posts. Adeli reads them from the ad account with the Meta Ads connection's own Ads permissions. If Meta asks for `instagram_basic`, which the Meta Ads connection does not request today, the response is `403 permission_required` naming it. **Query parameters** | Name | Type | Required | Description | | ------------- | -------- | -------- | ------------------------------------------------ | | `adAccountId` | `string` | Yes | A Meta ad account id. | | `accountId` | `uuid` | | The Meta Ads account. Defaults to the profile's. | ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/ads/instagram-accounts?adAccountId=act_1234567890&accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/instagram-accounts?adAccountId=act_1234567890&accountId=00000000-0000-0000-0000-000000000000", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/ads/instagram-accounts", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "adAccountId": "act_1234567890", "accountId": "00000000-0000-0000-0000-000000000000", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "meta_ads", "accountId": "00000000-0000-0000-0000-000000000000", "adAccountId": "act_1234567890", "instagramAccounts": [ { "id": "17841400000000001", "username": "acmecoffee", "avatarUrl": null } ] } ``` ### 400 ```json { "error": { "code": "invalid_request", "message": "adAccountId is required" } } ``` ## List ad identities URL: https://www.tryadeli.com/docs/api/ads/list-identities Markdown: https://www.tryadeli.com/docs/api/ads/list-identities.md The brand identities a TikTok ad can run as. # List ad identities > The brand identities a TikTok ad can run as. Canonical: `GET https://app.tryadeli.com/api/v1/ads/identities` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) **TikTok Ads only.** The brand identities a TikTok ad can run as on this ad account: a display name and avatar shown on the ad, rather than a TikTok account. Pass an `id` as `identity.identityId` when [creating a campaign](https://www.tryadeli.com/docs/api/ads/create-campaign). **Query parameters** | Name | Type | Required | Description | | ------------- | -------- | -------- | ----------------------- | | `adAccountId` | `string` | Yes | A TikTok advertiser id. | ## Request examples **cURL** ```bash curl "https://app.tryadeli.com/api/v1/ads/identities?accountId=00000000-0000-0000-0000-000000000000&adAccountId=7000000000000000001" \ -H "Authorization: Bearer $ADELI_API_KEY" ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/identities?accountId=00000000-0000-0000-0000-000000000000&adAccountId=7000000000000000001", { headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, }, }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.get( "https://app.tryadeli.com/api/v1/ads/identities", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", "adAccountId": "7000000000000000001", }, ) print(response.json()) ``` ## Responses ### 200 ```json { "platform": "tiktok_ads", "accountId": "00000000-0000-0000-0000-000000000000", "adAccountId": "7000000000000000001", "identities": [ { "id": "7300000000000000003", "type": "CUSTOMIZED_USER", "displayName": "Acme", "avatarUrl": null } ] } ``` ### 400 ```json { "error": { "code": "unsupported_for_platform", "message": "Ad identities is not available for Meta ads accounts" } } ``` ## Create ad identity URL: https://www.tryadeli.com/docs/api/ads/create-identity Markdown: https://www.tryadeli.com/docs/api/ads/create-identity.md A TikTok brand identity from a name and avatar. # Create ad identity > A TikTok brand identity from a name and avatar. Canonical: `POST https://app.tryadeli.com/api/v1/ads/identities` Authorization: `Bearer ` — see [Authentication](https://www.tryadeli.com/docs/authentication) **TikTok Ads only.** Creates a brand identity from a display name and an avatar image. The avatar is an `{ "uploadId" }` from [media uploads](https://www.tryadeli.com/docs/api/posts/create-media-uploads) (platform `tiktok`) or an `{ "url" }` TikTok can fetch over HTTPS. **Body** | Name | Type | Required | Description | | ------------- | -------- | -------- | ---------------------------------------- | | `adAccountId` | `string` | Yes | A TikTok advertiser id. | | `displayName` | `string` | Yes | Shown on the ad, up to 40 characters. | | `avatar` | `object` | Yes | { uploadId } or { url }: a square image. | ## Request examples **cURL** ```bash curl -X POST "https://app.tryadeli.com/api/v1/ads/identities?accountId=00000000-0000-0000-0000-000000000000" \ -H "Authorization: Bearer $ADELI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "adAccountId": "7000000000000000001", "displayName": "Acme", "avatar": { "url": "https://cdn.example.com/acme.png" } }' ``` **JavaScript** ```javascript const response = await fetch("https://app.tryadeli.com/api/v1/ads/identities?accountId=00000000-0000-0000-0000-000000000000", { method: "POST", headers: { Authorization: `Bearer ${process.env.ADELI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ adAccountId: "7000000000000000001", displayName: "Acme", avatar: { url: "https://cdn.example.com/acme.png", }, }), }); console.log(await response.json()); ``` **Python** ```python import os import requests response = requests.post( "https://app.tryadeli.com/api/v1/ads/identities", headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"}, params={ "accountId": "00000000-0000-0000-0000-000000000000", }, json={ "adAccountId": "7000000000000000001", "displayName": "Acme", "avatar": { "url": "https://cdn.example.com/acme.png", }, }, ) print(response.json()) ``` ## Responses ### 201 ```json { "platform": "tiktok_ads", "accountId": "00000000-0000-0000-0000-000000000000", "adAccountId": "7000000000000000001", "identity": { "id": "7300000000000000003", "type": "CUSTOMIZED_USER", "displayName": "Acme", "avatarUrl": null } } ``` ### 400 ```json { "error": { "code": "unsupported_for_platform", "message": "Ad identities is not available for Meta ads accounts" } } ```