Skip to main content
A declared-contract engine is an entity_analysis engine whose configuration declares the input fields it accepts and the output envelope it returns, and says how each output block is built. No model is called. The same input and the same enrichment lookup results give the same output, apart from request_id, which is the run ID; a lookup’s result can change between runs. Use it when a downstream system must parse every response the same way. The request and response schemas the engine publishes come straight from these declarations (see Engines overview). The example is vendor-intake, a fictional engine that Harbor Group, a fictional company, uses to record a new supplier: it takes the supplier’s details, echoes the fields its records system stores, and returns one plain next step. Prerequisites
  • An entity_analysis engine. The slug in this guide is vendor-intake. See Create an engine.
  • The organization API key in NEXIO_API_KEY. Saving configuration and publishing accept only the organization key.

How it works

  1. Declared input. input_schema lists every accepted input field by path, with its type, whether it is required, and an optional pattern. The mode is exclusive: the declared fields are the whole input contract.
  2. Declared output. output_contract.blocks lists every top-level output key, each with an optional JSON Schema. always_present can add response_type and request_id.
  3. Composition. output_composition says how each block is produced: projected from the input or a source, rendered from a template, a constant, or built by a composer Nexio registers.
  4. Validation at execution. The run is accepted with 202 and the declared input is checked when the worker starts it. A violation ends the run failed. Each composed block that declares a schema is checked against it; a mismatch also fails the run.
A declared-contract run never ends degraded. A missing upstream result is expressed inside the envelope (for example a status field), not as a run status.

The configuration

This configuration calls no external processor, so it needs no egress_manifest_version. Enabling an enrichment source (below) makes that key required; copy its value from preset in GET /api/v1/engines/{engine_slug}/config.

Input schema rules

Composition kinds

Every declared block needs a composition entry, and no two entries may own the same part of a block. Tokens and guards must name declared input fields or enabled enrichment sources; anything else is refused when you save. A declared-contract configuration must not set model.

Enrichment sources (optional)

An enabled entry in enrichment_sources runs a lookup that Nexio registers before composition, and its result is readable at enrichment.<kind>. An input_map on the source binds the lookup’s address fields (prospect.primary_address.street, .city, .state and .zip) to declared string fields; several fields for one target are joined with single spaces. A target can be bound by only one source, and the binding feeds every enabled source.
1

Validate, save and publish

Save the configuration above as vendor-intake-config.json, then validate it, save it, and publish version 1.0.
The validate call returns {"valid": true, "errors": []} and the publish returns version 1.0.
2

Submit a supplier

Response 202:
3

Read the envelope

Poll GET /api/v1/runs/8e4b2c7a-1f5d-4a3e-9c6b-0d2f8a7e5b14 as on Runs. The output of the completed run:
request_id is the run ID. The envelope has exactly the declared keys, every time. A supplier sent without annual_spend_usd gets "annual_spend_usd": null, because a projection writes an explicit null for a missing source field, and the block schema allows it. A supplier with "security_attestation": true gets the else case: "Example Logistics can move to contract review."

Input failures

A request that clears submission but breaks the declared input becomes a failed run. error names the first violation found: An error that names an input path is a request defect: resubmitting the same input fails the same way. For any other error on a declared-contract run, see error_details.retryable on Runs.

What to build next

Common errors

Last modified on September 25, 2026