This guide takes you from nothing to a scheduled post in about ten minutes. Every step is shown in curl, JavaScript (fetch, Node 18 or newer) and Python (requests).
The IQCore API is in private beta. To join, ask through Support in your dashboard or on the contact page. Until your organization is in the beta, the API answers 404.
Before you start
You need:
- an IQCore organization with at least one connected channel (Facebook Page, Instagram, Threads or TikTok);
- a plan that allows API keys (a Spark plan can make test keys only, see Rate limits);
- the role owner or admin (a member may create keys only if the owner allows it).
All examples use the working base URL https://iqcore.ai/api/public/v1. A shorter host, https://api.iqcore.ai/v1, is coming. Both will serve the same API.
1. Create a key in the dashboard
- Open IQCore and go to Settings → Apps & integrations → API keys.
- Choose Create key, give it a name, pick the rights it needs and confirm with your password.
- Copy the key. It starts with
iqk_live_oriqk_test_and is shown once.
For this guide a test key is the safest choice: everything it creates is a sandbox post that never reaches a platform. See Test keys and dry run. With a test key, give it the rights social.read, social.write, social.publish and media.write.
Put the key in an environment variable. Never put it in a URL (a key in a URL is refused with 400 key_in_url) and never commit it.
export IQCORE_KEY="iqk_test_XXXX"
BASE="https://iqcore.ai/api/public/v1"// Save the examples below in one file, quickstart.mjs, and run: node quickstart.mjs
// First set the key in your shell: export IQCORE_KEY="iqk_test_XXXX"
const BASE = "https://iqcore.ai/api/public/v1";
async function api(method, path, { body, headers = {} } = {}) {
const res = await fetch(BASE + path, {
method,
headers: {
Authorization: `Bearer ${process.env.IQCORE_KEY}`,
...(body ? { "Content-Type": "application/json" } : {}),
...headers,
},
body: body ? JSON.stringify(body) : undefined,
});
const json = await res.json().catch(() => null);
return { status: res.status, json };
}
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));import os
import time
import uuid
import requests
BASE = "https://iqcore.ai/api/public/v1"
session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['IQCORE_KEY']}"
def api(method, path, **kwargs):
res = session.request(method, BASE + path, timeout=30, **kwargs)
try:
body = res.json()
except ValueError:
body = None
return res.status_code, bodyThe later JavaScript and Python blocks reuse api(). If your key works in more than one organization, add organization_id to every request (see Concepts). This guide assumes a key with one organization.
2. Check the key
GET /me shows who the key is and what it may do. It works without organization_id.
curl "$BASE/me" -H "Authorization: Bearer $IQCORE_KEY"const me = await api("GET", "/me");
console.log(me.status, me.json.mode, me.json.scopes);status, me = api("GET", "/me")
print(status, me["mode"], me["scopes"])You get the key's mode (live or test), its scopes, its approval_mode and the list of its organizations, each with your current role. A 401 means the key is wrong, revoked or expired. See Errors.
3. List your organizations and channels
curl "$BASE/organizations" -H "Authorization: Bearer $IQCORE_KEY"
curl "$BASE/channels" -H "Authorization: Bearer $IQCORE_KEY"const orgs = await api("GET", "/organizations");
console.log(orgs.json.data.map((o) => [o.id, o.name, o.usable]));
const channels = await api("GET", "/channels");
const channel = channels.json.channels.find((c) => c.status === "connected");
console.log(channel.id, channel.platform, channel.name);status, orgs = api("GET", "/organizations")
print([(o["id"], o["name"], o["usable"]) for o in orgs["data"]])
status, channels = api("GET", "/channels")
channel = next(c for c in channels["channels"] if c["status"] == "connected")
print(channel["id"], channel["platform"], channel["name"])Pick a channel whose status is connected and keep its id. A channel with missing_permissions or another status must be reconnected by a person in IQCore (reconnect_url). See Platform permissions.
CHANNEL_ID="paste-the-channel-id-here"curl -X POST "$BASE/media" \
-H "Authorization: Bearer $IQCORE_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/images/launch.jpg", "name": "Launch picture"}'
MEDIA_ID="paste-the-media-id-here"
# Repeat until "status" is "ready" (or "failed")
curl "$BASE/media/$MEDIA_ID" -H "Authorization: Bearer $IQCORE_KEY"const imported = await api("POST", "/media", {
body: { url: "https://example.com/images/launch.jpg", name: "Launch picture" },
headers: { "Idempotency-Key": crypto.randomUUID() },
});
const mediaId = imported.json.id;
let media = imported.json;
for (let i = 0; i < 30 && media.status === "pending"; i++) {
await sleep(2000);
media = (await api("GET", `/media/${mediaId}`)).json;
}
if (media.status !== "ready") throw new Error(`Import ${media.status}: ${media.error?.message}`);status, imported = api(
"POST",
"/media",
json={"url": "https://example.com/images/launch.jpg", "name": "Launch picture"},
headers={"Idempotency-Key": str(uuid.uuid4())},
)
media_id = imported["id"]
media = imported
for _ in range(30):
if media["status"] != "pending":
break
time.sleep(2)
_, media = api("GET", f"/media/{media_id}")
if media["status"] != "ready":
raise RuntimeError(f"Import {media['status']}: {media.get('error')}")Only public http and https addresses are fetched. See Media for the rules, the file types and the limits. To upload a file from your computer instead, send multipart/form-data with a file field (the answer is 201 with status: "ready").
5. Create a draft post
POST /posts always creates a draft. Nothing is published yet. scheduled_at is required: the time the post goes out once it is approved (1 minute to 365 days ahead, ISO 8601 with an offset).
Send two things that make the call safe to repeat:
Idempotency-Key(header): a retry with the same key returns the first answer instead of creating a second post. See Idempotency and external_ref.external_ref(body): your own id for this post. A second create with the sameexternal_refanswers409 external_ref_existswith theexisting_id.
curl -X POST "$BASE/posts" \
-H "Authorization: Bearer $IQCORE_KEY" \
-H "Idempotency-Key: launch-2026-12-20-post-create" \
-H "Content-Type: application/json" \
-d '{
"channel_ids": ["'"$CHANNEL_ID"'"],
"caption": "New in the shop today.",
"media_ids": ["'"$MEDIA_ID"'"],
"scheduled_at": "2026-12-20T09:00:00Z",
"external_ref": "shop:item:42"
}'
POST_ID="paste-the-post-id-here"const created = await api("POST", "/posts", {
headers: { "Idempotency-Key": "launch-2026-12-20-post-create" },
body: {
channel_ids: [channel.id],
caption: "New in the shop today.",
media_ids: [mediaId],
scheduled_at: "2026-12-20T09:00:00Z",
external_ref: "shop:item:42",
},
});
if (created.status === 409) {
console.log("Already created:", created.json.error.existing_id);
}
const postId = created.json.id ?? created.json.error?.existing_id;
console.log(created.status, created.json.status); // 201 "draft"status, created = api(
"POST",
"/posts",
headers={"Idempotency-Key": "launch-2026-12-20-post-create"},
json={
"channel_ids": [channel["id"]],
"caption": "New in the shop today.",
"media_ids": [media_id],
"scheduled_at": "2026-12-20T09:00:00Z",
"external_ref": "shop:item:42",
},
)
if status == 409:
print("Already created:", created["error"]["existing_id"])
post_id = created.get("id") or created["error"]["existing_id"]
print(status, created.get("status")) # 201 draftUse a time that is in the future when you run this. The answer has the post id, its status (draft) and one entry per channel in targets.
6. Request approval and approve
A draft is published only after it is approved. You have two ways to ask:
POST /posts/{id}/request-approvalrings the owner and admins in IQCore. The post then showspending_approval.POST /posts/{id}/approveapproves it.
What approve does depends on the key's approval mode:
| Answer | When | What it means |
|---|---|---|
200 |
The key's approval mode is api (a live key of the organization owner), or you use a test key on its own sandbox post |
The post is approved and status is scheduled. |
202 with requires_action |
The default mode, dashboard |
Nothing was approved. A person approves the post in the IQCore calendar. requires_action.type is approve_in_iqcore. |
202 with requires_action |
The post has a TikTok channel, in every mode | The creator must choose the post's settings on IQCore's TikTok screen. requires_action.type is tiktok_post_settings. |
A 202 is not an error. Read requires_action.url and requires_action.message, tell your user, and carry on. The approve call needs the scope social.publish and the role admin or owner.
curl -X POST "$BASE/posts/$POST_ID/request-approval" \
-H "Authorization: Bearer $IQCORE_KEY" \
-H "Idempotency-Key: $(uuidgen)"
curl -i -X POST "$BASE/posts/$POST_ID/approve" \
-H "Authorization: Bearer $IQCORE_KEY" \
-H "Idempotency-Key: $(uuidgen)"await api("POST", `/posts/${postId}/request-approval`, {
headers: { "Idempotency-Key": crypto.randomUUID() },
});
const approved = await api("POST", `/posts/${postId}/approve`, {
headers: { "Idempotency-Key": crypto.randomUUID() },
});
if (approved.status === 202) {
const action = approved.json.requires_action;
console.log(`Waiting for a person: ${action.type} ${action.url ?? ""}`);
} else {
console.log(approved.status, approved.json.status); // 200 "scheduled"
}api("POST", f"/posts/{post_id}/request-approval",
headers={"Idempotency-Key": str(uuid.uuid4())})
status, approved = api("POST", f"/posts/{post_id}/approve",
headers={"Idempotency-Key": str(uuid.uuid4())})
if status == 202:
action = approved["requires_action"]
print("Waiting for a person:", action["type"], action.get("url"))
else:
print(status, approved["status"]) # 200 scheduledA 202 answer frees the idempotency key, so you can repeat the same call after the person approved. More in Post states and approval.
7. Schedule
scheduled_at was set when you created the post. To move it, call POST /posts/{id}/schedule with the new time. An approved post keeps its approval when only the time changes.
curl -X POST "$BASE/posts/$POST_ID/schedule" \
-H "Authorization: Bearer $IQCORE_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"scheduled_at": "2026-12-21T09:00:00Z"}'const scheduled = await api("POST", `/posts/${postId}/schedule`, {
headers: { "Idempotency-Key": crypto.randomUUID() },
body: { scheduled_at: "2026-12-21T09:00:00Z" },
});
console.log(scheduled.status, scheduled.json.status, scheduled.json.scheduled_at);status, scheduled = api(
"POST",
f"/posts/{post_id}/schedule",
headers={"Idempotency-Key": str(uuid.uuid4())},
json={"scheduled_at": "2026-12-21T09:00:00Z"},
)
print(status, scheduled["status"], scheduled["scheduled_at"])Want to see what would happen without publishing anything? Call POST /posts/{id}/publish with {"dry_run": true}. See Test keys and dry run.
8. Follow the post with the events feed
Do not poll every post. GET /events returns what happened in your organization, in order. Keep the next_cursor of the last answer and send it back as since.
# First call: from the oldest kept event
curl "$BASE/events?limit=100" -H "Authorization: Bearer $IQCORE_KEY"
# Next calls: only what is new
curl "$BASE/events?since=evc_XXXX&limit=100" -H "Authorization: Bearer $IQCORE_KEY"let cursor = null; // keep this between runs (a file, a database)
while (true) {
const q = new URLSearchParams({ limit: "100" });
if (cursor) q.set("since", cursor);
const { status, json } = await api("GET", `/events?${q}`);
if (status === 410) {
cursor = json.error.oldest_cursor; // the cursor is too old: start from here
continue;
}
for (const event of json.data) {
console.log(event.type, event.subject?.id, event.data);
// handle the event, then...
}
cursor = json.next_cursor; // ...save the cursor only after the events were handled
if (!json.has_more) break;
}cursor = None # keep this between runs (a file, a database)
while True:
params = {"limit": 100}
if cursor:
params["since"] = cursor
status, body = api("GET", "/events", params=params)
if status == 410:
cursor = body["error"]["oldest_cursor"] # too old: start from here
continue
for event in body["data"]:
print(event["type"], (event.get("subject") or {}).get("id"), event["data"])
# handle the event, then...
cursor = body["next_cursor"] # ...save the cursor only after the events were handled
if not body["has_more"]:
breakAn approved post is published at its scheduled_at. You see post.publishing and then post.published (or post.failed) per channel. With a test key the publish is simulated and the events carry sandbox: true. Details in Events.
What you built
You created a key, read channels, imported a picture, made an idempotent draft, handled the approval answers and followed the result in the feed.
Next: Concepts, Post states and approval, n8n.