# AiCE full-article partner contract — v1 + publisher-network v2

Release boundary: v2 is additive to the existing v1 service; publish this release and verify signed production probes before CPD.credit switches to v2. This document describes the implemented validators, not proof of a completed second-journal or learner integration. Existing Endolaser v1 records and requests are not migrated or overwritten.

Read-only CPD.credit handoff reviewed: Credit Path Verify commit bca9d33a, `docs/full-article-hsi-aice-handoff.md`. CPD.credit and HSI were not changed here.

## Existing connection and signing

Keep the current AiCE address, Client ID and signing secret. No new connection or key. All calls are server-to-server POST JSON. Source calls require existing `calculations:write`; assessment calls require `records:read`.

Headers: `X-AiCE-Client-Id`, `X-AiCE-Timestamp` (Unix seconds), `X-AiCE-Nonce` (22–128 URL-safe characters), `Idempotency-Key` (equals body `request_id`), `X-AiCE-Signature` (lowercase hex HMAC-SHA256).

Request signature message, newline-delimited:
```text
AiCE-PARTNER-V1
POST
<exact path>
<timestamp>
<nonce>
<client ID>
<request_id>
<SHA-256 of exact UTF-8 JSON body>
```
No query string. Fresh nonce on every retry; retain request ID and exact body. Timestamp tolerance 300 seconds. Verify successful response exact bytes with the same secret:
```text
AiCE-PARTNER-RESPONSE-V1
<path>
<X-AiCE-Response-Timestamp>
<X-AiCE-Request-Nonce>
<client ID>
<SHA-256 of exact response bytes>
```
Signature is `X-AiCE-Response-Signature`. Responses are private/no-store. Errors are `{error:string}` with an HTTP error status. Authenticated v2 article-source business errors, after successful nonce/scope checks, carry the same response HMAC headers; a signed failure is not approval. Pre-authentication failures and legacy v1 errors retain their existing behaviour. Never send keys to a browser.

## Publisher-network v2 — exact CPD.credit handoff

**Status (22 Nov 2026):** v2 is published on the live signed service. The Endolaser v1 source and requests are unchanged. The first canonical HSI article will arrive once CPD.credit verifies HSI's feed. Journals connect via https://cpd.credit/developers/publishers.

**Journals connect only to CPD.credit.** CPD.credit owns ownership/licence checks, canonicalisation, catalogue polling, the widget and learner experience. AiCE is its single educational engine; it does not onboard journals or accept publisher-specific keys. The same contract is available to future explicitly approved networks. CPD.credit's existing Endolaser connection is approved for v2; no replacement connection/key is needed. Self-service learning-platform keys do not automatically enable publisher-network v2 (`403 approved_network_required`).

All v2 calls keep the existing `/api/public/partner/v1/` paths, signing headers, scopes and limits. The path's `v1` is the transport version; **body `schema` is `aice-rich-article-v2`**. Unknown request fields are rejected. Machine-readable v2 and alternate-flow recovery schemas: `/integration/aice-publisher-contract-v2.schemas.json`, generated from the actual validators with `bun scripts/generate-publisher-contract.ts`.

### Exact common v2 binding

Every source/assessment request includes:

| Field | Exact type / meaning |
|---|---|
| `schema` | `aice-rich-article-v2` |
| `action` | Source: `ingest`, `result`, `resume`, `revoke`; assessment: `prepare`, `submit`, `result`, `certificate-evidence` |
| `request_id` | 1–128 `[A-Za-z0-9._:-]`; equals `Idempotency-Key` |
| `canonical_article_id` | Same identifier format; stable **network-wide**, not merely journal-local |
| `version` | Same identifier format; CPD.credit's immutable canonical article revision |
| `canonical_sha256` | 64 lowercase hex; CPD.credit's SHA-256 of exact UTF-8 `package.text` |
| `publisher_tenant_id` | Same identifier format; CPD.credit's stable publisher attribution, not a signing key |
| `bank_version` | `article-bank-2026.1` |

The cache key is `(canonical_article_id, version, canonical_sha256)` **inside the signed network/client**. Attribution must match the originally stored tenant. Identical canonical submissions return the stored source and checked bank, even when the day's budget is exhausted. Neither reads, page views, learner prepare nor cache hits generate questions. Same text with an explicitly requested different version creates a distinct source/review. Use a new version/fingerprint for revised content. Changed captions/package, licence, format or DOI under the same canonical key returns `409 canonical_payload_conflict`; the existing source is never overwritten. Model/rubric/bank provenance remains the provenance actually used by the cached review.

### Exact v2 source ingest fields

POST `/api/public/partner/v1/article-sources`. In addition to common binding:

| Field | Exact type / meaning |
|---|---|
| `action` | `ingest` |
| `review_requested` | literal `true`; ingestion is an explicit paid review request, never a page-view action |
| `canonical_url` | Public https canonical reference; no credentials/query/fragment; not fetched by AiCE |
| `doi` | Optional string <=255 characters, matching `10.<4–9 digits>/<non-whitespace suffix>` |
| `licence` | 2–1,000 characters; rights verified by CPD.credit, not invented by AiCE |
| `content_format` | `jats` or `json` — provenance of the network's canonical rendition |
| `package` | `{title,text,text_sha256,images,tables,order,figures?}` with limits below |
| `authority` | Existing `{rights_confirmed:true,complete:true,publisher,reference,captured_at,retain_days,qualifying_activity?}` |
| `proposal` | Existing `{points:number|null,qualifying_minutes:integer|null,rationale,source_quote}`; exact allocation rules unchanged |
| `allocation_mode` | Optional `exact` or `up_to`, v2 ingest only; omission means `exact` |
| `processing` | Optional `sync` or `async` on v2 ingest/resume only; omission means `sync` |

