API Reference

Processing status

GET /api/processing polls the processing pipeline progress after a paper submission.

After a paper is submitted, the repository enters a processing pipeline (code discovery, structuring, import, reproduction, verification, publishing, and other stages). GET /api/processing returns the repository's most recent processing job and its events, for polling progress.

Authentication

Identity is optional (browser session or x-api-key), but you need read permission on the repository. Without permission, the endpoint returns 404 {"error": "processing job not found"} — the same as when no job exists — so it does not reveal whether the repository has a job.

Request

Query parameters:

ParameterRequiredDescription
repositoryIdYesRepository ID, max 128 characters

Example

curl "https://citeark.com/api/processing?repositoryId=<repository-id>" \
  -H "x-api-key: $CITEARK_API_KEY"

Response

On success returns 200, with response header cache-control: private, no-store:

{
  "job": {
    "id": "…",
    "repositoryId": "…",
    "kind": "research_ingestion",
    "state": "running",
    "stage": "research_compilation",
    "priority": 100,
    "requestedBy": { "type": "human", "id": "…" },
    "attemptCount": 1,
    "maxAttempts": 3,
    "availableAt": "…",
    "result": {},
    "lastError": "…",
    "createdAt": "…",
    "updatedAt": "…",
    "startedAt": "…",
    "finishedAt": "…"
  },
  "events": [
    {
      "eventType": "processing.queued",
      "state": "queued",
      "stage": "intake",
      "payload": {},
      "recordedAt": "…"
    }
  ]
}

job fields:

FieldDescription
idProcessing job ID
repositoryIdOwning repository ID
kindJob type; always research_ingestion
stateJob state; see the enum below
stagePipeline stage; see the enum below
priorityScheduling priority
requestedByInitiator; type is human, api_key, or service, and id is the corresponding principal ID
attemptCountNumber of attempts made
maxAttemptsMaximum number of attempts
availableAtTime the job becomes schedulable
resultStructured result after completion
lastErrorMost recent error message; may be absent
createdAt / updatedAtCreation and last update times
startedAt / finishedAtStart and finish times; absent while unfinished

state enum: queued, dispatched, running, blocked (blocked by budget or execution policy), completed, failed, cancelled.

stage enum (pipeline stages): intake, source_discovery, research_compilation, research_import, reproduction_scheduling, reproduction, verification, publishing, completed.

events contains the job's 30 most recent processing events. Each includes eventType, state, stage, payload, recordedAt, and other fields (plus integrity fields such as event digests), recording every state change of the pipeline in chronological order.

Errors

Errors always take the form {"error": "message"}:

CodeDescription
400Invalid processing job query (repositoryId missing or too long)
404Processing job does not exist, or you lack read permission on the repository

Notes

This endpoint has no built-in rate limit, but please poll reasonably — an interval of at least 10 seconds is recommended. Once the pipeline completes, structures such as Claims and experiment plans in the repository snapshot are pipeline outputs, readable via GET /api/repositories.