POST/import-runs

createImportRun

The approved contract does not provide a longer purpose statement for this operation.

App
Accounting
Contract
Accounting API 0.1.1
Lifecycle
preview
Runtime
not-public
Operation ID
createImportRun
Canonical origin
Not declared; gateway routing required

Purpose and use cases

POST /import-runs

The owning App is Vision Accounting. Accounting owns financial records, exact arithmetic, approvals, audit evidence, workspace grants, and ledger invariants.

Business use cases and out-of-scope behavior are not yet declared in the approved OpenAPI description.

Request

POST /import-runs

This contract intentionally declares no direct server URL. Obtain the routed App origin before attempting the request.

Authentication and authorization

Send a Vision-issued bearer token for the exact App audience. The token must include the accounting entitlement and satisfy the aws-… accounting workspace required binding.

  • Required scope: accounting:imports:create

Human roles are not declared in OpenAPI. Record-level and business permission checks remain the owning App's authority.

Headers

  • Authorization: Bearer <access-token> — required.
  • Accept: application/json — recommended where a JSON response is declared.
  • Content-Type: application/json — required for the documented request representation.

Undeclared tracing, idempotency, conditional-request, and version headers are not assumed on this page.

Path and query parameters

NameLocationTypeRulesDescription
Idempotency-Keyheaderstringrequired; minimum length 16; maximum length 160; pattern ^[A-Za-z0-9._:-]+$Not described in the contract.

Request body

Media type: application/json. The body is required.

FieldTypeRulesDescription
schemaVersion"vision-accounting-import-create.v1"requiredNot described in the contract.
adapterIdstringrequiredNot described in the contract.
adapterContractVersion"vision-accounting-adapter.v1"requiredNot described in the contract.
adapterImplementationVersionstringrequiredNot described in the contract.
sourceApplicationobjectrequiredNot described in the contract.
modeopening_balances | summary_history | full_history | evidence_onlyrequiredNot described in the contract.
intendedCoverageobjectrequiredNot described in the contract.

Runnable examples

cURL
curl '${APP_BASE_URL}/import-runs' \
  --request POST \
  --header 'authorization: Bearer ${ACCESS_TOKEN}' \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{
    "schemaVersion": "vision-accounting-import-create.v1",
    "adapterId": "<adapterId>",
    "adapterContractVersion": "vision-accounting-adapter.v1",
    "adapterImplementationVersion": "<adapterImplementationVersion>",
    "sourceApplication": {},
    "mode": "opening_balances",
    "intendedCoverage": {}
  }'
JavaScript (server-side)
const response = await fetch('${APP_BASE_URL}/import-runs', {
  method: 'POST',
  headers: {
    authorization: `Bearer ${ACCESS_TOKEN}`,
    accept: 'application/json',
    'content-type': 'application/json',
  },
  body: JSON.stringify({
  "schemaVersion": "vision-accounting-import-create.v1",
  "adapterId": "<adapterId>",
  "adapterContractVersion": "vision-accounting-adapter.v1",
  "adapterImplementationVersion": "<adapterImplementationVersion>",
  "sourceApplication": {},
  "mode": "opening_balances",
  "intendedCoverage": {}
}),
}

if (!response.ok) throw new Error(`Vision API ${response.status}`)
const result = await response.json()
Python 3 standard library
import json
import urllib.parse
import urllib.request

request = urllib.request.Request(
    '${APP_BASE_URL}/import-runs',
    data=json.dumps({"schemaVersion":"vision-accounting-import-create.v1","adapterId":"<adapterId>","adapterContractVersion":"vision-accounting-adapter.v1","adapterImplementationVersion":"<adapterImplementationVersion>","sourceApplication":{},"mode":"opening_balances","intendedCoverage":{}}).encode(),
    headers={
    "Accept": "application/json",
    "Authorization": "Bearer <ACCESS_TOKEN>",
    "Content-Type": "application/json"
},
    method='POST',
)
with urllib.request.urlopen(request, timeout=30) as response:
    result = json.load(response)

The current TypeScript reference client covers Platform token exchange and core reads. No native SDK helper is declared for this operation; use the HTTP contract directly and follow the SDK guidance.

Responses

StatusMeaningSchema
201Durable Accounting command resultobject
400Safe Accounting errorobject
401Safe Accounting errorobject
403Safe Accounting errorobject
409Safe Accounting errorobject

Success response schema

FieldTypeRulesDescription
schemaVersion"vision-accounting-command-result.v1"requiredNot described in the contract.
operationstringrequiredNot described in the contract.
outcomesucceeded | pendingrequiredNot described in the contract.
commandReceiptReferencestringrequiredNot described in the contract.
subjectReferencestringrequiredNot described in the contract.
recordVersionintegerrequired; minimum 1Not described in the contract.
replayedbooleanrequiredNot described in the contract.
201 illustrative response
{
  "schemaVersion": "vision-accounting-command-result.v1",
  "operation": "<operation>",
  "outcome": "succeeded",
  "commandReceiptReference": "<commandReceiptReference>",
  "subjectReference": "<subjectReference>",
  "recordVersion": 1,
  "replayed": true
}

Errors and troubleshooting

Error bodies and codes are shown only where the approved contract declares them. Use status, the declared error schema, and any correlation identifier returned by the App; do not infer that two Apps share one envelope.

  • 400 Safe Accounting error
  • 401 Safe Accounting error
  • 403 Safe Accounting error
  • 409 Safe Accounting error

Collection behavior

Pagination: not declared. Filtering/search: not declared. Sorting: not declared.

Cursor lifetime, cursor binding, stable ordering, maximum traversal, and unknown-filter behavior are not assumed unless stated by a parameter description or schema constraint above.

Operational behavior

  • Rate limit: No operation-specific limit or 429 response is declared.
  • Retry: Retry only when the documented error model or response headers authorize it. Timeout and backoff values are not declared by this operation.
  • Idempotency: No idempotency header or replay window is declared.
  • Concurrency: No ETag, If-Match, or optimistic-version header is declared.

Security and privacy

  • Keep client credentials and bearer tokens on trusted servers.
  • Send only to the exact approved HTTPS origin and audience.
  • Treat response data according to the owning App's classification and retention policy; the OpenAPI contract does not itself grant data access.
  • Do not log credentials, tokens, complete private payloads, or secrets.

Edge cases and known documentation gaps

  • No detailed operation description.
  • No direct server URL; gateway routing is unresolved here.
  • One or more parameters have no field-level description.
  • The request body has no purpose or conditional-rule description.
  • Business roles, timeout, retry budget, rate value, idempotency window, and concurrency behavior are absent unless explicitly stated above.

Contract history and evidence

  • Contract version: 0.1.1
  • Approved snapshot SHA-256: 0274eb8dd78d6a7750706c01ab6515334b41a16fde8697e54ceb5f65f9bd8f27
  • Approval: Anthony, 2026-08-20T14:18:47.325Z (contract-unification-20260820)
  • Download the authoritative OpenAPI 3.1 snapshot