### Opt-in asynchronous v2 review — built, not released

Async requires separately approved SQL application, publication, Inngest registration and operator enablement. It is **disabled by default**. Existing v1 and v2 requests with absent `processing` or `processing:'sync'` retain synchronous behaviour. Do not switch a live sender until the release checklist is complete.

For a new paid ingest or deliberate resume, add `processing:'async'`. After the existing signed scope, binding, licence, withdrawal, idempotency, attempt and budget checks, AiCE atomically reserves once, creates/claims the source and queues one private run. The signed `aice-rich-source-result-v2` reply returns promptly with normal source bindings plus:

```text
status: "processing"
source_id: <existing/new source UUID>
processing: "async"
stage: "queued"
accepted_at: <server ISO timestamp>
poll_after_seconds: 60
```

Up_to also includes existing `allocation_mode` and `allocation_decision`. **CPD.credit detects acceptance from `processing:'async'`, not an unsigned timeout or an assumed background job.** Below-minimum up_to remains free and terminal: no model, reservation or queued run. Cached terminal sources stay terminal. Exact async re-sends return existing state with `reused:true`, no second run or charge. Changed bytes under an async request ID conflict.

Every signed result poll of an unfinished async source adds `processing:'async'`, `accepted_at`, `poll_after_seconds:60`, and `stage:'queued'|'analysis'|'pool'|'review'`. Terminal fields and failure codes retain existing meaning and never imply earned credit. Result requests themselves **do not accept `processing`**. Canonical-only lookup remains available after a lost first response.

Inngest events carry only `{run_id:<opaque UUID>}`. Each signed callback claims and runs one shared generation stage, zero inference retries, at most one strict correction, existing 90-second model-call bounds and a 200-second stage fence. Checkpoint and stage receipt/advancement commit atomically. An old stage/version/token or prior-stage event cannot write or claim the next stage. The last stage uses existing independent approval/refusal logic.

Only an overdue **queued** trigger is repaired by a signed result poll: after more than three minutes, or a never-recorded trigger, an atomic intent increments `trigger_attempts` and sends a fresh deduplicated event. This never charges or restarts a started stage. A running stage that dies becomes `generation_failed / generation_interrupted` after lease expiry; only a deliberate owner-authorised resume recovers it. Queued runs are never marked interrupted. No new cron or pg_net: without polling, a lost queued trigger may stay queued indefinitely.

Disabled kill switch: explicit async accept returns authenticated **signed HTTP 503 `{error:'async_unavailable'}`** before reservation or source creation. New claims/dispatches stop; a claimed running stage can finish its fenced checkpoint or time out. Existing sync stays available. Local deadlines do not prove remote cancellation. Failed/uncertain event send leaves the durable run queued, with no refund/re-reservation or extra inference. Event sending has a 1.5-second local bound; database latency is not a fixed production SLA.


### Opt-in up_to allocation

`allocation_mode:'up_to'` requires `proposal.points` exactly `0.5` or `1`, and `proposal.qualifying_minutes:null`; rationale/source_quote keep their existing limits and exact grounding. Otherwise return authenticated signed HTTP 400 `invalid_allocation_mode_proposal`. The generated schema encodes these conditional proposal types. `exact` and omission retain existing paid over-ceiling analysis/refusal behaviour; the shared proposal and v1 contract are unchanged.

Before any publisher reservation or inference, calculate the existing deterministic ELW ceiling (`final_elw / 4000`). Select the largest of `[1,0.5]` not above either proposed points or the **unrounded** ceiling. With proposed 1, ceilings 0.413/0.596/0.99/1.2 select null/0.5/0.5/1; proposed 0.5 never becomes 1. Below 0.5 stores a terminal `not_qualifying` source, `failure_code:'below_minimum_workload'`, null allocation and deterministic decision/note, with zero reservation and zero model calls. `generation_attempts` retains the existing initial source slot value 1 to satisfy the existing 1–3 database constraint; that field alone is not proof that inference happened.

For an assigned value, reserve one review and give the model the effective proposal with those points. The original proposal remains unchanged in `analysis.proposal`; `analysis.allocation_mode` and `analysis.allocation_decision` persist through private checkpoints. Independent educational-substance and every-question checks remain mandatory. If grounded analysis does not confirm substance, return `not_qualifying`, `failure_code:'insufficient_educational_substance'`, null allocation and a substance-refusal decision; no fallback pool. Approval stores assigned `allocation.activity_points`. Up_to learner forms use those approved points (0.5 → 5 questions; 1 → 10), not the original larger proposal. Other sources retain proposal-based sizing.

Only up_to sources add these top-level fields, including when completed public `analysis` is null:

```text
allocation_mode: "up_to"
allocation_decision: {
  version: "allocation-decision-v1",
  policy: "existing_4000_elw_per_workload_point",
  supported_values: [0.5, 1],
  proposed_points: 0.5 | 1,
  effective_learning_words: number,
  ceiling_points: number, // rounded to 3 decimals for display only
  assigned_points: 0.5 | 1 | null,
  reason_code: "assigned_as_proposed" | "assigned_reduced_to_ceiling"
             | "below_minimum_workload" | "insufficient_educational_substance"
}
```

