Before using these instructions, check operation availability and compatibility.
The CampaignA developer's data-production project and its settings API lets a program read a Campaign's definition, check a candidate change, create a Campaign or apply a change to its draft, and run a launch that a person has confirmed. It is a separate contract from subscription data delivery. Delivered records come from the data API, and a data-delivery Key carries none of the grants below.
Download the OpenAPI contract for organization API Keys for request and response schemas. It includes 45 Key-accessible operations and excludes 5 session-only operations. Human confirmation stays in the portal. This file describes the contract shipped with this documentation build; verify your target environment before writing or launching.
Hosts, credential, and grants
Use https://api.humanbased.ai with a Key issued for production, or https://api.staging.humanbased.ai with a staging Key. Use GET /api/v1/auth/whoami to check identity. All other operations are under /api/v1/campaignapi/. Send Authorization: Bearer <API_KEY> with each request.
An organizationThe Developer-side unit that holds Campaigns, data access, and funds member creates the Key and chooses its Campaign grants in the portal; Create and use an API Key walks through the form. The server checks each grant on its own.
| Grant | The Key may | Reach |
|---|---|---|
campaign:read | List and read Campaigns, their versions, and templates. | A read-only Key reaches every Campaign in its organization. |
submission:read | List submissions and inspect one submission. It cannot decide or reveal guarded or sealed content. | Campaigns in the Key's organization and managed_campaign_ids allowlist, when set. |
submission:decide | Approve, reject, or change a submission verdict and recover the Key's own receipts. | The editable Campaigns granted to the Key at creation. The Key expires within 90 days. |
campaign:author | Describe, validate, and plan a candidate; create a Campaign or change its draft; validate and save templates; read write receipts; run, read, or cancel sample trials, and inspect first-launch readiness. | The Campaigns named in the Key's managed_campaign_ids: the ones its creator could edit when the Key was created, plus any Campaign the Key creates. Templates are authored in the Key's organization. |
campaign:launch | Propose a launch, read back its own proposal, and execute it once a person has confirmed it. | The same list, within the spend cap recorded on the Key. |
A Campaign outside the Key's organization or outside its list answers 404 with CAMPAIGN_NOT_FOUND, the same answer as a Campaign that does not exist.
A Key with campaign:author or campaign:launch can cover the Campaigns its creator can edit when minting it, if any, plus every Campaign the Key creates. An organization can use a Key to create its first Campaign.
Check identity and read scope
Start with a read-only identity check:
curl --silent --show-error \
'https://api.humanbased.ai/api/v1/auth/whoami' \
--header "Authorization: Bearer $HB_API_KEY"Read data.org_id, data.scopes, and data.managed_campaign_ids before continuing. Keep the Key in an environment variable or secret store, never in a copied command or URL. Then list the Campaigns visible to that identity:
curl --silent --show-error \
'https://api.humanbased.ai/api/v1/campaignapi/campaigns' \
--header "Authorization: Bearer $HB_API_KEY"Every response carries success, errorCode, errorMessage, and data. A successful response has success: true, errorCode: 0, errorMessage: "SUCCESS", and the payload under data. The Campaign list accepts optional status, limit (1–200), and opaque cursor query parameters. Read data.items; if data.has_more is true, pass data.next_cursor unchanged in the next request. An empty page alone is not the end or proof that the organization has no Campaigns. Keep identifiers as strings.
Choose the operation
| Purpose | API operation | Required grant |
|---|---|---|
| Check the credential and organization | GET /api/v1/auth/whoami | The Key or session being checked; see Check identity and read scope |
| Find a template a Campaign File may reference | GET /api/v1/campaignapi/templates, template, catalog | campaign:read |
| Find the other names a Campaign File may reference: step types, acceptance checks, dedup keys, agreements, agents, and teams | GET /api/v1/campaignapi/nodecatalog, checkkinds, dedupkeys, agreementcatalog, installedagents, teamdirectory | campaign:read |
| List or inspect Campaigns and stored versions | GET /api/v1/campaignapi/campaigns, campaign, versions, version, versiondiff | campaign:read |
| Read one window's counts, and why its outcomes came out as they did | GET /api/v1/campaignapi/observation, outcomebreakdown | campaign:read |
| Read what is still in flight on a Campaign, what it has delivered, and how many people take part, as of now | GET /api/v1/campaignapi/campaignprogress | campaign:read; a signed-in person needs a role on the Campaign |
| Read saved participant requirements and their source revisions | GET /api/v1/campaignapi/campaignrequirements | campaign:read and access to the Campaign |
| Read Campaign or organization costs in a half-open window | GET /api/v1/campaignapi/campaigncost | billing:read for a Key; a signed-in person needs a current organization billing, owner, or admin role |
| Read Campaign escrow, outstanding commitments, and available funds | GET /api/v1/campaignapi/campaignbudget | billing:read and access to the Campaign |
| Read what Contributors see about a Campaign | GET /api/v1/campaignapi/campaigndetails | campaign:read |
| Describe a candidate's pay range | POST /api/v1/campaignapi/candidatefeasibility | campaign:author; read the range and assumptions |
| Validate, create, or update a form template | POST /api/v1/campaignapi/templatevalidate, templateapply | campaign:author; validate and save a template |
| List one page of submissions | GET /api/v1/campaignapi/submissions | A signed-in person with a Campaign role, or a Key with submission:read |
| Inspect one submission | GET /api/v1/campaignapi/submission | A signed-in person with a Campaign role, or a Key with submission:read |
| Check a candidate without changing state | POST /api/v1/campaignapi/candidatevalidate, candidateplan | campaign:author |
| Create a Campaign, or apply a change to a draft | POST /api/v1/campaignapi/candidateapply | campaign:author |
| Change what Contributors see about a Campaign | POST /api/v1/campaignapi/campaigndetailsupdate | campaign:author |
| Read visibility, protection, publisher and budget | GET /api/v1/campaignapi/campaignsettings | campaign:read |
| Change visibility or protection, once | POST /api/v1/campaignapi/campaignsettingsupdate | campaign:author |
| Read the receipt of an earlier write | GET /api/v1/campaignapi/actionreceipt | submission:decide for the Key's own decisions, campaign:author for other receipts |
| See what would still refuse a launch, before proposing one | GET /api/v1/campaignapi/readiness | campaign:read |
| Propose a launch, and read the proposal back | POST /api/v1/campaignapi/launchpropose, GET /api/v1/campaignapi/launchproposal | campaign:launch |
| Confirm a proposed launch | POST /api/v1/campaignapi/launchconfirm | A signed-in person; a Key is refused |
| Execute a confirmed launch | POST /api/v1/campaignapi/launch | campaign:launch |
| Pause a live Campaign, or resume a paused one | POST /api/v1/campaignapi/campaignpause, campaignresume | The Campaign's owner, signed in; a Key is refused |
| Decide or overturn a submission result | POST /api/v1/campaignapi/submissiondecide, submissionoverride | A signed-in Campaign editor or a Key with submission:decide and the Campaign on its allowlist. See Decide submissions. |
| Read a few resolved submission samples | GET /api/v1/campaignapi/submissionsamples | A portal session with a Campaign role; Keys and CLI sessions are refused. See Inspect samples in the portal. |
| Try an acceptance check on a sample submission, saving nothing | POST /api/v1/campaignapi/checkdryrun | A signed-in editor, or a Key with campaign:author for this Campaign |
| Start, read, or cancel an asynchronous sample trial | POST /api/v1/campaignapi/checkevaluate, GET /api/v1/campaignapi/checkevaluation, POST /api/v1/campaignapi/cancelcheckevaluation | A signed-in editor, or an API Key with campaign:author for a Campaign in an enabled organization |
| Check whether current sample evidence is ready for a first draft launch | GET /api/v1/campaignapi/checkevaluationreadiness | A signed-in editor, or an API Key with campaign:author |
| List the datasets a Campaign can import, and import one, once | GET /api/v1/campaignapi/inputdatasets, POST /api/v1/campaignapi/inputimport | campaign:author for listing; a signed-in editor for import |
This inventory covers the 50 operations in the Campaign API contract, including its identity check. The session-only rows identify who may call each operation.
Identifiers travel in the query string of a GET and in the JSON body of a POST. The CLI wraps the same operations as commands. In production, campaign:author permits acceptance-check dry runs and input-dataset listing for Campaigns in the Key’s grant. submission:read permits listing and inspecting submissionsThe record created when work is submitted within the organization and Campaign allowlist. Import, reveal, and submission decisions require a signed-in session.
Run an asynchronous acceptance-check trial
checkdryrun returns immediately. checkevaluate submits a sample trial to a background worker; the response's data.evaluation_id identifies it for lookup or cancellation. The trial uses the saved acceptance-step configuration and current form snapshot. It does not change the Campaign File or decide any real submission. Supply the outcome you expect:
{
"campaign_id": "campaign-id",
"step_key": "acceptance-step",
"request_key": "unique-trial-key",
"payload": {"tx_hash": "0x…"},
"expected_outcome": "accepted"
}The required fields are campaign_id, step_key, request_key, payload, and expected_outcome (accepted or rejected). Pass at most one of checks or script to override the checks for this trial, or omit both to use the saved configuration; min_rating (1–5) and double_check are optional. Reusing a request key with the same request returns the original trial; using it with different content is refused. The organization must also have asynchronous trials enabled.
Read the report with GET /api/v1/campaignapi/checkevaluation?campaign_id=<campaign-id>&evaluation_id=<evaluation-id>. To cancel, send POST /api/v1/campaignapi/cancelcheckevaluation with the same IDs and a dedicated request_key. data.status may be queued, running, completed, failed, cancelled, or expired. Only completed gives an accepted or rejected outcome; unavailable means a dependency returned no verdict, not that the sample was rejected. Cancellation does not change any real submission result. A Key needs campaign:author; a signed-in session needs the editor role on that Campaign. The documentation contract does not prove the routes are deployed in a target environment.
Durable audit sample endpoints
These endpoints are deployed in production and enabled per organization. Existing checkdryrun remains synchronous; its results do not automatically become durable sample evidence.
Use an admitted signed-in Campaign editor or an organization API Key with campaign:author for this Campaign. Creation, reads, cancellation, and launch checks recheck current authorization. An old evaluation ID does not retain access after authorization is revoked.
| Purpose | Endpoint | Result and next action |
|---|---|---|
| Create an evaluation | POST /api/v1/campaignapi/checkevaluate | HTTP 202 returns the evaluation record; keep evaluation_id to read progress |
| Read progress and results | GET /api/v1/campaignapi/checkevaluation | Query campaign_id and evaluation_id; wait for a terminal state before checking the expectation |
| Cancel an evaluation | POST /api/v1/campaignapi/cancelcheckevaluation | Send JSON with campaign_id, evaluation_id, and request_key; inspect the returned state because completion may precede cancellation |
| Check current evidence | GET /api/v1/campaignapi/checkevaluationreadiness | Query campaign_id; read each step's configuration and paired sample evidence |
Replace the example identifiers with your saved Campaign and acceptance step:
{
"campaign_id": "2026102816000100100001",
"step_key": "accept_photo",
"request_key": "sample-pass-20261028-1",
"payload": {"data": {"photo": {"file_id": "2026102816000100100002"}}},
"expected_outcome": "accepted"
}Omit both checks and script to run the complete saved acceptance definition, or send one of them to test a candidate list or script. Optional min_rating (an integer from 1 to 5) and double_check (a boolean) override the trial's threshold and double-check setting; omission uses the saved values. The server reads form fields from the saved Campaign. Use an image sample file_id that the caller is authorized to read, such as their own private sample uploaded in the portal.
The same request_key and request return the original evaluation. Use a new key when changing the sample, expected outcome, or review configuration. After a connection failure, retry creation with the original key or query the existing evaluation_id to avoid duplicate model charges. Cancellation has its own key: keep it for retries of the same cancellation and use a new key for another evaluation.
Version 2 separates status from outcome. queued and running are still processing. After completed, outcome distinguishes accepted, rejected, and unavailable. An unavailable result has null accepted and rating; error explains the cause and whether retrying is appropriate. Completed individual checks may remain in the report. expected_outcome is the caller's prior expectation; expectation_matched says whether the result agreed. Passing and rejection evidence comes from completed quality decisions that match the expectation.
config_fingerprint, form_fingerprint, and evaluator_version bind results to the review, form, and execution dependencies. Launch checks accept only a current pair of expected passing and rejection samples. enabled: false means the organization has no sample gate. launch_required: false means the Campaign does not require the first-launch gate and the report is informational for a published Campaign.
Check sample readiness for a first launch
checkevaluationreadiness is a read-only check of this Campaign's current acceptance configuration, forms, and sample evidence:
curl --silent --show-error \
'https://api.humanbased.ai/api/v1/campaignapi/checkevaluationreadiness?campaign_id=campaign-id' \
--header "Authorization: Bearer $HB_API_KEY"Read data.enabled, data.launch_required, and data.ready, then inspect each entry in data.steps. An automatic acceptance step is ready only when its current configuration, forms, and evaluator version have both a passing sample and a rejected sample with different sample contents. If you change a check, a form, or an evaluator contract, the earlier trials no longer match; submit both expected outcomes with checkevaluate, wait for them to finish, and read readiness again. Manual acceptance continues to use its configured review process.
When the organization has enabled this feature and the Campaign is still a draft, launch_required is true. A first-launch check without matching samples returns AUDIT_SAMPLES_REQUIRED and the launch does not proceed. ready covers sample evidence only; use GET /api/v1/campaignapi/readiness for other launch conditions. A Key needs campaign:author, and a signed-in session needs the editor role on that Campaign.
Write a Campaign File
A candidate is a Campaign File: one JSON object that holds the whole Campaign definition. Every write sends the complete document, not a patch.
| Section | Holds |
|---|---|
spec_version | The string "1.0". |
campaign | The Campaign's name. The server assigns campaign_id, owner, and created_at. |
eligibility | A statement of who may contribute: gates, kyc_tier (none, light, or full), and reputation. Quotes and the pre-launch check read it; who may join is decided by the access_gate entry step, written as described under "Reference names that already exist" below. |
workflow | The steps, as nodes, and the order between them, as next. |
reward_policy | The base reward, its factors, and its caps. |
quotas | budget_usd, the total the Campaign may spend, below 100000000000000 and to at most four decimal places, and per_node limits. |
data_contract | scarcity_strata and lineage. |
audit | A one-sentence intent, and versions. |
disclosure | Optional AI disclosure terms: ai_policy, max_level, measure, evidence, reward, submit, and audit. Every field may be left out. On creation, omitting the section uses the default terms. On update, omitting it keeps the Campaign's current terms in the saved version; use "disclosure": {} on a draft to reset to defaults. Every set of terms asks for the level, extent, models, and effort of any AI help, and no field can remove that. |
Disclosure values: ai_policy is human_only, ai_assisted_ok, agent_ok, or null; max_level is none, consulted, assisted, drafted, generated, or autonomous; measure is level, decisions, or content; evidence is declared, observed, or committed; and submit is person_confirms or agent_may_submit. max_level cannot exceed the policy ceiling (none for human_only, generated for ai_assisted_ok, autonomous for agent_ok, and generated when the policy is unset). When ai_policy is set but max_level is omitted, it defaults to none for human_only and generated for ai_assisted_ok or agent_ok. agent_may_submit requires agent_ok and autonomous. If set, reward.rule is required: flat takes no other field, by_level requires rates from involvement levels to numbers from 0 to 1, and by_human_share requires a floor from 0 to 1. If set, audit requires sample_rate above 0 and at most 1, keep_journal_days from 1 to 3650, and evidence: "committed".
Under decision 110, new or edited human_only contracts allow only none, including when max_level is omitted. Historical terms and completed apply receipts retain their original values. If an older draft explicitly permits consultation, saving another Campaign File requires explicitly correcting its disclosure terms; leaving the section out preserves those old terms and validation refuses the save. This describes the source implementation candidate; availability depends on deployment.
Default terms on creation, or after a draft reset with "disclosure": {}: ai_policy: null, max_level: generated, measure: level, evidence: declared, reward: {"rule": "flat"}, submit: person_confirms, and no audit. These defaults permit generated AI help but still require disclosure of level, extent, models, and effort.
The first eight sections are required; disclosure is optional. hbd schema campaignfile describes the file for an editor and is not authoritative. candidatevalidate is the authority, and it reports each problem by path.
To send an item to another step after a retryable infrastructure failure uses all its attempts, set on_exhausted on the worker step in workflow.nodes. Use the key of a different step other than the access gate. Run candidatevalidate to check the target before applying the file. Successful work continues along next and routes.
To change an existing Campaign, read its latest version back and edit that document, as the next section shows. To create one, start from the document below. It describes one contributor step behind an access gate, with each submission reviewed by a person. The name, amounts, and counts are illustrations; decide your own. Take template_id from GET /api/v1/campaignapi/templates.
{
"spec_version": "1.0",
"campaign": { "name": "Returns triage, round 1" },
"eligibility": { "gates": [], "kyc_tier": "none", "reputation": {} },
"workflow": {
"nodes": [
{ "key": "gate", "node_key": "access_gate", "params": { "spec_version": 1 } },
{
"key": "collect",
"node_key": "human_supply",
"params": {
"form_template_ref": { "template_id": "784210002001" },
"task": { "totalCap": 200, "perUserQuota": 20 },
"reward": { "asset_code": "USDC", "amount": 0.5 }
}
},
{ "key": "accept", "node_key": "data_accept", "params": { "acceptance": { "mode": "manual" } } }
],
"next": [
{ "from": "gate", "to": "collect" },
{ "from": "collect", "to": "accept" },
{ "from": "accept", "to": "done" }
]
},
"reward_policy": {
"base": { "asset_code": "USDC", "amount": 0.5 },
"factors": [],
"caps": {}
},
"quotas": { "per_node": {}, "budget_usd": 100 },
"data_contract": { "scarcity_strata": [], "lineage": {} },
"audit": {
"intent": "Collect triage decisions for returned-goods cases.",
"versions": []
}
}In the collect step, task.totalCap is how many submissions the step takes from all contributors together, and task.perUserQuota is how many one contributor may make. Both count tasksA specific item a contributor claims or enters in progress and submissions waiting for review. A submission that is rejected or found to be a duplicate stops counting, which frees its place. reward.amount is what one accepted submission pays.
In the accept step, acceptance.mode set to manual holds every submission until a person reviews it. Without that setting the step accepts each submission when it arrives.
hbd campaign init --template writes the same sections and steps, including task and acceptance, with a <DECIDE: …> placeholder in place of each value you must decide. Each starter step includes its node_version.
Reference names that already exist
Some values in a step must be names that already exist on the platform or in your organization: step types, acceptance checks, dedup keys, agreements, agents, and teams. Each operation below lists the names of one kind. candidatevalidate does not check these names against their lists. An API launch refuses a step type the node catalog does not have; a wrong name of another kind surfaces when its step runs. Look the name up before you write it.
| Value | Where it goes in the Campaign File | Operation that lists the names |
|---|---|---|
| Step type | Each step's node_key, with its version in node_version | nodecatalog |
| Acceptance check | params.acceptance.checks[].kind on a data_accept step | checkkinds |
| Dedup key | params.dedupFields[].dedup_key on a data_uniqueness step | dedupkeys |
| Agreement | params.required.agreements[] on the access_gate step | agreementcatalog |
| Agent | params.agent on an agent_task step | installedagents |
| Team | params.team_access.teams[] on the access_gate step | teamdirectory |
| Academy course | params.required.academy[] on the access_gate step | The CLI's Academy course commands |
Every response carries referenced_at. Its path is the field in the Campaign File and step the kind of step. entry_field names the field of each listed entry to copy there, as it is.
An organization API key reads its own organization; a signed-in person reads the organization they belong to. A person outside that organization is refused with ORG_MEMBERSHIP_REQUIRED, and an account the Developer portal has not admitted with DEVELOPER_NOT_ADMITTED.
nodecatalog lists one version per step type and prefers the newest version available for authoring. Each entry includes the parameter structure params_schema, the default_params the Portal fills in for a new step, and examples. A step added on the Portal canvas records that version; a step without node_version runs version 1.0. New workflow versions record the resolved revision for each step. Previously saved workflow versions keep their original contents.
If a node lists entries in step_presets, you can choose one for that step. Copy its key and version into the step’s preset field. For example, use "preset": {"key": "label", "version": "1"} to select the Label preset for a human_supply step.
The service fills in the preset’s defaults before execution. If you override a field listed in locked_fields, candidatevalidate identifies the locked field. Remove the override to use the preset’s value. A published workflow retains the selected preset version.
A workflow pinned to Sink data_sink@1.1 receives a lives_in receipt after the record is stored. It gives the Humanbased pipelineThe steps a Campaign's work passes through, built in Builder and, once registered, the campaign dataset and its collection. deliveries is empty for storage on Humanbased. Sink 1.0 returns stored as before.
checkkinds lists the checks an acceptance step can run. Set acceptance.mode to checks and give each check a unique id, its kind, and the keys that kind lists under required; on_fail is reject or downgrade.
configured_in says where each check is configured: accept checks here, form checks in the form template, dedup checks in the dedup step, and agent checks through an agent_judgement check.
dedupkeys lists the dedup keys your organization registered in the Portal; data_type says whether a key is for text (text) or files (file). Dedup steps in different Campaigns that name the same key check for duplicates in the same pool.
agreementcatalog lists the platform agreements an entry step can require. It only reads; it signs nothing. required.agreements takes the agreement_id; the slug only tells you which agreement it is. The Portal's entry step always requires the Contributor Master Agreement: the two agreements with the slugs platform-contributor-master-agreement and platform-business-contributor-master-agreement, of which a contributor is bound by the one for their individual or business status.
A Campaign File does not need to name them. candidateplan and candidateapply add the master agreements present in the platform catalog to every access_gate step that does not already require them, after the agreements you list, and the plan's changes show the addition. An API launch checks drafts stored through candidateapply, including retries after a failed launch. It refuses a draft that would still let contributors join without those agreements: MASTER_AGREEMENT_MISSING names the gate, or the contributor steps that have no gate in front of them.
installedagents lists the agents your organization wired in from the Agent Exchange that a step can name by slug. Both params.agent on an agent_task step and the agent of an agent_judgement check take the slug; each agent's input slots, and what fills each one, are in input_schema.
Leave params.lane out of a regular Agent Task to use the built-in runtime. If your organization has a dedicated runtime, check that a worker can claim the Campaign's tasks before setting its params.lane. For job or sandbox, set params.image to image-name@sha256:<digest>. Saving with only an image tag fails. The validation details identify the step that needs a digest. Queued tasks keep the runtime they started with.
teamdirectory searches the published teams by name and answers one page at a time. q is part of a name and limit is 1 to 50, 10 by default. While has_more is true, pass next_cursor back as cursor.
Each team carries a team_access_entry, {team_id, name}, which goes into team_access.teams as it is.
Each entry in required.academy for an Academy course carries program_key (the course's program ID), program_version_id (a published version), and state (completed or mastered).
Validate and plan a candidate
Both operations read; neither writes. Save the document above as candidate.json in a private working directory, then build the two request bodies for a new Campaign:
python3 - <<'PY'
import json
from pathlib import Path
candidate = json.loads(Path('candidate.json').read_text())
Path('validate.json').write_text(json.dumps({'candidate': candidate}))
Path('plan.json').write_text(json.dumps({'mode': 'create', 'candidate': candidate}))
PYTo plan a change instead, set HB_CAMPAIGN_ID to a Campaign the Key may edit and read its latest version:
curl --fail-with-body --silent --show-error --get \
'https://api.humanbased.ai/api/v1/campaignapi/version' \
--header "Authorization: Bearer $HB_API_KEY" \
--data-urlencode "campaign_id=$HB_CAMPAIGN_ID" \
--output version.jsondata.version.version_number and data.version.spec_hash identify the base. data.campaign_file is the complete stored document, and data.server_assigned_fields names the keys under campaign that a candidate must leave out. This illustrative edit changes only the name:
python3 - <<'PY'
import json
from pathlib import Path
response = json.loads(Path('version.json').read_text())
assert response['success'] and response['data']['campaign_file']
data = response['data']
candidate = data['campaign_file']
for field in data.get('server_assigned_fields', []):
candidate['campaign'].pop(field, None)
candidate['campaign']['name'] = 'Reviewed example name'
Path('validate.json').write_text(json.dumps({'candidate': candidate}))
Path('plan.json').write_text(json.dumps({
'mode': 'update', 'campaign_id': data['campaign_id'],
'candidate': candidate,
'expected_version_number': data['version']['version_number'],
'expected_spec_hash': data['version']['spec_hash'],
}))
PYSend either pair of bodies the same way:
curl --fail-with-body --silent --show-error \
'https://api.humanbased.ai/api/v1/campaignapi/candidatevalidate' \
--header "Authorization: Bearer $HB_API_KEY" \
--header 'Content-Type: application/json' --data-binary @validate.json \
--output validation.json
curl --fail-with-body --silent --show-error \
'https://api.humanbased.ai/api/v1/campaignapi/candidateplan' \
--header "Authorization: Bearer $HB_API_KEY" \
--header 'Content-Type: application/json' --data-binary @plan.json \
--output plan-result.json| File | Check | Meaning |
|---|---|---|
validation.json | data.valid | true when every check passed. |
validation.json | data.checks | One entry each for schema, compile, and dependencies, with ran, passed, and violations. A violation names a path, a stable code, and a message. |
validation.json | data.candidate_hash | The identity of the document you sent. |
plan-result.json | data.applicable | true when the candidate is valid and, for a change, the base version is still a draft and the change keeps a launched Campaign's budget and AI disclosure terms. |
plan-result.json | data.base | The version the plan compared against; null for a new Campaign. |
plan-result.json | data.changes, data.change_count | Each change as op (add, remove, or replace), path, and before or after. |
plan-result.json | data.findings | The same validation result. A plan for a change adds a launch_budget check, which fails with BUDGET_LOCKED_AFTER_DRAFT when the candidate would change a launched Campaign's budget, and a launch_disclosure check, which fails with DISCLOSURE_LOCKED_AFTER_DRAFT when it would change a launched Campaign's AI disclosure terms. |
A plan with applicable: false is not ready to apply. If the base version or hash has moved, the plan is refused with BASE_VERSION_STALE: read the new version and review a new candidate and plan.
When launch_budget or launch_disclosure fails, data.findings.valid is false while candidatevalidate can still call the file valid. The file itself is sound; this Campaign will not take the budget or disclosure change. For how a launched Campaign's budget grows, see Apply a change to a draft.
Create a Campaign
After the accountable person approves the document, add a request_key to the create plan body and send it to candidateapply. Choose the key yourself: a stable string of up to 200 characters that names this one write.
python3 - <<'PY'
import json
from pathlib import Path
body = json.loads(Path('plan.json').read_text())
assert body['mode'] == 'create'
body['request_key'] = 'create-returns-triage-2026-10-10'
Path('apply.json').write_text(json.dumps(body))
PY
curl --fail-with-body --silent --show-error \
'https://api.humanbased.ai/api/v1/campaignapi/candidateapply' \
--header "Authorization: Bearer $HB_API_KEY" \
--header 'Content-Type: application/json' --data-binary @apply.json \
--output receipt.jsonA create body holds mode, candidate, and request_key. It names no campaign_id and no expected base.
One create performs these steps in order, under the one request_key:
| Step | Effect |
|---|---|
| Allocate | A draft Campaign in the Key's organization, owned by the person who created the Key, with the budget from quotas.budget_usd. |
| Provision | The Campaign's Pipeline, holding only an entry gate. A launch writes your draft's steps into it. |
| Store | The document, as version 1 in the draft state. |
| Grant | The new Campaign is added to the Key's managed_campaign_ids, so the same Key can change and launch it. granted_to_key reports whether this step landed. |
The response is a receipt. Hashes are shortened in this illustration:
{
"data": {
"replayed": false,
"action_id": "784210008001",
"action": "campaignfile.apply",
"status": "succeeded",
"request_key": "create-returns-triage-2026-10-10",
"request_hash": "5d0c…a917",
"campaign_id": "784210001001",
"result": {
"campaign_id": "784210001001",
"external_pipeline_id": "784210011001",
"file_version_id": "784210007001",
"version_number": 1,
"persisted_file_hash": "8a41…c2f0",
"state": "draft",
"granted_to_key": true
}
},
"success": true,
"errorCode": 0,
"errorMessage": "SUCCESS"
}Keep data.campaign_id: every later operation names it. data.result.granted_to_key: false means the Campaign exists and this Key was not given it; change it in the Developer portal or with a replacement Key that names it. To confirm the create, read GET /api/v1/campaignapi/campaign?campaign_id=<campaign_id> and check that data.campaign.status is draft.
persisted_file_hash differs from the candidate_hash you validated, because the stored document includes the server-assigned fields.
Apply a change to a draft
Add a request_key to the update plan body and send it to the same operation. An update body holds mode, campaign_id, candidate, expected_version_number, expected_spec_hash, and request_key.
A successful update stores a new draft version built from the candidate. A draft Campaign's budget becomes the candidate's quotas.budget_usd, the amount a launch reserves. When the candidate includes disclosure, those terms become the Campaign's terms. When it omits the section, the server carries the Campaign's current terms into the saved version. The receipt has the shape shown above; data.result.version_number is the new version, and data.result carries no granted_to_key.
Once a Campaign is launched, only its owner can raise the budget, with Increase budget in the Developer portal. An update whose budget differs from the Campaign's current budget is refused with 409 and BUDGET_LOCKED_AFTER_DRAFT, and nothing is written.
A launched Campaign's AI disclosure terms are what its contributors agreed to work under. An update whose disclosure section would change them is refused with 409 and DISCLOSURE_LOCKED_AFTER_DRAFT, and nothing is written. Leave the section out to keep the current terms.
Both pins are compared again at the moment of the write. If another editor saved first, the request is refused with 409 and BASE_VERSION_STALE, and nothing is written: read the new version, rebuild the candidate, and plan again.
Read the receipt and recover
A 200 from candidateapply is always a receipt with status: succeeded. Any other outcome arrives as an error response; the receipt lookup below shows the other three statuses.
| Receipt field | Meaning |
|---|---|
replayed | true when this response describes an earlier attempt under the same request_key, not work done now. A receipt lookup always returns true, whatever that attempt's status. |
action_id | The server's identifier for this write. |
action | campaignfile.apply for a Campaign File create or update; campaign.details.update for a change to what Contributors see. |
status | succeeded, in_progress, failed, or uncertain. |
request_key, request_hash | Your key, and the server's hash of the whole request. |
campaign_id, result | The Campaign written, and what the write produced. |
steps, uncertain_reason | Present while a write is unresolved or failed: how far it got, and why the outcome is unknown. |
in_progress_since | Present while status is in_progress: when the write last made progress. |
The request_key is what makes a retry safe. Keep the request body and its key together, and decide by what the retry returns:
| You see | What happened | What to do now |
|---|---|---|
| No response at all | The write may or may not have landed. | Read GET /api/v1/campaignapi/actionreceipt?request_key=<your-key>, or resend the identical body with the same key. |
A receipt with replayed: true and status: succeeded | The first attempt succeeded; nothing was written again. | Use this receipt. |
409 ACTION_IN_FLIGHT, or a receipt with status: in_progress | A request is still writing under this key. | Wait, then read the receipt. If it is still in_progress ten minutes after in_progress_since, resend the identical body with the same key. |
409 REQUEST_KEY_SPENT, or a receipt with status: failed | The earlier attempt failed and wrote nothing. | Fix the cause and send again with a new key. |
409 REQUEST_KEY_REUSED | This key already named a different request. | Send the original body to retry it, or choose a new key for the new request. |
409 ACTION_UNCERTAIN, or a receipt with status: uncertain | A write was attempted and its outcome is unknown. | Stop. A person reads the receipt's steps, which name any Campaign a create already allocated, and the Campaign's current version before deciding. A new key would be a second write. |
actionreceipt takes exactly one of request_key or action_id. A lookup by request_key searches Campaign File applies unless you add action=template.apply, action=campaign.details.update, action=campaign.pause, action=campaign.resume or action=campaign.inputs.import. It does not find a launch.
Change what Contributors see about a Campaign
The name, brief, description, cover, tutorials, and appearance a Contributor sees on the Campaign page are not in the Campaign File. They are what the Developer portal edits under Setup → Campaign details and Setup → Appearance. Read them with campaigndetails:
curl --fail-with-body --silent --show-error \
'https://api.humanbased.ai/api/v1/campaignapi/campaigndetails?campaign_id=784210001001' \
--header "Authorization: Bearer $HB_API_KEY"{
"data": {
"contract_version": "campaign-read.v1",
"campaign_id": "784210001001",
"status": "draft",
"name": "Returns triage, round 1",
"brief": "Write a triage conclusion for each return case",
"description": "## What to do\n\nRead each return case and choose its triage conclusion.",
"cover_url": "https://static.humanbased.ai/campaign/image/2026/10/16/3f9c2a7e5b1d4c08a6e2f1b7c9d0e4a2.png",
"tutorials": [
{
"title": "Reading a return case",
"video_url": "https://static.humanbased.ai/campaign/video/2026/10/16/8b1e4f0c2d7a4e96b3c5a0f9d2e7c1b4.mp4",
"thumbnail_url": null,
"order": 1
}
],
"theme": { "density": "compact" },
"theme_resolved": { "brand": { "accent": "#1F4FD8" }, "density": "compact" }
},
"success": true,
"errorCode": 0,
"errorMessage": "SUCCESS"
}| Field | Contents |
|---|---|
name, brief | The Campaign's name, and the one-line summary on its card. |
description | The public Markdown description on the Campaign page. |
cover_url | The cover image's address. |
tutorials | Tutorial videos, each with title, video_url, thumbnail_url, and order. |
theme | This Campaign's own appearance settings, or null when it sets none. |
theme_resolved | The Campaign's settings laid over the organization's brand settings: the appearance written into tasks at the next pipeline save. |
Change them with campaigndetailsupdate. The body carries campaign_id, request_key, and the fields to change; a field you leave out keeps its value. tutorials and theme replace the stored value whole, so send the full list even to change one tutorial. A new name is written into the Campaign File too, as a new version, so the next candidateapply update takes that version as its base.
curl --fail-with-body --silent --show-error \
'https://api.humanbased.ai/api/v1/campaignapi/campaigndetailsupdate' \
--header "Authorization: Bearer $HB_API_KEY" \
--header 'Content-Type: application/json' \
--data '{"campaign_id": "784210001001", "request_key": "details-returns-triage-2026-10-18", "brief": "Write a triage conclusion and its reason for each return case"}'{
"data": {
"replayed": false,
"action_id": "784210008002",
"action": "campaign.details.update",
"status": "succeeded",
"request_key": "details-returns-triage-2026-10-18",
"request_hash": "c37e…9b02",
"campaign_id": "784210001001",
"result": {
"campaign_id": "784210001001",
"written": { "brief": "Write a triage conclusion and its reason for each return case" }
}
},
"success": true,
"errorCode": 0,
"errorMessage": "SUCCESS"
}data.result.written lists the fields this write stored.
The cover is not set by address. Send cover_file_id, the file ID of an uploaded image: uploaded publicly under the cover or campaign category by a member of this organization. The receipt's written.cover_url is the address stored.
The appearance a Contributor sees in a task is the one recorded when the pipeline was saved. After you change theme, it takes effect when the pipeline is next saved in the Developer portal.
If a field breaks a rule the portal enforces (DETAILS_INVALID) or the cover cannot be used (COVER_FILE_UNUSABLE), nothing is written and the request_key is not spent, so you can send the corrected request under the same key. If the file service does not answer while the cover is checked (FILE_SERVICE_UNAVAILABLE), nothing is written either: send the same request again. Every other retry follows Read the receipt and recover; to look one of these receipts up by key, add action=campaign.details.update.
Launch a Campaign
A launch moves a draft Campaign to live and locks its budget from the organization's balance. A Key cannot decide that alone: the Key proposes, a person confirms the exact proposal, and the Key executes it.
Before you propose, check five things:
| Precondition | Where it is decided |
|---|---|
The Key holds campaign:launch and the Campaign is in its managed_campaign_ids. | The Key's grant, read with whoami. |
| The latest stored version has a step where work enters, and every contributor step has a form. | The Campaign File. |
| The Campaign has a budget, and the organization's available balance covers it. | The proposal's amount_usd, and the organization's Billing page. |
| The budget fits the room left under the Key's spend cap. | The cap set when the Key was created. |
| Every step's type is one the node catalog has, and every entry gate requires the Contributor Master Agreement. | readiness: its node_types and master_agreements checks. An apply adds the agreement. |
1. Propose
curl --fail-with-body --silent --show-error \
'https://api.humanbased.ai/api/v1/campaignapi/launchpropose' \
--header "Authorization: Bearer $HB_API_KEY" \
--header 'Content-Type: application/json' \
--data "{\"campaign_id\": \"$HB_CAMPAIGN_ID\"}" \
--output proposal.jsonA proposal writes one record. No money moves and the Campaign does not change. Save the response: it is the only place the proposal_id is returned.
{
"data": {
"proposal_id": "784210010001",
"campaign_id": "784210001001",
"operation": "launch",
"state": "proposed",
"amount_usd": "100.0000",
"base_version_number": 1,
"base_spec_hash": "8a41…c2f0",
"proposal_hash": "clp1_77be…09d3",
"expires_at": "2026-10-10T10:30:00+00:00",
"confirmed_by": null,
"confirmed_at": null,
"executed_action_id": null
},
"success": true,
"errorCode": 0,
"errorMessage": "SUCCESS"
}amount_usd is the budget the launch would commit, as a string with four decimal places. base_version_number and base_spec_hash name the draft it would run. proposal_hash binds all of them together. expires_at is one hour after the proposal was made; confirmation and execution both have to happen before it.
A Key holds one open proposal per Campaign. A second launchpropose for the same Campaign is refused with PROPOSAL_OPEN_ALREADY until the first is executed or expires.
2. A person confirms
Send the person who owns the decision to the Developer portal's confirmation page:
https://developer.humanbased.ai/campaigns/<campaign_id>/launch/confirm?proposal=<proposal_id>They sign in as an editor or owner of that Campaign. The page shows the Campaign, the amount, the draft version, the expiry, and the proposal hash as the server holds them. Selecting Confirm this launch records their agreement to that exact hash. It does not launch.
Read GET /api/v1/campaignapi/launchproposal?proposal_id=<proposal_id> with the Key that proposed. Continue when data.state is confirmed.
3. Execute
python3 - <<'PY'
import json
from pathlib import Path
proposal = json.loads(Path('proposal.json').read_text())['data']
Path('launch.json').write_text(json.dumps({
'proposal_id': proposal['proposal_id'],
'request_key': 'launch-returns-triage-2026-10-10',
}))
PY
curl --fail-with-body --silent --show-error \
'https://api.humanbased.ai/api/v1/campaignapi/launch' \
--header "Authorization: Bearer $HB_API_KEY" \
--header 'Content-Type: application/json' --data-binary @launch.json \
--output launch-receipt.jsonThe body holds proposal_id and a request_key you choose. Only the Key that proposed may execute. Before any money moves, the server recomputes the proposal hash from the Campaign as it is now. A budget, draft, or payment term changed after the confirmation makes the launch a different action, and it is refused with PROPOSAL_STALE.
A successful launch returns a receipt with action: campaign.launch and status: succeeded. Its data.result holds campaign_id, the Campaign's new status, the proposal_id, and confirmed_by.
Confirm or recover a launch
| You see | What happened | What to do now |
|---|---|---|
A receipt with status: succeeded | The Campaign launched and its budget is locked. | Confirm with GET /api/v1/campaignapi/campaign: data.campaign.status is live. The proposal's state is executed. |
| No response at all | The launch may or may not have run. | Resend the identical body with the same request_key. The server replays the first receipt and launches nothing twice. actionreceipt?request_key= does not find a launch. |
PROPOSAL_NOT_CONFIRMED | No person has confirmed yet. | Ask the person to confirm, then send the same body again. |
PROPOSAL_EXPIRED or PROPOSAL_REVOKED | The proposal is closed. | Propose again and have the new proposal confirmed. |
PROPOSAL_STALE | The Campaign changed after confirmation, or an earlier publication was recovered. | Read launchproposal. If state is revoked, propose again and have a person confirm the new proposal. If it remains confirmed, wait until expires_at before proposing again. |
SPEND_CAP_EXCEEDED | The launch would exceed the Key's spend cap. No money moved. | Have a person launch the Campaign in the Developer portal, or propose again with a Key whose cap has room. |
CAMPAIGN_GRAPH_MALFORMED | The draft cannot run as stored: the Pipeline refused its steps, or a form template it names is missing or empty. No money moved. | Apply a corrected draft. Propose again once this proposal's expires_at has passed. |
CAMPAIGN_GRAPH_UNKNOWN_NODE | A step names a node type the node catalog does not have; the message names the step and the type. No money moved. | Correct the type from nodecatalog and apply the draft. Propose again once this proposal's expires_at has passed. |
MASTER_AGREEMENT_MISSING | Contributors would join without the Contributor Master Agreement: an entry gate does not require it, or no entry gate stands in front of the contributor steps. No money moved. | Apply the draft again, after adding an access_gate step if it has none; the apply adds the agreement. Propose again once this proposal's expires_at has passed. |
503 CAMPAIGN_GRAPH_UNAVAILABLE | The Pipeline did not take the draft. No money moved, and the Campaign is not live. | Send the launch again with a new request_key. The proposal is still confirmed. |
PROPOSAL_ALREADY_EXECUTED | This proposal already ran, or is running. | Read the proposal and the Campaign's status. Launch nothing again. |
409 ACTION_UNCERTAIN | The launch was attempted and its outcome is unknown; the budget may be locked. | Stop. Read launchproposal: executed means the launch finished, executing means it is unresolved. A person checks the Campaign's status and the organization's Billing page, then contacts support@humanbased.ai with the proposal_id. A new key would be a second launch. |
Describe a candidate's pay range
POST /api/v1/campaignapi/candidatefeasibility needs campaign:author. It describes the candidate without writing or admitting it. Send the same full Campaign File you intend to validate.
| JSON body field | Type | Required |
|---|---|---|
candidate | object | Yes; the complete Campaign File. |
crs | integer or null | No; omit it for the range across the candidate's admitted reputation scores. |
The validate.json created above already contains candidate and can be reused:
curl --fail-with-body --silent --show-error \
'https://api.humanbased.ai/api/v1/campaignapi/candidatefeasibility' \
--header "Authorization: Bearer $HB_API_KEY" \
--header 'Content-Type: application/json' --data-binary @validate.json \
--output feasibility.jsonRead these fields under data:
| Field | Type and meaning |
|---|---|
contract_version, candidate_hash, as_of, decided_by | Strings identifying the contract, candidate, calculation time, and source of the answer. |
crs | The integer score requested, or null for the candidate-wide range. |
pay_line | Object with string asset_code, minimum, maximum, and source, or null when no range can be quoted. Monetary bounds are strings. |
pay_line_unavailable_because | String explaining a missing quote, or null. |
assumptions | Array of strings to read with the range. The quote precedes the platform fee and individual reputation multiplier. |
unavailable | Array of objects with string measure and because. Contributor-pool size, completion time, and maximum spend have no estimate. |
authoritative | Boolean, always false: this result does not authorize a write or launch. |
A missing estimate is not zero. Continue with candidatevalidate and candidateplan; a successful feasibility request does not establish that the candidate is valid or affordable. For CANDIDATE_MALFORMED or CANDIDATE_TOO_LARGE, correct the document before retrying.
Validate and save a form template
Both POST /api/v1/campaignapi/templatevalidate and POST /api/v1/campaignapi/templateapply need campaign:author. Validation writes nothing. Apply creates or updates a template and records a receipt; it does not launch a Campaign or reserve its budget.
| JSON body field | Type | Validation | Apply |
|---|---|---|---|
template | object | Required whole template document. | Required whole template document. |
org_id | string or null | Required for a signed-in session; ignored for a Key, which uses its own organization. | Same. |
template_id | string or null | Not used. | Omit to create; supply to update. |
expected_template_hash | string or null | Not used. | Required for update; forbidden for create. |
request_key | string | Not used. | Required nonblank string of 1–200 characters, naming this one write. |
A session caller must be an admitted Developer and a current member of the organization. The template has kind (form or labeling) and a nonblank string name. Send exactly one of the objects master_json or form_schema; labeling requires a nonempty master_json. Optional fields include string description, array of strings modalities, object sample_task, and string source_template_id. Remove server-assigned fields such as template_id and org_id from inside the template document.
For example, save this illustrative validation body as template-validate.json. Use editable_in_builder from the target environment to check whether its Builder supports the document’s authoring format. Versions with native form editing can open a form_schema whose schema is an object and keep its original controls and validation rules. This flag is separate from validation success; check valid and checks before saving.
{
"template": {
"kind": "form",
"name": "Sentence category",
"form_schema": {
"schema": {
"type": "object",
"properties": {
"sentence": {"type": "string"},
"category": {"type": "string", "enum": ["question", "statement"]}
},
"required": ["sentence", "category"]
},
"uiSchema": {}
}
}
}curl --fail-with-body --silent --show-error \
'https://api.humanbased.ai/api/v1/campaignapi/templatevalidate' \
--header "Authorization: Bearer $HB_API_KEY" \
--header 'Content-Type: application/json' --data-binary @template-validate.json \
--output template-validation.jsonA successful HTTP response can contain data.valid: false. Inspect the validation payload before saving:
Field under data | Type and use |
|---|---|
valid | Boolean: the overall validation result. |
checks | Array of objects with string check, booleans ran and passed, and violations. Each violation has string path, code, and message. A skipped check (ran: false) did not pass. |
validator_version, template_hash | Strings identifying the validator and authored document. |
editable_in_builder | Boolean indicating editing-format compatibility in the target version; not validation success or permission to edit. |
server_assigned_fields | Array of field-name strings the document must leave out. |
compiled_form_schema | Object or null; the rendered form produced from the authored document when compilation applies. |
After reviewing a valid result, prepare template-apply.json with the same template and a new request_key. For an update, first read GET /api/v1/campaignapi/template?template_id=<TEMPLATE_ID> with campaign:read, then include that ID and its data.template_hash as expected_template_hash. Do not send an expected hash for a create.
curl --fail-with-body --silent --show-error \
'https://api.humanbased.ai/api/v1/campaignapi/templateapply' \
--header "Authorization: Bearer $HB_API_KEY" \
--header 'Content-Type: application/json' --data-binary @template-apply.json \
--output template-receipt.jsonA successful receipt has data.action: "template.apply", data.status: "succeeded", string action_id and request_key, and boolean replayed. data.result contains string template_id and template_hash, plus booleans created and editable_in_builder. Save the request body and receipt together; use the returned template ID in the Campaign File. A replay retains the original write’s receipt; run templatevalidate again to check compatibility with an upgraded Builder.
| Result | Recovery |
|---|---|
TEMPLATE_INVALID | Fix the violations in errorMessage.checks; these findings are directly inside errorMessage, unlike CANDIDATE_INVALID. |
TEMPLATE_STALE | Read the template again, review the newer document, and send its hash with the revised update. |
TEMPLATE_NOT_EDITABLE | Adopt the visible public template into your organization, then edit that copy. |
TEMPLATE_KIND_IMMUTABLE | Create a new template for a different kind. |
| A lost response | Resend the identical body and request_key, or read actionreceipt?request_key=<REQUEST_KEY>&action=template.apply with the credential that wrote it. |
ACTION_IN_FLIGHT | Inspect the receipt and wait. After ten minutes without progress, retry the identical request; it returns the winning receipt or reports a spent key. |
REQUEST_KEY_SPENT | The attempt committed no template. Use a fresh key for a new attempt. |
REQUEST_KEY_REUSED | The key already names another body. Recover that receipt before deciding whether another write is needed. |
Read an outcome window
GET /api/v1/campaignapi/observation and GET /api/v1/campaignapi/outcomebreakdown need campaign:read. Both read only. The first gives counts and denominators; the second also explains reasons, grades, steps, and versions.
| Query parameter | Type | Required |
|---|---|---|
campaign_id | string | Yes. |
from | ISO-8601 string with timezone | Yes; inclusive start. |
to | ISO-8601 string with timezone | Yes; exclusive end, after from. |
pipeline_version_id | string | No; omit to pool all pipeline versions. |
Choose a window that includes the work you want to inspect. This example uses UTC; replace its illustrative dates and Campaign ID. Neither operation uses pagination.
curl --fail-with-body --silent --show-error --get \
'https://api.humanbased.ai/api/v1/campaignapi/observation' \
--header "Authorization: Bearer $HB_API_KEY" \
--data-urlencode "campaign_id=$HB_CAMPAIGN_ID" \
--data-urlencode 'from=2026-10-01T00:00:00Z' \
--data-urlencode 'to=2026-10-02T00:00:00Z' \
--output observation.jsonUse outcomebreakdown with the same query to explain those results. Inspect these fields under data before comparing windows:
| Field | Type and meaning |
|---|---|
contract_version, campaign_id, observed | Strings identifying the contract and Campaign, and a boolean indicating whether there is a pipeline to observe. |
reason | String when observed is false; measurements can be absent in this case. Read it as unobserved, not a measured zero. |
window | Object with string from, to, bounds ([from, to)), and a clocks object mapping each count family to its event clock. |
pipeline_version, isolated | Version object or null, and boolean indicating whether one version was isolated. False pools versions. |
campaign_file_version, campaign_file_version_unbound_because | Integer version or null, and a string explaining why there is no single bound Campaign File version. Do not substitute the latest draft. |
arrivals, outcomes, denominators | Objects mapping count names to integers. Check the denominator and clock before calculating a rate. |
inclusion_rules, unavailable | Array of rule strings, and an object mapping unavailable measures to their explanations. |
Measurement fields may be absent or null. outcomebreakdown adds objects reasons, quality_grades, dedup, timeline, review_latency_seconds, and backlog; arrays of objects steps and versions; and an integer-valued contributors object. These additions may also be absent or null. Read the returned names and meanings; contributors are counted, not named. backlog is the queue now, even for a historical window. Timeline buckets use UTC days, or weeks for windows longer than 62 days, and omit empty buckets.
For OBSERVATION_WINDOW_INVALID, fix the named time or filter; for PIPELINE_VERSION_NOT_FOUND, select a version of this Campaign. Retry a read after OBSERVATION_OWNER_UNAVAILABLE. If OBSERVATION_OWNER_DISAGREES persists, contact support@humanbased.ai with the Campaign ID, window, and sanitized error.
Inspect samples in the portal
To inspect work behind the counts, open the Campaign's Reviews in the Developer portal. GET /api/v1/campaignapi/submissionsamples is a portal-session read requiring at least viewer access to that Campaign. An organization Key receives DEVELOPER_SESSION_REQUIRED; a signed-in CLI receives CLI_SESSION_NOT_PERMITTED. Use aggregate reads above in key-based programs.
The route accepts the same window parameters, plus optional result (approved, rejected, or duplicate), string reason of at most 120 characters, and integer limit from 1 to 10 (default 6). Its payload extends the observation fields with samples, an array of objects or null. Samples may contain submission_id, result, reason, source, grade, step, result time, and content or a withholding reason. Content can be redacted or withheld; the response does not name contributors.
Errors
A refusal from these routes has success: false, data: null, and an errorCode equal to the HTTP status. Use errorCodeName when present and keep a fallback for errors from the gateway, which may omit it. errorMessage is usually prose and can be reworded. For CANDIDATE_INVALID it is an object instead, carrying the validation result:
{
"data": null,
"success": false,
"errorCode": 400,
"errorCodeName": "CANDIDATE_INVALID",
"errorMessage": {
"error": "CANDIDATE_INVALID",
"message": "the candidate did not pass validation, so nothing was applied",
"findings": {
"valid": false,
"checks": [
{"check": "schema", "ran": true, "passed": false, "violations": [{"path": "…", "code": "…", "message": "…"}]}
],
"candidate_hash": "…"
}
}
}findings is the object candidatevalidate returns in data; the example shortens it. Check whether errorMessage is a string before you print it.
errorCodeName | What happened | What to do now |
|---|---|---|
KEY_CAPABILITY_MISSING | The Key lacks the grant this operation needs. | Create a Key with that grant. |
KEY_HAS_NO_CAMPAIGN_ALLOWLIST | The Key can read the organization's Campaigns and names none it may change. | Create a replacement Key with the write grant. |
KEY_HAS_NO_ACCOUNTABLE_PERSON | The Key records nobody who created it, so a Campaign it made would have no owner. | Create a replacement Key. |
KEY_CAMPAIGN_LIMIT_REACHED | This Key already names 100 Campaigns, so it cannot create another it could edit. Nothing was created. | Create a replacement Key before creating another Campaign. |
CAMPAIGN_NOT_FOUND | The Campaign does not exist, or this Key cannot see it. | Check the ID against campaigns and managed_campaign_ids. |
COST_WINDOW_INVALID | The cost window is not a valid half-open interval with timezone-aware ISO-8601 bounds. | Send from before to, both with timezones. |
COST_QUERY_TOO_LARGE | The bounded cost read cannot produce a complete report. | Narrow the window or request individual Campaigns. |
COST_OWNER_UNAVAILABLE | A cost owner did not finish before the request deadline; no partial report is returned. | Retry a narrower window or request individual Campaigns. |
COST_ORG_ROLE_REQUIRED | A signed-in person lacks a current organization billing, owner, or admin role. | Ask an organization owner or admin to grant the appropriate role. |
COST_KEY_CAMPAIGN_REQUIRED | A Key limited by managed_campaign_ids requested organization-wide totals. | Name one allowed campaign_id, or use an unrestricted billing Key. |
CANDIDATE_MALFORMED | The candidate is not a JSON object shaped like a Campaign File. | Fix the document's structure. |
CANDIDATE_TOO_LARGE | The candidate exceeds a size limit: 1,048,576 bytes, 20,000 JSON values, 64 nesting levels, 256 workflow nodes, or 1,024 edges. | Shrink the document. |
CANDIDATE_INVALID | The candidate was checked and failed. Nothing was applied, and the request_key is still unused. | Read errorMessage.findings, fix each path, and send again. |
EXPECTED_VERSION_REQUIRED, EXPECTED_SPEC_HASH_REQUIRED | An update did not pin its base. | Send both values from the version you read. |
EXPECTED_BASE_ON_CREATE | A create named a campaign_id or an expected base. | Remove them. |
REQUEST_KEY_REQUIRED | A write arrived with no request_key, or a blank one. | Choose a key and send it. |
CAMPAIGN_HAS_NO_VERSION | An update named a Campaign with no version to compare against. | Read the Campaign's versions before planning. |
BASE_VERSION_STALE | The base moved after you read it. | Read the new version, rebuild the candidate, and plan again. |
CONTENT_IS_HISTORICAL | This exact content is already an older version, and a newer one is current. Nothing changed. | Send a document that differs from that older version. |
STATUS_TRANSITION_INVALID | The Campaign's status does not allow this change: only a live Campaign can be paused, and only a paused one resumed. Nothing changed. | Read the Campaign's status first and choose the matching operation. |
CAMPAIGN_BUDGET_EXHAUSTED | The paused Campaign's reserved budget is used up, so work it took on would go unpaid. Nothing changed. | The Campaign's owner raises the budget with Increase budget in the Developer portal, then resumes it. |
CAMPAIGN_CLOSING | The Campaign is being finished. Nothing changed. | Only the Campaign's owner can cancel that, by resuming it in the Developer portal. |
BUDGET_LOCKED_AFTER_DRAFT | The update would change a launched Campaign's budget. Nothing was written. | Send the candidate with the Campaign's current budget; to add budget, the Campaign's owner uses Increase budget in the Developer portal. |
DISCLOSURE_LOCKED_AFTER_DRAFT | The update would change a launched Campaign's AI disclosure terms. Nothing was written. | Send the candidate with the Campaign's current disclosure section, or leave the section out to keep the terms. |
PLATFORM_NOT_CONFIGURED | The platform is missing configuration a create needs. Nothing was created. | Contact support@humanbased.ai; a retry will not help. |
DEVELOPER_SESSION_REQUIRED | A Key called an operation only a signed-in person may make: launchconfirm, campaignpause, campaignresume, submissionsamples or inputimport. | Have a person confirm the launch in the Developer portal; the Campaign's owner pauses or resumes it signed in; an editor imports a dataset from a signed-in terminal. Use the corresponding read grant for submissions, a dry run or the input dataset list. |
DEVELOPER_NOT_ADMITTED | The account has not been admitted to the developer workspace, so signed-in-person operations including submissions, submission, submissiondecide, submissionoverride, their receipts, checkdryrun, inputdatasets, inputimport, campaignprogress, and the six operations under "Reference names that already exist" refuse it as the Developer portal does. | Redeem an invite code in the Humanbased Portal, or sign in as an admitted account. |
PROPOSAL_NOT_FOUND | No such proposal, or another Key made it. | Use the Key that proposed, and the proposal_id it received. |
PROPOSAL_HASH_MISMATCH | The hash sent with a confirmation is not the stored proposal's. | Read the proposal again and confirm the hash it shows. |
SPEND_CAP_UNAVAILABLE | The Key may launch, and its spend cap could not be read. Nothing launched. | Send the same request again; if it persists, create a replacement Key. |
ACTION_NOT_FOUND | No receipt matches that action_id or request_key for this Key. | Check the handle and the action it belongs to. |
ACTION_LOOKUP_REQUIRED | A receipt lookup named neither, or both, of action_id and request_key. | Send exactly one of them. |
CAMPAIGN_GRAPH_NO_WORK_ORIGIN | The graph has no task or import node through which work can enter. | Add one, save a new version, and launch again. |
DETAILS_INVALID | A field breaks a rule the portal also enforces: a blank name, a tutorial address that is not HTTPS without credentials, or an appearance value that is not accepted, such as an accent color without enough contrast. Nothing was written. | errorMessage is an object; fix each entry in its problems and send again. |
COVER_FILE_UNUSABLE | cover_file_id does not name an image a member of this organization uploaded publicly under the cover or campaign category. Nothing was written. | Send the file ID of an image that qualifies. |
FILE_SERVICE_UNAVAILABLE | The file service did not answer, so the cover could not be checked. Nothing was written and the request_key was not spent. | Send the same request again. |
CAMPAIGN_ID_REQUIRED | The operation acts on one Campaign and none was named. | Send the campaign_id. |
CAMPAIGN_ROLE_INSUFFICIENT | Your role on this Campaign is below what the operation requires. | Ask the Campaign's owner for a role that allows it. |
CAMPAIGN_VERSION_NOT_FOUND | No such version of this Campaign. | Read versions and use a listed version. |
CLI_SESSION_NOT_PERMITTED | A signed-in CLI may not perform this operation. | For submissionsamples, open Reviews in the Developer portal; a Key is also refused. For a Key-enabled operation, use an organization Key with its required grant. |
CURSOR_INVALID | The cursor is not one this endpoint issued. | Start again without a cursor and follow the ones it returns. |
KEY_PRINCIPAL_INCOMPLETE | The gateway forwarded an incomplete Key identity. This is a platform fault, not a bad Key. | Retry; contact support@humanbased.ai if it persists. |
SLACK_DELEGATION_INCOMPLETE | The Slack session is missing its actor, organization, or binding. | Sign in through Slack again to establish a complete delegation. |
SLACK_BINDING_INACTIVE | The Slack identity binding is revoked or does not belong to this actor. | Re-link the Slack identity before retrying. |
SLACK_BINDING_STORE_UNAVAILABLE | The service cannot check Slack identity bindings because its binding store is not configured. | Contact support@humanbased.ai about this platform configuration; signing in again will not fix it. |
LIMIT_OUT_OF_RANGE | limit is outside the range this endpoint accepts. | Use a value in range, such as 1–200 for campaigns. |
MODE_UNSUPPORTED | The mode is not one this operation offers. | Use a mode the operation lists. |
OBSERVATION_OWNER_DISAGREES | This Campaign names a pipeline its owner does not have. This is a provisioning fault, not a bad request. | Contact support with the Campaign ID. |
OBSERVATION_OWNER_UNAVAILABLE | The service that owns these counts did not answer. The request was not refused. | Retry the read. |
OBSERVATION_REFUSED_BY_OWNER | The service that owns these counts refused the request without naming a reason. | Contact support with the Campaign ID and the time. |
OBSERVATION_WINDOW_INVALID | The observation window or pipeline version was refused; errorMessage quotes the value. | Correct that value and read again. |
SUBMISSION_REVISION_CHANGED | The submission changed after the revision you sent was read. Nothing was decided and the request_key was not spent. | Read it again with submission and decide on what it says now. |
SUBMISSION_ALREADY_DECIDED | The submission already has a verdict. | Read it again; to change the verdict, overturn it. |
SUBMISSION_NOT_DECIDABLE | The submission does not wait on a publisher's decision now: it has not reached its review step, or its pipeline decides it another way. | Read it again; can_decide says when it does. |
SUBMISSION_RULED_ON_APPEAL | The platform ruled on the contributor's appeal, and that ruling is final. Nothing changed. | Nothing to do; the ruling stands. |
SUBMISSION_NOT_DECIDED | The submission has no verdict yet, so there is nothing to overturn. | Decide it with submissiondecide. |
SUBMISSION_SAME_DECISION | The submission already has this verdict, at this rating. Nothing changed. | Nothing to do. |
SUBMISSION_PAYOUT_LOCKED | The submission's reward is paying out, has been paid, or its payment cannot be verified, so its verdict can no longer be changed. Nothing changed. | If the verdict was wrong, raise a dispute in the Developer portal. |
SUBMISSION_UNDER_DISPUTE | An open dispute holds this record's reward. Nothing changed. | Wait for the dispute to be settled, then overturn the verdict again. |
REAPPROVAL_BUDGET_UNAVAILABLE | Approving the submission again needs budget the Campaign cannot reserve. It stays rejected. | The Campaign's owner adds budget with Increase budget; then overturn it again. |
REVIEW_REASON_REQUIRED | A rejection arrived without a reason; a rating below the pass mark rejects too. Nothing was decided and the request_key was not spent. | Send a reason the contributor can act on. |
AUDIT_SAMPLES_REQUIRED | Sample gate for organizations with audit samples enabled: the draft lacks current, expected passing/rejection samples at first launch; launch returns HTTP 409. | Read checkevaluationreadiness, save the review configuration, run both kinds of sample, then launch. |
CHECK_NOT_RUNNABLE | A checkdryrun check could not run on the sample: the list of checks has a mistake, or the script raised an error. errorMessage quotes the evaluator, naming the check or the script's line. | Fix the check or the sample as the message says, and try again. |
SELF_IMPORT | inputimport named the dataset this Campaign's own pipeline made. Nothing was imported and the request_key was not spent. | Pick another dataset. |
DATASET_NOT_AVAILABLE | The dataset is not one the Campaign's organization manages, or does not exist; the answer is the same either way. Nothing was imported and the request_key was not spent. | Use one inputdatasets lists. |
SOURCE_PIPELINE_MISSING | The dataset's source Campaign has no readable pipeline. Nothing was imported and the request_key was not spent. | Pick another dataset. |
SOURCE_HAS_NO_RECORDS | The dataset's source Campaign has published no records yet. Nothing was imported and the request_key was not spent. | Pick another dataset, or wait for the source to publish records. |
SOURCE_RECORDS_EMPTY | Every record read carries no fields. Nothing was imported and the request_key was not spent. | Pick another dataset. |
PIPELINE_NOT_PROVISIONED | The Campaign's pipeline cannot take the records: it is not provisioned yet, or the pipeline service refused the first record, as the message says. Nothing was imported. | Retry once the pipeline can take records; if that answers REQUEST_KEY_SPENT, the attempt committed nothing, so use a new key. |
REVIEW_RATING_INVALID | The rating is outside the submission's rating_scale, or the submission has no single pass mark to score against. Nothing was decided. | Send a rating on the scale, or decide with decision instead. |
SUBMISSION_NOT_FOUND | No such submission on this Campaign, or it belongs to another Campaign; the answer is the same. | Check the submission ID; read the Campaign's list with submissions. |
REVIEW_OWNER_UNAVAILABLE | The service that holds the Campaign's submissions did not answer. Nothing was written. | Retry; contact support@humanbased.ai if it persists. |
CATALOG_OWNER_UNAVAILABLE | The service that holds the list did not answer, so nothing was listed. That is not an empty list. | Read again; contact support@humanbased.ai if it persists. |
AGREEMENT_CATALOG_UNAVAILABLE | The platform's agreement catalog did not answer, so the Contributor Master Agreement could not be added to the entry gate. Nothing was planned or applied, and the request_key was not spent. | Send the same request again; contact support@humanbased.ai if it persists. |
ORG_MEMBERSHIP_REQUIRED | The signed-in person is not a member of the organization; for a signed-in terminal, the one its sign-in was approved for, which the person may since have left. | Sign in again for an organization you belong to. |
CHECK_RUNNER_UNAVAILABLE | The service that runs acceptance checks did not answer, and the dry run judged nothing. | Retry; contact support@humanbased.ai if it persists. |
DATASET_INDEX_UNAVAILABLE | A service an import reads first did not answer: the one that knows which datasets an organization manages, or the one that holds their records. Nothing was read or written. | Retry. |
PIPELINE_TEMPORARY_UNAVAILABLE | The pipeline service failed before the import created anything: it could not be reached, or failed while the records were read. The attempt committed nothing. | Send it again; if that answers REQUEST_KEY_SPENT, use a new key. An import the pipeline service may have received answers ACTION_UNCERTAIN instead, even before its first record. |
ORG_ID_REQUIRED | The caller resolved to no organization, so there is nothing to read within. | Use a Key or sign-in that belongs to an organization. |
ORG_MISMATCH | This CLI session is signed in to a different organization than the request named. | Sign in to that organization, or drop the explicit organization. |
EXECUTION_BINDING_CONFLICT | A retained execution identity or its resolved content conflicts with a recorded association. Nothing was rebound. | Stop automatic retries. Contact support@humanbased.ai with the Campaign and publication references so the retained evidence can be reconciled. |
EXECUTION_BINDING_AMBIGUOUS | Several historical Campaign Files claim the same execution. None was selected. | Contact support@humanbased.ai with the Campaign and execution references. Resolve the association from retained publication evidence before starting new work. |
EXECUTION_BINDING_REQUIRED | This work's retained Campaign execution is incomplete, so new work cannot start. | The Campaign's owner publishes a complete binding; then start the work again. |
CLAIM_FUNDING_REQUIRED | This task requires a prepared funding reservation. | Start a new claim before submitting work. |
PIPELINE_VERSION_NOT_FOUND | That pipeline version does not belong to this Campaign's pipeline. | Use a version from this Campaign. |
PORTAL_SESSION_NOT_PERMITTED | A Developer portal login cannot propose or execute a launch through this API. | Launch from the Campaign page in the Developer portal, or propose and execute with the same organization API Key. A person confirms the proposal in the portal. |
REQUEST_MALFORMED | The request did not parse: a field is missing, of the wrong type, or out of range. | Read errorMessage, fix the field, and send again. |
SETTINGS_UNCHANGED | This campaign already has that setting. Nothing was written, and the request key was not spent. | The message names each field and the value it already holds. |
TEMPLATE_INVALID | The template was checked and something in it is wrong. | Fix each path-addressed finding, the same ones templatevalidate returns, and send again. |
TEMPLATE_KIND_IMMUTABLE | A template's kind is fixed when it is created. | Create a new template instead. |
TEMPLATE_MALFORMED | The body is not a template document at all. | Fix the request's structure. |
TEMPLATE_NOT_EDITABLE | This organization can read the template but not change it. | Adopt it into your organization, then edit the copy. |
TEMPLATE_NOT_FOUND | No such template, or none this organization may use. | Check the template ID. |
TEMPLATE_STALE | The template changed since you read it. | Read it again, apply your change to what it says now, and send it with the new hash. |
ACTION_IN_FLIGHT, ACTION_UNCERTAIN, REQUEST_KEY_REUSED, REQUEST_KEY_SPENT | A write under a request_key is still running, failed, ended with an unknown outcome, or the key already named a different request. | Follow the table in Read the receipt and recover. For ACTION_UNCERTAIN, stop and have a person check before anything is sent again. |
PROPOSAL_NOT_CONFIRMED, PROPOSAL_EXPIRED, PROPOSAL_REVOKED, PROPOSAL_STALE, PROPOSAL_OPEN_ALREADY, PROPOSAL_ALREADY_EXECUTED, SPEND_CAP_EXCEEDED, CAMPAIGN_GRAPH_MALFORMED, CAMPAIGN_GRAPH_UNKNOWN_NODE, MASTER_AGREEMENT_MISSING, CAMPAIGN_GRAPH_UNAVAILABLE | A launch proposal or its execution was refused. | Follow the refusal table in Launch a Campaign. |
A refusal raised before the request reaches this API, such as a 401 for a missing or invalid Key, can arrive without an errorCodeName. Keep a default branch for it. The same holds for 429 Too many requests from the gateway: wait Retry-After seconds, as described under Rate limits.
To launch from the Developer portal instead, see launch and budget checks.