Test keys and dry run

Test your code against your real organization without risk. Two tools help: test keys, and dry_run on publish.

The IQCore API is in private beta. To join, ask through Support in your dashboard or on the contact page.

Test keys

A test key starts with iqk_test_. You make it on the API keys page like any other key (Settings → Apps & integrations → API keys). A plan that allows no live keys (Spark) can still make test keys.

A test key:

  • Reads real data. It reads what its rights allow, as a live key would: your real channels, media and live posts, credits and usage.
  • Creates sandbox data. Every post a test key creates is a sandbox post (sandbox: true). The calendar and the app do not show it, and the publisher never picks it up.
  • Simulates publishing. POST /posts/{id}/publish on a sandbox post moves its targets through publishing to published with platform_post_id: "sandbox_..." and no permalink. Nothing reaches Facebook, Instagram, Threads or TikTok. A test key approves its own sandbox posts straight away.
  • Never touches live posts. Trying to approve, publish, update, cancel or delete a post that is not a sandbox post answers 403 sandbox_forbidden.
  • Adds media files. POST /media works, at most 50 files a day. The files are tagged as test uploads.
  • Changes nothing else and spends nothing. Every other write answers 403 sandbox_forbidden, before anything is checked, priced or run: no image, video, voice or Studio work, no credits spent, no deletes, no renames or moves in the Media library, no settings, no WhatsApp or report changes. Use a live key for these.
  • Cannot hold the live-only rights. A test key cannot be given create.spend, studio.write, settings.write or media.delete.
  • Has its own external_ref space. A test key can reuse a reference a live key already used.
  • Has its own daily budgets. Simulated publishes, approvals and schedules count against a test budget of the same size as the real one, so a test loop never uses up the publishing your live keys, connected AI apps and AI Chat do that day.
  • Gets sandbox events. Events for sandbox posts have sandbox: true.

IQCore deletes sandbox posts and their sandbox events 7 days after they were made. Do not rely on them staying.

Seeing sandbox data with a live key

A live key does not see sandbox data unless you ask:

  • GET /posts?include_sandbox=true
  • GET /events?include_sandbox=true

A live key still cannot change a sandbox post. The IQCore calendar never shows test posts.

curl
curl "https://iqcore.ai/api/public/v1/posts?include_sandbox=true" -H "Authorization: Bearer $IQCORE_KEY"
JavaScript
const res = await fetch("https://iqcore.ai/api/public/v1/posts?include_sandbox=true", {
  headers: { Authorization: `Bearer ${process.env.IQCORE_KEY}` },
});
Python
import os
import requests

res = requests.get("https://iqcore.ai/api/public/v1/posts", params={"include_sandbox": "true"}, timeout=30,
                   headers={"Authorization": f"Bearer {os.environ['IQCORE_KEY']}"})

Dry run

POST /posts/{id}/publish with {"dry_run": true} checks a post and publishes nothing. It changes no state and records no event. You can use it with a live or a test key.

curl
curl -X POST "https://iqcore.ai/api/public/v1/posts/$POST_ID/publish" \
  -H "Authorization: Bearer $IQCORE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"dry_run": true}'
JavaScript
const res = await fetch(`https://iqcore.ai/api/public/v1/posts/${postId}/publish`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.IQCORE_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ dry_run: true }),
});
const report = await res.json();
console.log(report.would_publish, report.checks);
Python
import os
import requests

report = requests.post(
    f"https://iqcore.ai/api/public/v1/posts/{post_id}/publish",
    json={"dry_run": True},
    headers={"Authorization": f"Bearer {os.environ['IQCORE_KEY']}"},
    timeout=30,
).json()
print(report["would_publish"], report["checks"])

The answer is the post plus two fields:

  • would_publish: true when the same call without dry_run would start publishing every open channel now.
  • checks[]: one entry per check, each with target (the target id, or null for the whole post), channel_id, code, ok, severity (error, warning or info) and message.
json
{
  "would_publish": false,
  "checks": [
    { "target": null, "channel_id": null, "code": "approval", "ok": false, "severity": "warning",
      "message": "This key's approval mode is dashboard: publishing would wait for a person." },
    { "target": "9b3a7a42-...", "channel_id": "c4c1f2de-...", "code": "media", "ok": true, "severity": "info",
      "message": "The media fits the platform." }
  ]
}

(The texts are examples. Use code, ok and severity.)

What is checked

  • The post's own rules: caption, hashtags, number of media, time window.
  • The first comment and the link.
  • The state of the channel: it is connected and may publish.
  • The channel's login: expired, or expiring within 3 days (from the stored expiry date).
  • The media against the platform rules (see Media).
  • The TikTok gate: whether a person still has to choose the TikTok settings.
  • The approval warning: in dashboard mode a publish would answer 202 and wait for a person.
  • Sandbox information for a test key.

What is not checked

A dry run makes no call to Facebook, Instagram, Threads or TikTok. So it does not check:

  • whether the platform still accepts the login token right now;
  • Instagram's limit of 100 API-published posts in 24 hours.

A dry run that says would_publish: true can still fail at publish time for these reasons. Watch post.failed events and the target's error.code.

Next: Post states and approval, Platform permissions.