Substance refusal sets final assigned_points to null; the ELW ceiling remains workload evidence, not earned learner credit. Existing source-result schema remains `aice-rich-source-result-v2`; exact/absent sources get no new fields. Reusing a source with a different mode (absent treated as exact) returns authenticated signed `409 allocation_mode_conflict`, without another paid review.

**New version isolation:** an explicit new v2 ingest with the same canonical_article_id and canonical_sha256 but a **new version** is accepted as a distinct source/review when the normal body, authority and budget checks pass. Canonical uniqueness includes source_version; the legacy rubric partition also includes the canonical version. Withdrawal keys use canonical_url + source_version. An older version's tombstone does not block the new version, and is never removed or bypassed. A matching current-version tombstone remains `410 source_unavailable`. Use a new request_id and explicit review_requested:true; do not pretend the old source changed, or infer that the new review will approve. `redecide` is unsupported: do not send it.

**Withdrawn sources on re-ingest:** a v2 ingest that matches an existing source carrying a durable withdrawal marker returns `410 source_unavailable`, not the stored refusal or result. To submit a refused or withdrawn article again, send a **new `source_version` value** with a new request_id; the same version is never reopened.

**Fingerprint distinction:** CPD.credit supplies the complete canonical rendition in `package.text`, already normalised by CPD.credit from JATS/JSON. AiCE does not normalise whitespace, newlines, Unicode or XML and does not download raw articles. It hashes those exact received text bytes and requires both `canonical_sha256` and `package.text_sha256` to match. This rendition must preserve complete readable source/captions/table information needed for assessment. `content_format` does not ask AiCE to parse an external feed or fetch XML. Raw-body HMAC remains a separate exact-byte digest.

AiCE also computes and returns `package_sha256` of the complete structured package using the existing stable-JSON algorithm. **Do not substitute CPD.credit's canonical text hash for this AiCE package hash**, especially in the existing Passport `article_binding` proof. Store both under their own names.

Media is additive, not mandatory binaries:
- `images:[]` is valid. If actual image binaries are supplied, existing byte/type/hash/licence checks still apply; never claim pixel inspection from metadata.
- Optional `figures` (max 100): each `{id,caption,alt?,metadata?}`. `id` 1–128 characters; caption 10–4,000; alt <=2,000; metadata is a string-key/string-value object (key <=80, value <=2,000). These are explicitly labelled captions/metadata only to the model.
- `tables` (max 40): `{caption,rows:string[][],metadata?}`. `rows:[]` is permitted only with a substantive caption >=10 characters. Nonempty rows preserve actual cells and existing bounds. Unseen table cells are not assessed.
- `order` uses existing `{type:'text'|'image'|'table',index}` and includes each supplied text/image/table exactly once. Figure captions are separate metadata; preserve their placement in the network's canonical rendition/metadata, not as imaginary image binaries.
- Complete text remains 1,500–120,000 characters; package title 1–300. Source body remains <=3 MiB; nothing is silently truncated. Authorisation/retention/proposal limits below remain unchanged.

### Exact v2 source result, resume and revoke fields

Use all common bindings plus `source_id:<UUID>`. For source `action:'result'` only, `source_id` may be **omitted** after a lost ingest response. Null, empty or malformed IDs are rejected. The omitted-ID read requires exactly one existing source matching the authenticated client, publisher tenant, canonical article ID, exact version, canonical text hash and requested bank version. It returns the original source ID and the same `aice-rich-source-result-v2` shape; it never chooses the latest version or a legacy/other-tenant source. No match is `404 source_not_found`; duplicate or database read error is `503 service_unavailable`; a detected binding mismatch is `403 source_binding_mismatch`; expiry, revocation or a durable source-withdrawal marker is `410 source_unavailable`. **Refused sources:** a v2 `result` read (with or without `source_id`) of a source AiCE refused returns its signed stored outcome — `status:'not_qualifying'` with `failure_code`, analysis and any `allocation_decision` — because the refusal's own recorded marker does not hide it. On a result read, `410` means revoked, expired, or withdrawn by AiCE (admin withdrawal, rights change, or a marker belonging to another source). Ingest, resume and async acceptance of a refused version still return `410`. A supplied UUID remains strictly bound and never falls back to canonical lookup on failure. `resume`, `revoke` and **all assessment actions, including assessment result**, still require source IDs; v1 is unchanged.

Every authenticated v2 source action invokes status-only stalled detection, bypassing the legacy retention purge; explicit async requests first check the disabled-by-default control without touching sources. It never clears licensed content, pools, forms or submissions. Canonical-only source result then performs direct source and version-specific withdrawal reads. It returns truthful `processing`, `generation_failed`, `approved` or `not_qualifying` state with existing safe projections. Result never accepts new generation, resumes/restarts a started stage, reserves a publisher budget, changes generation attempts, ingests/backfills content or issues anything; the opt-in async branch can repair only an overdue queued trigger as described above; it may persist a stalled status transition before projecting the result. The existing signed transport still validates HMAC, body limits, request key, network authority and nonce/scope; nonce bookkeeping is not a source-generation write. This guide states the API behaviour of the v2 source-result contract only; whether a given deployment currently exposes it, and its consumer-acceptance status, is recorded in the private partner handoff rather than asserted here.

**Synchronous v2 operational time bounds:** each model call is limited to 90 seconds and the shared generation/checkpoint deadline is 420 seconds, with no paid transport retries. The v2 generation lease is 600 seconds (it always outlasts the total deadline), so `409 source_busy` can last up to ten minutes for v2; v1 keeps its five-minute lease. Expired v2 sources are retained only until `retain_until`; afterwards a v2-only retention step clears the stored package and private question pool and blanks form/submission personal data, without deleting rows, and skips any source linked to an AiCE material allocation or award. Timeout saves `generation_failed` / `generation_timeout` through the run's state/lease fence. One v2 lease token stays constant for that bounded run, so a checkpoint committed before its delayed response cannot strand the failure save on an older token. Late model/checkpoint work cannot overwrite the fenced terminal state. Request termination or an uncertain provider/database outcome is not proof of remote cancellation or safe replay; generation remains request-bound, not a durable background job.

For synchronous sources only, status-only stalled detection marks processing v2 leases expired more than 10 minutes ago, or no-lease sources older than 15 minutes, as `generation_failed` / `generation_interrupted`. Malformed leases, v1, active leases, terminal, expired, revoked and withdrawn sources remain untouched. It preserves checkpoints and attempts, spends no budget, and logs only source ID/age plus aggregate count. A separately registered 15-minute SQL backstop detects an expired lease 10–25 minutes after expiry; registration and publication are release operations, not a model retry. Result signing does not prove generation is active or ready.

`revoke` adds `reason` (10–500 characters). **Do not send `source_version` or `package_sha256` in a v2 request**; those are legacy references and remain returned for compatibility. `resume` is a deliberate signed recovery of an expired processing lease or operational `generation_failed` source, never a terminal review rewrite. Each resumed v2 run also consumes a tenant reservation. At most three total runs per source; identical recovery request ID does not run twice. Reads return safe failure state/code with `analysis:null` where incomplete, without paid regeneration.

### Exact v2 assessment fields

POST `/api/public/partner/v1/article-assessments`. Every action includes common binding, `source_id:<UUID>`, and `learner:{kind:'guest'|'linked',id:<opaque identifier>}`.

| Action | Additional exact fields |
|---|---|
| `prepare` | `consent:{granted:true,purpose:'full_article_assessment',captured_at:<ISO timestamp>}` |
| `submit` | `form_id:<UUID>`, `attempt_token:<64 lowercase hex>`, `answers:number[]` (0–3, exact displayed count), `completion:{reviewed:true,reviewed_at:<ISO timestamp>,evidence_reference:<10–1000 chars>}` |
| `result` | `form_id`, `attempt_token` |
| `certificate-evidence` | `form_id`, `attempt_token`, `recipient:{name,email}`, `identity_consent:{granted:true,purpose:'share_identity_with_certificate_issuer',captured_at:<ISO timestamp>}` |

The original consent/time/70% threshold, one terminal submission, token secrecy and issuer-only certificate evidence rules below remain unchanged. Every form/token includes the canonical identity/version/fingerprint, tenant and stored licence/DOI/format. A different source, version, hash, tenant, learner or form proof is rejected; no answer key reaches the caller.

### Exact v2 response fields

**Source** schema is `aice-rich-source-result-v2`. Exact top-level fields:
`schema, canonical_article_id, version, canonical_sha256, publisher_tenant_id, doi, licence, content_format, source_id, source_version, package_sha256, canonical_url, bank_version, model_version, rubric_version, status, analysis, allocation, aice_activity_points, points_status, approval_method, reviewed_at, retain_until, failure_code, generation_attempts, certificate_issued, earned_cpd_hours, learner_points_awarded` and `reused` on ingest; unfinished async adds `processing,accepted_at,poll_after_seconds,stage` as described above; up_to adds only `allocation_mode, allocation_decision` described above. `doi` is null if omitted. Analysis/allocation are null while unavailable; failure codes never contain exception/source text. Terminal source states and analysis details follow v1 below. Only approved workload allocation can populate `aice_activity_points`; it is not earned learner credit.

**Assessment prepare** schema is `aice-rich-assessment-result-v2`. Exact fields:
`schema, client_id, canonical_article_id, version, canonical_sha256, publisher_tenant_id, doi, licence, content_format, source_id, source_version, package_sha256, bank_version, model_version, rubric_version, allocation, form_id, form_sha256, learner, consent, expires_at, category, verified_level, preparation_request_id, questions, status, pass_mark, certificate_issued, earned_cpd_hours, learner_points_awarded, passport_consent, verification_endpoint, attempt_token, passport, passport_claim_endpoint`.
`questions` is `[{id,question,options,objective_index}]`; no keys/source-answer quotes. `passport` is the existing consent/provisional projection, not a new identity-matching mechanism.

**Terminal submit / result** retains the source/canonical/form binding and zero-award fields above, omits questions/token/Passport wrapper, and adds:
`request_id, correct_count, question_count, score, pass_mark:70, passed, status:'passed'|'failed', completion_review, assessed_at, certificate_evidence_eligible, certificate_authority:'independent_partner_issuer'`.
Pending result returns stored preparation without token/Passport wrapper and adds the current `request_id`.

**Certificate evidence** retains terminal fields and adds:
`recipient, identity_status:'self_declared_email_unverified', identity_consent, evidence_id, certificate_issuer, hours_authority:'none_in_this_assessment_evidence'`.
`certificate_issuer` is the existing signed partner client ID; CPD.credit sets its actual issuer name and issues its own PDF under its own policy. `certificate_issued:false`, `earned_cpd_hours:0` and `learner_points_awarded:0` remain exact. No receipt, Passport claim or assessment in this contract mints CPD/Knowledge Coyns or writes blockchain transactions.

### Per-publisher spend controls

Initial limit: **20 review runs per publisher tenant per UTC day**, configurable privately by the AiCE operator (0–1,000). A fresh canonical paid review or explicit paid resume reserves one run atomically under `(signed network, publisher_tenant_id)`. Each run has only the existing stages, each with at most one strict correction. Reservations are idempotent; concurrent requests cannot exceed the daily limit. Failed/unknown-outcome runs are not refunded or blindly resent. Cache hits, result polls and deterministic below-minimum up_to refusals cost zero reviews. Each deliberate paid v2 resume consumes one of the 20 daily reviews; identical replay consumes no additional reservation. There is no re-decision action. Exhaustion is **HTTP 429 `{error:'budget_exhausted'}`**, not an approval or invitation to invent another tenant. CPD.credit must use its registered tenant ID consistently and defer until the next UTC day/operator budget change.

Other exact v2 errors: 400 `canonical_fingerprint_mismatch`, 403 `source_binding_mismatch` / `approved_network_required`, 409 `canonical_payload_conflict`, existing lease/attempt/idempotency errors, 410 source expiry/revocation, 422 strict source-review non-confirmation, 503 operational generation failure. Authenticated v2 source business errors are also signed after nonce/scope checks, without becoming approval; pre-authentication and legacy errors retain their existing behaviour.

### Bounded recovery of the three alternate flows

Provider-written review and self-directed/guest generation (`evaluations`), plus provider content review (`course-reviews`), each get **one strictly revalidated corrective call per completed invalid stage**. Gateway timeouts, unknown outcomes, denials and honest source rejections are not correction triggers. Safe private checkpoints are revalidated against the exact original source. A second invalid output ends that run. Existing records/awards and model selections are unchanged.

Use the existing signed endpoints only. Exact restart bodies:
- Linked learning: `{schema:'aice-self-directed-v1',action:'resume',request_id,subject,evaluation_id,original_request}`.
- Guest or provider-written assessment: `{schema:'aice-guest-assessment-v1',action:'resume',request_id,guest_id,evaluation_id,original_request}`.
- Course content review: `{schema:'aice-course-review-v1',action:'resume',request_id,review_id,original_request}`.

`original_request` is a **string of the byte-identical original serialized prepare/review JSON**, not a re-serialized or altered object; its SHA-256 must match the stored signed original body digest. Store it privately in CPD.credit under its consented material-retention policy, never analytics/browser URLs. Existing outer 65,536-byte body limit still applies, including JSON escaping; if a serialized recovery body exceeds it, do not truncate or weaken binding. Original source consent/permission must still be within its existing 24-hour freshness window; linked account consent/owner and guest/content binding remain required. Use a new deliberate restart ID and a fresh nonce. Same restart ID/body only reads state; changed body under that ID conflicts.

Three total runs maximum (initial + at most two deliberate restarts). An active five-minute lease returns `409 source_busy`; expired interrupted leases may be recovered, including older processing rows without a lease after five minutes from creation. Terminal/submitted results cannot be overwritten or restarted. Repeated prepare/review, read and page-view actions never resume failure. Signed result reads expose `failure_code` and `generation_attempts`, not raw errors or private checkpoints. Safe codes include `malformed_model_output`, `ungrounded_output`, `ungrounded_question`, `ungrounded_provider_review`, `ungrounded_review`, `question_count_mismatch`, `model_gateway_error`, `save_failed`, `source_checkpoint_failed`, `unexpected_generation_error`. A restart is an operator decision after inspecting state, not a browser auto-retry loop.

### Exact CPD.credit switch-over sequence

1. Keep the current origin/client/secret and legacy Endolaser source bindings. Do not re-ingest it merely to switch schemas; existing v1 continues unchanged.
2. For a new authorised canonical publisher version, send the exact v2 ingest fields above with stable tenant attribution and `review_requested:true`. CPD.credit, not the journal, computes canonical text/hash and enforces publisher ownership/licence.
3. Save both canonical and returned legacy bindings and verify every signed response. Read-only poll incomplete state; `budget_exhausted` pauses review, never consumes a learner attempt or creates a new publisher/key.
4. After real approval, use v2 prepare/submit/result with actual learner consent and answers. CPD.credit handles issuance; optional Passport proof still uses **returned `package_sha256`**, not canonical text SHA-256.
5. Connect a second unrelated journal through CPD.credit's standard publisher contract and existing network connection, without AiCE application changes. AiCE's non-HSI checks use **constructed isolated fixtures, not real publisher onboarding, model output or learner credentials**; CPD.credit's real catalogue/widget journey must be tested in its own project.

## Exact request schemas

Machine-readable schemas generated from the actual validators: `/integration/aice-full-article-request-schemas.json`. Identifiers: 1–128 ASCII letters, digits, `. _ : -`. Hashes: 64 lowercase hex. UUID fields require UUIDs. No unknown fields accepted.

### Source ingest

POST `/api/public/partner/v1/article-sources`:

| Field | Exact type / value |
|---|---|
| schema | `aice-rich-article-v1` |
| action | `ingest` |
| request_id | identifier |
| canonical_url | https public canonical URL, no query/fragment/credentials; never fetched by AiCE |
| source_version | identifier |
| package_sha256 | hash of canonical package JSON described below |
| bank_version | `article-bank-2026.1` |
| package | `{title,text,text_sha256,images,tables,order}` |
| authority | `{rights_confirmed:true,complete:true,publisher,reference,captured_at,retain_days,qualifying_activity?}` |
| proposal | `{points:number|null,qualifying_minutes:integer|null,rationale,source_quote}` |

`package.title`: 1–300 chars. `text`: **complete** text, 1,500–120,000 chars including headings, references and caption text; no excerpts. `text_sha256`: exact UTF-8 text digest. Images maximum 40, each `{src,alt,caption,content_type,content_base64,sha256,licensed:true}`. `src` URL <=2,000 chars; metadata only, not downloaded. `alt` <=2,000; caption <=4,000. Type JPEG/PNG/WebP only; full base64 <=700,000 chars, bytes must match type and hash. No captions-only image assessment. Tables maximum 40: `{caption,rows:string[][]}`, <=250 rows, <=40 cells/row, <=4,000 chars/cell. Preserve row order. `order` includes each `{type:'text'|'image'|'table',index}` exactly once; text index 0. Order records text as a single complete unit and ordered image/table units; it is not paragraph-level placement.

Total exact signed source request <=3 MiB (3,145,728 bytes). Assessment request <=65,536 bytes. Explicitly reject larger packages, missing/unsupported media or unreadable images; never omit or silently truncate. The model receives every supplied image's actual bytes and all text/tables. Content is untrusted data, never executable instructions.

Authority: publisher 2–200 chars; reference 10–1,000 chars documenting rights/publication evidence; captured_at ISO timestamp no older than 24 hours or >5 minutes ahead; retain_days 1–90. This is signed **partner attestation**, not independent proof of publisher ownership/licensing. CPD.credit must validate the publisher relay; the private AiCE reviewer checks evidence before approval. Optional `qualifying_activity` is `{approved_minutes:15,authority_name:string,evidence_reference:string}`; named authority 2–200 chars, reference 20–1,000. It is not accepted as completed learner time.

Package hash canonicalization: recursively sort object keys by ASCII lexicographic order; preserve array order; compact JSON, UTF-8, no extra whitespace. Hash **only** the `package` object, including original base64, all hashes, captions, metadata, tables and order. Raw-request HMAC remains exact-body signing, not canonicalized. Changed pixels, text, caption or table changes the package hash and creates a separate source. Use a new source_version for changed material. Unchanged package with changed version/proposal conflicts; do not use a new request to silently revise allocation. Reuse is scoped to partner + canonical URL + package hash + model + rubric + bank version, never cross-partner or cross-learner token reuse.

### Source read / revoke

Same source endpoint: `{schema,action:'result',request_id,source_id,source_version,package_sha256,bank_version}`. For `action:'revoke'`, additionally `reason` (10–500 chars). Reads return processing/pending review/approved/rejected/not qualifying state; they do not regenerate a bank. Generation failure returns `generation_failed_do_not_auto_retry`; inspect before a new generation request. Do not immediately replay ambiguous/time-out generation.

### Prepare

POST `/api/public/partner/v1/article-assessments`: `{schema:'aice-rich-article-v1',action:'prepare',request_id,source_id,source_version,package_sha256,bank_version:'article-bank-2026.1',learner:{kind:'guest'|'linked',id},consent:{granted:true,purpose:'full_article_assessment',captured_at}}`.

Linked learners require a current explicit AiCE account mapping. Guests need no linked account; partner creates a stable opaque guest ID, not an email/name. Consent must be fresh and bound to this learner/source/form. CPD.credit must authenticate its own learner or own guest session before calling. New forms are balanced objective-tagged random selections; the form ID/token is learner-bound. Distinct forms are not a guarantee of unique question sets forever; finite pools can repeat subsets. Keys remain private.

### Submit / result / certificate evidence

All include `{schema,action,request_id,source_id,source_version,package_sha256,bank_version,form_id,attempt_token,learner}` using the exact prepare refs. `attempt_token` is 64 lowercase hex and kept private by CPD.credit.

- `submit`: adds `answers:number[]` (0–3 in displayed order; exact question count), `completion:{reviewed:true,reviewed_at,evidence_reference}`. Review time must follow prepare and not be in future >5 min. This is partner-attested private completion review, not independently observed learning time.
- `result`: no extra fields; signed lookup for exact evidence/form. Does not return recipient identity. Expired source, revocation or revoked linked consent makes evidence unavailable. Completed results remain readable while the source retention permits even after attempt expiry.
- `certificate-evidence`: adds `recipient:{name,email}` and `identity_consent:{granted:true,purpose:'share_identity_with_certificate_issuer',captured_at}`. Only after pass and completion review. Identity is immutable/idempotent per form, late-captured, self-declared; email ownership is unverified. Consent must be fresh. Response privately supplies identity to that same partner issuer, not HSI. No AiCE certificate is issued.

## Exact response fields

Source success: `{schema:'aice-rich-source-result-v1',source_id,source_version,package_sha256,canonical_url,bank_version,model_version,rubric_version,status,analysis,allocation,reviewed_at,retain_until,certificate_issued:false,earned_cpd_hours:0,learner_points_awarded:0,reused?}`. `reused` appears on ingest only.

Analysis contains grounded `{text,source_quote}` objects for `title`, `summary`, `level_rationale`, `allocation_rationale`; `objectives` array of these; `category:{industry,domain,capability}`; `verified_level`; `allocation_supported`; `image_observations:[{image_index,readable,observation}]`; `table_observations:[{table_index,observation}]`; `limitations`; original `proposal`; `coverage:{complete_text,text_characters,images,tables}`; `source_authority:'partner_attested_not_independently_verified'`. New successful pool generations also include `workload_evidence` with effective_learning_words, raw_workload_points, policy, proposal_within_ceiling, qualifying_activity, limitations. This is deterministic workload evidence, not CPD hours. Independent question validation is stored privately, never returned with keys.

Allocation null until native private review; approved allocation `{activity_points:number|null,qualifying_minutes:15|null,authority:'aice_private_source_review',earned_learner_points:0,earned_cpd_hours:0}`. This authorises **activity** size, not earned learner units. Master control → Partner platforms → selected partner → Full-article reviews is the private AiCE approval/rejection screen.

Prepare success: `{schema:'aice-rich-assessment-result-v1',client_id,source_id,source_version,package_sha256,bank_version,model_version,rubric_version,allocation,form_id,form_sha256,learner,consent,expires_at,category,verified_level,preparation_request_id,questions:[{id,question,options,objective_index}],status:'awaiting_answers',pass_mark:70,certificate_issued:false,earned_cpd_hours:0,learner_points_awarded:0,passport_consent:'optional_existing_link_flow',verification_endpoint:'/api/public/partner/v1/article-assessments',attempt_token}`. Token binds all provenance fields including consent, allocation, category and checked level. `form_sha256` hashes the canonical selected private pool-index array, not public questions. One-hour attempt expiry.

Submit success replaces questions/token with `request_id,correct_count,question_count,score,pass_mark:70,passed,status:'passed'|'failed',completion_review,assessed_at,certificate_evidence_eligible,certificate_authority:'independent_partner_issuer'`; all binding fields and zero-award fields remain. Result returns stored submit output (or prepare output without token while pending) with current request_id. Only one terminal submission; exact retry is idempotent, other submissions 409.

Certificate evidence success adds `recipient`, `identity_status:'self_declared_email_unverified'`, `identity_consent`, `evidence_id` (form UUID), `certificate_issuer` (existing partner client ID), `hours_authority:'none_in_this_assessment_evidence'`. The signed HTTP envelope is its provenance proof. CPD.credit names its own real issuer and produces its PDF and live verification page. Print checked `verified_level`, never claimed_level. Its verification service can call signed `result` with saved private bindings.

## Allocation and issuance boundaries

Sizing after native approval only:
- 1 activity point: 10 questions, validated pool >=20.
- 0.5 activity point: 5 questions, pool >=10.
- Qualifying approved 15-minute activity: 2 questions, pool >=4. Requires named duration evidence and private reviewer approval, not ELW-to-minute conversion.
- Below 15 minutes: no qualifying assessment.
- All other allocations unsupported; **no rounding**.

An average medical article may propose 1 point. It is not automatically granted. Existing 4,000 ELW/workload-point calculation is a ceiling for point proposals; model independently checks educational substance, and the native reviewer confirms/rejects the current source allocation. No average-article floor, no passed-score multiplier, no fabricated image workload. Qualifying minutes require their separate activity authority. No output from this service grants learner CPD hours/points. CPD.credit needs its own qualifying issuance authority and actual completion safeguards; it must not convert allocated points into earned hours. This release has no awarded-hours path. Existing reviewer-issued awards/certificates remain unchanged. CPD.credit deduplicates issuer certificates by learner/source/version under its policy; multiple forms do not create AiCE awards.

Passport consent remains optional. Completed linked-learner article forms now appear in the authenticated learner's Passport through the existing active subject mapping. Guest prepare responses include `passport:{passport_id,status:'provisional'|'claimed',passport_url}` and `passport_claim_endpoint:'/api/public/partner/v1/link-requests'`. Guest attachment requires signed form proof plus explicit signed-in approval, never name/email matching. No HSI sharing or blockchain writes.

For a guest claim, POST the existing signed `/api/public/partner/v1/link-requests` endpoint with `{subject,state,article_binding:{form_id,guest_id,package_sha256,attempt_token}}`. `subject` is the partner's stable local learner ID; `guest_id` is the exact prepared guest ID. Do not put `request_id` in this body: use the normal `Idempotency-Key` header. `state` is 16–128 URL-safe characters. Do not combine `article_binding` with legacy `guest_binding`. Open the returned `consent_path` on the AiCE host; the learner signs in and approves. Poll the existing signed `link-status`, then use `passport` with `{subject}`. Never expose the attempt token or signing secret in a URL or browser. Learners see original article title/link, partner, terminal score/date and checked capability/level; this projection does not include identity, source bytes, questions, answer keys, allocations or CPD awards. Source retention still applies.

## Retention and operational behaviour

### Interrupted review recovery — 19 November 2026

`analysis` is **null** until all required analysis fields have been validated; the internal proposal placeholder is never completed analysis. CPD.credit must treat `status:'processing'` as unfinished, not as permission to start an assessment. Completed analysis and private question pools are checkpointed before subsequent model calls. Reads and repeated ingest do not regenerate.

After investigating an interrupted model outcome, an operator or partner may explicitly POST `{schema:'aice-rich-article-v1',action:'resume',request_id,source_id,source_version,package_sha256,bank_version}` to the existing signed source endpoint. This resumes a `processing` source whose five-minute lease has expired, or a `generation_failed` source, using its stored exact package/proposal (hashes re-verified) and validated checkpoints. It does not alter allocation, create new content, or extend retention. An active lease returns `409 source_busy`. Each source runs the automatic review at most 3 times in total (`409 recovery_limit_reached` after that); resending the same `request_id` returns the current state without another model run. Reads (`result`), ingest reuse and assessment calls never regenerate: a failed source keeps returning `503 generation_failed_do_not_auto_retry`. Source results include `failure_code` (fixed vocabulary such as `table_coverage_missing` or `malformed_model_output`, never source text) and `generation_attempts`. Existing terminal sources are returned unchanged. Resume is an explicit recovery action, **not** a polling loop or automatic retry policy. The original three-stage generation can exceed CPD.credit's 60-second timeout; CPD.credit must save source refs from an unfinished read, show a waiting state and poll read-only `result`, rather than consume a daily learner attempt for each click.

Private JSON storage includes complete licensed bytes and pool under service-only access; browser users cannot query the bank. Admin reviewer reads full content only after native admin/superadmin checks. Expiry immediately blocks API access; daily 03:00 UTC cleanup deletes expired content, private forms and late identity within at most one additional day. Source revocation immediately clears source bytes/pool and blocks attempts; residual form identity is purged on the retention schedule. No permanent retained raw-source requirement. Prepare and result do not regenerate or extend retention. Default generation is synchronous (opt-in async is described above); long synchronous requests can outlive a caller timeout. Poll the signed source result. Under **v2**, if the ingest response was lost and the source ID is unknown, use the exact canonical `action:'result'` lookup described in the v2 source-result section — **never** replay ingest as v2 result recovery. Under the legacy **v1** contract, where no canonical lookup exists and `source_id` is required, an existing processing source can still be read by resending the identical ingest body with a new nonce; that reuse returns the existing source and is never a regeneration. Explicit `resume` is a separately authorised recovery action taken after operator investigation, not an automatic retry. A failed source requires operator investigation.

## Tested, not claimed live

Actual signed preview execution using the existing CPD.credit key on **constructed QA material/learners, not real learner completions**: a 52,080-character anthology using licensed OpenStax text plus a constructed diagram/table; independently generated and checked 10-question pool; private admin review approved 0.5 activity points; unchanged source/pool reused; distinct 5-question forms; 0% fail and 100% pass; immutable submission; signed result/evidence; tampered signature 401, learner binding 403, replay 409, failed evidence 409. No certificates, hours or points awarded.

Genuine publisher acceptance subsequently passed for complete OpenStax Anatomy and Physiology 2e section 3.1, The Cell Membrane: 28,541 characters and all 11 images, no tables. This was noncommercial internal QA under the publisher's CC BY-NC-SA licence, not proof of a partner's commercial publishing rights. Signed ingest returned 200, 10 questions were independently checked, native QA-only review confirmed 0.5 activity allocation, and a labelled automated guest completed a 5-question form. Its stored result was claimed through explicit signed-in consent and displayed in Passport on desktop/phone. No real learner completion, certificates or earned credit were created. Linked interactive resources remain unassessed; metadata is never silently shortened. OpenStax Anatomical Terminology and the CDC figure remain correctly rejected/out of bounds; not every publisher package fits this contract.

## CPD.credit adapter tasks

1. Keep existing credentials; map staged authorised rich package to this contract; compute exact text/image/package hashes and preserve all content. Return an explicit bound error rather than excerpt fallback.
2. Save source ID/version/hash after ingest; wait for approved state and allocation. Reuse source refs and bank for later learners.
3. Bind each dialog to its own stable guest/learner and fresh consent. Render returned questions, never create a local quiz or select a keyed bank.
4. Capture private review and submit terminal answers server-side. Show fail/pass as returned.
5. On pass, capture separately consented name/email; request certificate evidence. Issue CPD.credit's branded certificate with checked level and only independently authorised earned units. Use issuer deduplication and live verification.
6. Offer optional AiCE Passport linking separately using `article_binding` above for guests; existing linked learners' terminal forms are projected automatically under their consented subject mapping. Never attach by email/name.
7. Test actual authorised provider article and learner dialog, downloads, privacy and repeated/versioned source behaviour. Request publication approval separately in CPD.credit. HSI needs no changes from this AiCE task.
## Automatic points confirmation (2026-11-18)

- Ingest now confirms AiCE activity points automatically when the independent re-solve accepts every question. Response adds:
  - `status`: `approved` | `not_qualifying`
  - `points_status`: `confirmed` | `points_unconfirmed`
  - `aice_activity_points`: `0.5` / `1` / `null` (the 15-minute rule uses `qualifying_minutes` and still needs the qualifying-activity authority)
  - `approval_method`: `aice_automatic_independent_review`
  - `reused`: `true` when the same package fingerprint was sent before
- AiCE activity points are workload equivalence, not CPD hours. CPD.credit decides and issues CPD hours on its own certificate. `earned_cpd_hours`, `learner_points_awarded` stay `0`; `certificate_issued` stays `false`.
- Error codes: `invalid_signature` (401), `invalid_payload` (400), `content_hash_mismatch` (400), `source_too_short` (400, text under 1,500 characters), `points_unconfirmed` (400 for an unsupported allocation request, 422 when the independent check cannot confirm every question).
