openapi: 3.0.3
info:
title: 'elEMZA — Public API v1'
description: 'Public REST API for Contract creation and Electronic Signature lifecycle. Bilingual (fa/en) errors. RFC 7807 problem+json envelope.'
version: 1.0.0
servers:
-
url: 'https://elemza.com'
tags:
-
name: Companies
description: "\nCheck a counterparty company before you send (Jibit P7, P6-P7-P16 design §6.3)."
-
name: Contracts
description: ''
-
name: 'Digital certificates (PKI)'
description: "\nIssuing a certificate is not something an API can do on somebody's behalf: the law wants an OTP\nthat person typed and a live face check they attended. So these endpoints do the part an API\nlegitimately can — start the enrolment, hand back a link for the person, and let the integrator\nfollow it to the end."
-
name: Endpoints
description: ''
-
name: 'Form submissions — fill a form through the API (ADR-0029)'
description: "\nSubmit-once semantics: no draft/resume, no edit-after-submit (FB SCOPE-CONTRACT rows 6/7).\nOwnership: every endpoint requires the form to BELONG to the token owner (v2 schema only) —\nthe integrator drives fills of their OWN forms; end users never hold tokens."
-
name: 'Forms — read-only access to v2 forms owned by the authenticated user.'
description: "\nPhase 5 MVP: list + show + stats. Submissions endpoint will land in Phase 5b\nwith proper pagination + transformer."
-
name: 'Meta — health, identity, quota, cost'
description: ''
-
name: Signers
description: "\nSigner endpoints for a contract.\n\nPhase 1 = read-only (index + show). Resend + delete = Phase 2 (mutations).\n\nSpec: docs/api-master-plan/02-endpoint-surface.md (Signer endpoints)."
-
name: Templates
description: "\nTemplate endpoints — read-only in v1.0. CRUD lands in v1.x.\n\nSpec: docs/api-master-plan/02-endpoint-surface.md (Template endpoints)."
-
name: Verification
description: ''
-
name: Webhooks
description: "\nOutbound webhook subscriptions. Customers create one or more endpoints, each\nfiltered by an array of event names. Deliveries are signed with HMAC-SHA256\nvia the secret returned at create-time (shown only once).\n\nScope: `webhooks:manage`."
components:
securitySchemes:
default:
type: http
scheme: bearer
description: 'Create your token in the dashboard at /dashboard/api-tokens. The plain token is shown once at creation. Format is {id}|{secret} — send it verbatim in the Authorization header, no pat_live_ prefix.'
security:
-
default: []
paths:
/api/v1/companies/check:
post:
summary: 'Check a company signer'
operationId: checkACompanySigner
description: "Asks the companies registry, before you add a company signer, for the company's official name and state and\nwhether the person who will sign for it is on its current board. Changes nothing (no idempotency key). Every\nanswer — free or paid — counts toward 50 checks a day per account (429 `preflight_daily_cap`). You see one of\nthree outcomes for the person: `no_warning`, `not_on_board` or `not_checked`; `signer_basis` is added only when\nyour account is an active representative of that company. A test token answers `not_checked` (`test_mode`).\nWhen the registry service is not available: 503 `inquiry_temporarily_unavailable` with `Retry-After`, or 403\n`inquiry_not_available`.\n\nScope: `signers:write`."
parameters: []
responses:
200:
description: ''
content:
application/json:
schema:
type: object
example:
data:
legal_national_code: '140****4567'
registry_name: 'آرین تجارت پارس'
status: active
status_fa: فعال
signer_check: not_on_board
checked_at: '2026-11-06T10:22:00.000000Z'
warnings:
-
code: signer_not_on_board
severity: high
title_fa: 'این شخص در فهرستِ فعلیِ هیئتمدیرهٔ این شرکت نیست.'
title_en: "This person is not on the company's current board."
properties:
data:
type: object
properties:
legal_national_code:
type: string
example: '140****4567'
registry_name:
type: string
example: 'آرین تجارت پارس'
status:
type: string
example: active
status_fa:
type: string
example: فعال
signer_check:
type: string
example: not_on_board
checked_at:
type: string
example: '2026-11-06T10:22:00.000000Z'
warnings:
type: array
example:
-
code: signer_not_on_board
severity: high
title_fa: 'این شخص در فهرستِ فعلیِ هیئتمدیرهٔ این شرکت نیست.'
title_en: "This person is not on the company's current board."
items:
type: object
properties:
code:
type: string
example: signer_not_on_board
severity:
type: string
example: high
title_fa:
type: string
example: 'این شخص در فهرستِ فعلیِ هیئتمدیرهٔ این شرکت نیست.'
title_en:
type: string
example: "This person is not on the company's current board."
422:
description: ''
content:
application/json:
schema:
type: object
example:
status: 422
code: validation
title_fa: 'مقادیر ارسالی نامعتبر است'
title_en: 'Request body validation failed'
properties:
status:
type: integer
example: 422
code:
type: string
example: validation
title_fa:
type: string
example: 'مقادیر ارسالی نامعتبر است'
title_en:
type: string
example: 'Request body validation failed'
429:
description: ''
content:
application/json:
schema:
type: object
example:
status: 429
code: preflight_daily_cap
title_fa: 'سقفِ روزانهٔ سنجشِ شرکت برای این حساب پر شده است.'
title_en: 'The daily company-check limit for this account is reached.'
properties:
status:
type: integer
example: 429
code:
type: string
example: preflight_daily_cap
title_fa:
type: string
example: 'سقفِ روزانهٔ سنجشِ شرکت برای این حساب پر شده است.'
title_en:
type: string
example: 'The daily company-check limit for this account is reached.'
503:
description: ''
content:
application/json:
schema:
type: object
example:
status: 503
code: inquiry_temporarily_unavailable
title_fa: 'این استعلام الان در دسترس نیست؛ کمی بعد دوباره امتحان کنید.'
title_en: 'This inquiry is temporarily unavailable.'
properties:
status:
type: integer
example: 503
code:
type: string
example: inquiry_temporarily_unavailable
title_fa:
type: string
example: 'این استعلام الان در دسترس نیست؛ کمی بعد دوباره امتحان کنید.'
title_en:
type: string
example: 'This inquiry is temporarily unavailable.'
tags:
- Companies
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
legal_national_code:
type: string
description: "The company's 11-digit national ID."
example: '14001234567'
signer_national_code:
type: string
description: 'The national code of the person who will sign for the company.'
example: '0012345678'
required:
- legal_national_code
'/api/v1/contracts/{code}/dl':
get:
summary: 'Public signed-URL download.'
operationId: publicSignedURLDownload
description: "Validates Laravel's `signed` middleware. No Bearer token required —\nthe URL signature is the auth proof. The signature is generated by\n`downloadPdf()` after the bearer was verified, so this is functionally\nequivalent to a 24h time-bounded capability URL.\n\nRecords an `ApiRequestLog`-style entry via the underlying `ContractDownload`\naudit table (same trail as the user-panel signed-link download flow)."
parameters: []
responses:
404:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/not_found'
status: 404
code: not_found
title_fa: 'منبع یافت نشد'
title_en: 'Resource not found'
request_id: 01M7RWG8TPHX5KAGZGRCCXFBXN
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/not_found'
status:
type: integer
example: 404
code:
type: string
example: not_found
title_fa:
type: string
example: 'منبع یافت نشد'
title_en:
type: string
example: 'Resource not found'
request_id:
type: string
example: 01M7RWG8TPHX5KAGZGRCCXFBXN
tags:
- Contracts
parameters:
-
in: path
name: code
description: '16-char public code.'
example: architecto
required: true
schema:
type: string
/api/v1/contracts:
get:
summary: 'List contracts'
operationId: listContracts
description: "Returns the paginated contracts the token's user may see:\n\n- contracts they created;\n- contracts in which they are a signer;\n- if they manage members in an organisation (the organisation's owner, or a member's direct\n manager): those members' contracts — except contracts marked private and contracts issued\n in a company's name.\n\nWith `scope=org`, a member whose organisation owner has granted them «see the organisation's\ncontracts» also receives the owner's and every other member's contracts, under the same two\nexclusions. Without that permission `scope=org` changes nothing and is not an error. The\ndefault (no `scope`) never widens, so an existing «my contracts» sync keeps receiving exactly\nwhat it received before the permission was granted.\n\nScope: `contracts:read`.\n\n**PII filter scope requirement:** filtering by `signer_mobile` or\n`signer_national_code` requires the additional `signers:read_pii` ability\non your token. Without it, those query parameters return\n**403 `scope_missing`**. This prevents a low-privilege `contracts:read`\ntoken from using the index as a confirmation oracle to check whether a\ngiven mobile/national-code signs any contract on the owner's tree.\n\nThe `*` wildcard scope also passes the check."
parameters:
-
in: query
name: status
description: 'Filter by status: draft|waiting_signature|completed|voided|canceled.'
example: waiting_signature
required: false
schema:
type: string
description: 'Filter by status: draft|waiting_signature|completed|voided|canceled.'
example: waiting_signature
-
in: query
name: signature_method
description: 'Filter by signing method: electronic|digital.'
example: digital
required: false
schema:
type: string
description: 'Filter by signing method: electronic|digital.'
example: digital
-
in: query
name: created_after
description: 'ISO 8601 datetime.'
example: '2026-01-01T00:00:00Z'
required: false
schema:
type: string
description: 'ISO 8601 datetime.'
example: '2026-01-01T00:00:00Z'
-
in: query
name: created_before
description: 'ISO 8601 datetime.'
example: architecto
required: false
schema:
type: string
description: 'ISO 8601 datetime.'
example: architecto
-
in: query
name: signer_mobile
description: 'Iran mobile regex 09XXXXXXXXX. **Requires `signers:read_pii` scope.**'
example: '09121234567'
required: false
schema:
type: string
description: 'Iran mobile regex 09XXXXXXXXX. **Requires `signers:read_pii` scope.**'
example: '09121234567'
-
in: query
name: signer_national_code
description: '10-digit Iran national code. **Requires `signers:read_pii` scope.**'
example: architecto
required: false
schema:
type: string
description: '10-digit Iran national code. **Requires `signers:read_pii` scope.**'
example: architecto
-
in: query
name: template_id
description: 'Filter by template.'
example: 16
required: false
schema:
type: integer
description: 'Filter by template.'
example: 16
-
in: query
name: is_private
description: 'Filter by privacy flag.'
example: false
required: false
schema:
type: boolean
description: 'Filter by privacy flag.'
example: false
-
in: query
name: scope
description: "Only accepted value: `org`. Adds the contracts of your organisation's owner and of every member (never private ones, never ones in a company's name), when the owner has granted you «see the organisation's contracts». Without that permission it returns the same list as no `scope`."
example: org
required: false
schema:
type: string
description: "Only accepted value: `org`. Adds the contracts of your organisation's owner and of every member (never private ones, never ones in a company's name), when the owner has granted you «see the organisation's contracts». Without that permission it returns the same list as no `scope`."
example: org
-
in: query
name: role
description: 'Narrows the list to one side of the contract: `sent` — contracts you created (with `scope=org`: also those created by the members that scope shows you); `received` — contracts in which you are a signer and which you did not create; `all` — the default, exactly the list without `role`.'
example: sent
required: false
schema:
type: string
description: 'Narrows the list to one side of the contract: `sent` — contracts you created (with `scope=org`: also those created by the members that scope shows you); `received` — contracts in which you are a signer and which you did not create; `all` — the default, exactly the list without `role`.'
example: sent
-
in: query
name: q
description: 'Part of the title (1..120 chars), case-insensitive; Arabic «ي/ك» and Persian «ی/ک» are treated as the same letter, and `%`/`_` are literal characters.'
example: اجاره
required: false
schema:
type: string
description: 'Part of the title (1..120 chars), case-insensitive; Arabic «ي/ك» and Persian «ی/ک» are treated as the same letter, and `%`/`_` are literal characters.'
example: اجاره
-
in: query
name: waiting_over_days
description: 'Contracts still `waiting_signature` whose signers were added more than this many days ago (1..3650).'
example: 7
required: false
schema:
type: integer
description: 'Contracts still `waiting_signature` whose signers were added more than this many days ago (1..3650).'
example: 7
-
in: query
name: updated_since
description: "ISO 8601 instant with an offset (`2026-10-23T08:30:00Z`, `…+03:30`) or a date (`2026-10-23`, the start of that day in Tehran time); contracts whose `updated_at` is at or after it. Note: a signer signing does not by itself change a contract's `updated_at`."
example: '2026-10-23T08:30:00Z'
required: false
schema:
type: string
description: "ISO 8601 instant with an offset (`2026-10-23T08:30:00Z`, `…+03:30`) or a date (`2026-10-23`, the start of that day in Tehran time); contracts whose `updated_at` is at or after it. Note: a signer signing does not by itself change a contract's `updated_at`."
example: '2026-10-23T08:30:00Z'
-
in: query
name: ends_before
description: 'Declared end date (`facts.end_date`) on or before this day. Jalali `1405/08/01` (Persian digits accepted) or ISO `2026-10-23`; any other shape is 422 — a Jalali year written with dashes is refused, never shifted.'
example: 1405/09/30
required: false
schema:
type: string
description: 'Declared end date (`facts.end_date`) on or before this day. Jalali `1405/08/01` (Persian digits accepted) or ISO `2026-10-23`; any other shape is 422 — a Jalali year written with dashes is refused, never shifted.'
example: 1405/09/30
-
in: query
name: ends_after
description: 'Declared end date on or after this day; same formats as `ends_before`.'
example: 1405/07/01
required: false
schema:
type: string
description: 'Declared end date on or after this day; same formats as `ends_before`.'
example: 1405/07/01
-
in: query
name: counterparty
description: 'Part of the declared counterparty name (`facts.counterparty_name`), case-insensitive.'
example: آلفا
required: false
schema:
type: string
description: 'Part of the declared counterparty name (`facts.counterparty_name`), case-insensitive.'
example: آلفا
-
in: query
name: type
description: 'The declared contract type (`facts.contract_type`), whole value, case-insensitive.'
example: "اجاره\n\n`signer_mobile`, `signer_national_code`, `counterparty`, `type`, `ends_before` and `ends_after` ask about what\nthe SENDER holds, so they only ever match contracts you sent (or see through your company or organisation):\na contract you only sign is left out of a list filtered on any of them."
required: false
schema:
type: string
description: 'The declared contract type (`facts.contract_type`), whole value, case-insensitive.'
example: "اجاره\n\n`signer_mobile`, `signer_national_code`, `counterparty`, `type`, `ends_before` and `ends_after` ask about what\nthe SENDER holds, so they only ever match contracts you sent (or see through your company or organisation):\na contract you only sign is left out of a list filtered on any of them."
-
in: query
name: page
description: 'Default 1.'
example: 16
required: false
schema:
type: integer
description: 'Default 1.'
example: 16
-
in: query
name: per_page
description: 'Max 100. Default 20.'
example: 16
required: false
schema:
type: integer
description: 'Max 100. Default 20.'
example: 16
-
in: query
name: sort
description: 'created_at | -created_at | completed_at | -completed_at. Default -created_at.'
example: architecto
required: false
schema:
type: string
description: 'created_at | -created_at | completed_at | -completed_at. Default -created_at.'
example: architecto
responses:
401:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/token_invalid'
status: 401
code: token_invalid
title_fa: 'توکن نامعتبر است'
title_en: 'Invalid token'
request_id: 01M7RWG8YDY0XXC1SRA382NZ0D
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/token_invalid'
status:
type: integer
example: 401
code:
type: string
example: token_invalid
title_fa:
type: string
example: 'توکن نامعتبر است'
title_en:
type: string
example: 'Invalid token'
request_id:
type: string
example: 01M7RWG8YDY0XXC1SRA382NZ0D
403:
description: 'PII filter without scope'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/scope_missing'
status: 403
code: scope_missing
title_fa: 'این فیلتر نیاز به مجوز signers:read_pii دارد'
title_en: 'This filter requires the signers:read_pii scope'
request_id: 01KRH8JRC4Y855P10CYC1C0AYS
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/scope_missing'
status:
type: integer
example: 403
code:
type: string
example: scope_missing
title_fa:
type: string
example: 'این فیلتر نیاز به مجوز signers:read_pii دارد'
title_en:
type: string
example: 'This filter requires the signers:read_pii scope'
request_id:
type: string
example: 01KRH8JRC4Y855P10CYC1C0AYS
tags:
- Contracts
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
status:
type: string
description: ''
example: draft
enum:
- draft
- waiting_signature
- completed
- voided
- canceled
nullable: true
signature_method:
type: string
description: ''
example: electronic
enum:
- electronic
- digital
nullable: true
created_after:
type: string
description: 'value یک تاریخ معتبر نیست.'
example: '2026-11-19T06:39:47'
nullable: true
created_before:
type: string
description: 'value یک تاریخ معتبر نیست.'
example: '2026-11-19T06:39:47'
nullable: true
signer_mobile:
type: string
description: 'Must match the regex /^09[0-9]{9}$/.'
example: '09564255931'
nullable: true
signer_national_code:
type: string
description: 'value باید 10 کاراکتر باشد.'
example: ikhwaykcmy
nullable: true
template_id:
type: integer
description: ''
example: 16
nullable: true
is_private:
type: boolean
description: ''
example: true
nullable: true
scope:
type: string
description: ''
example: org
enum:
- org
nullable: true
page:
type: integer
description: 'value باید حداقل 1 باشد.'
example: 22
nullable: true
per_page:
type: integer
description: 'value باید حداقل 1 باشد. value نباید بیشتر از 100 باشد.'
example: 7
nullable: true
sort:
type: string
description: ''
example: '-created_at'
enum:
- created_at
- '-created_at'
- completed_at
- '-completed_at'
nullable: true
role:
type: string
description: '── MCP W1-API (05 §7) — every one optional; absent ⇒ the list is exactly as before ──.'
example: received
enum:
- sent
- received
- all
nullable: true
q:
type: string
description: 'value باید حداقل 1 کاراکتر باشد. value نباید بیشتر از 120 کاراکتر باشد.'
example: z
nullable: true
waiting_over_days:
type: integer
description: 'value باید حداقل 1 باشد. value نباید بیشتر از 3650 باشد.'
example: 17
nullable: true
updated_since:
type: string
description: 'value نباید بیشتر از 40 کاراکتر باشد.'
example: i
nullable: true
ends_before:
type: string
description: 'value نباید بیشتر از 20 کاراکتر باشد.'
example: yvdljnikhwaykcmy
nullable: true
ends_after:
type: string
description: 'value نباید بیشتر از 20 کاراکتر باشد.'
example: uwpwlvqwrsitcpsc
nullable: true
counterparty:
type: string
description: 'value باید حداقل 1 کاراکتر باشد. value نباید بیشتر از 200 کاراکتر باشد.'
example: q
nullable: true
type:
type: string
description: 'value باید حداقل 1 کاراکتر باشد. value نباید بیشتر از 64 کاراکتر باشد.'
example: l
nullable: true
post:
summary: 'Create contract'
operationId: createContract
description: "Creates a new contract. Two modes:\n\n**One-shot** — multipart/form-data with `file` field + metadata. File is\npersisted to staging and `ProcessContractFilesJob` is dispatched. Optional\n`signers[]` are added by the same job after page rasterization completes.\nResponse is **202 Accepted**; poll `_links.processing` until `ready=true`.\n\n**Multi-step** — JSON without `file`. Creates a `draft` contract row only.\nCaller then issues `POST /contracts/{code}/files` to attach the document. Until it is attached the\ncontract cannot be sent: `POST /contracts/{code}/signers` answers 422 `document_required` and adds,\ncharges and texts nothing. After the upload, wait until `GET /contracts/{code}/processing` answers\n`ready=true` (or the `contract.processing.completed` webhook) and then add the signers — the signing\nSMS does not wait for the pages. To skip the wait, send `signers` inline with the file in one call.\n\n### Signature placement — `template_id` + `template_enforcement`\n\nPassing `template_id` snapshots that template's signature slots onto the new\ncontract. `template_enforcement` decides what those slots MEAN to the signer:\n\n- `locked` — each slot is pinned: the signer cannot drag the signature off it,\n and cannot sign on a page the template never assigned them.\n **This is the default whenever `template_id` is present.**\n- `suggested` — the signature merely *starts* on the slot; the signer may move\n it anywhere, on any page.\n\n`strict` / `loose` are accepted as legacy aliases of `locked` / `suggested`\n(the spelling earlier revisions of this page advertised).\n\nIf the template pins slots on more than one page, send `all_pages_signature=true`\nas well — otherwise one signature on any allowed page completes the contract.\n\n`locked` fixes WHERE each mark goes; by itself it does not make the signer use every slot —\none signature is enough and a pinned stamp, name or date slot may stay empty. Send\n`require_all_placements=true` to make every slot pinned for a signer a condition of signing:\nthe signing page puts the name and the date on their slots by itself, shows each empty slot,\nand refuses to record the signature until the signature and stamp slots are used too.\nIt is stored only beside a `locked` template that pins at least one slot (otherwise the\nresponse reports `false`), and it never applies to a signer the template pins nothing for.\n\nVerify what was applied on the create response (`template_id`,\n`template_enforcement`) or in full via `GET /contracts/{code}` → `template_positions`.\n\nEvery contract response also carries `facts` (what you declared, or `null`) and `via`: `null`, or\n`{client_name, kind}` when the contract was sent through an AI-assistant connection (MCP). `via`\ncannot be set from the request body or a header.\n\n### Discount code — `discount_code`\n\nSend the same code you would type in the panel. It is stored on the contract and applied when the\nsigners are added — by this call (one-shot) or by a later `POST /contracts/{code}/signers`, which\ntakes no discount parameter of its own. It works in every `payer_mode`: with `creator` it lowers\nwhat your wallet is charged; with `signer` / `designated` it lowers the total the payers split.\nThe contract responses echo it as `discount_code`.\n\nWhat the code does NOT promise — the same rules as the panel:\n\n- **It is checked now and applied later, and nothing is reserved in between.** A code that expires, is\n deactivated or reaches its usage limit before the signers are added gives no discount, and the send\n is charged in full. With a limited-use code, add the signers in the same call.\n- **A send your package quota covers entirely costs nothing, so it gets no discount** and does not count\n as a use of the code (`payer_mode=creator` only — the sharing modes do not use quota).\n- **With `payer_mode=creator`, every batch of signers you add is charged with the code**, and each\n charge counts as one use of it.\n- A code with a minimum purchase applies only to a send that reaches it.\n\n`GET /cost-estimate?signers=N&contract={code}` returns the amount that will actually be charged.\n\n### Send a stuck digital contract again as electronic — `replaces`\n\nWhen a signer of your waiting **digital** contract cannot get a certificate, send `replaces` with that\ncontract's code and nothing else (optionally `signature_method=electronic`). The waiting contract ends — `canceled`\nif nobody signed, `voided` with its signed pages kept if only your side signed (or a counterparty signed while\n«withdraw after signature» is enabled) — and a NEW **electronic** contract is created with the same document, the\nsame signers in the same order and the same signature boxes; the signing SMS goes again at each signer's turn. The\nold contract's `signature_method` never changes. This is exactly the panel's «ارسالِ دوباره با امضای الکترونیک»:\nthe same rule, the same price, one implementation.\n\n- **Money:** the old contract's payment carries to the new one. Half of today's price is charged only when\n switching costs something — a signer who passed identity on the old contract must be checked again, or someone\n already signed digitally. A certificate fee prepaid for a signer whose certificate never issued is refunded.\n- **Only your own** waiting digital contract (anyone else's — 404 `not_found`), with the same kind of token that\n created it (409 `sandbox_mode_mismatch`). Test contracts cannot be replaced.\n- Any other field beside `replaces` (`title`, `file`, `source`, `signers`, `payer_mode`, …) is 422\n `replaces_conflict`: the point is «the same document, the same people».\n- A contract that can never be resent (already ended, not digital, a test contract, an attached document, made\n from a form, signers pay) is 409 `replace_not_allowed`. A refusal that depends on something that can change\n (the feature switched off, your identity verification, the company or trade name it was sent under, a\n counterparty signed while «withdraw after signature» is off, the document missing) is 403\n `replace_not_available` — not stored under your `Idempotency-Key`: fix the cause and send the same request.\n A signature that landed during the call is 409 `replace_state_changed`; another resend of the same contract\n in progress is 409 `replace_busy` — retry both with the same key. The reason is always in `title_fa`; nothing\n is ended or charged.\n- `replaces` must be the only field of the body; a query-string parameter does not count.\n- With `X-Skip-Sms: true`, or when the old contract was already sent that way, nobody is texted: deliver each\n signer's `signing_url` yourself, as before.\n- Webhooks: the old contract fires `contract.canceled` (and `contract.voided` when voided) with\n `reason=replaced_by_electronic`; the new one fires `contract.created`. The responses carry the link both ways:\n `replaces` / `replaced_by` on `GET /contracts/{code}`.\n- Send an `Idempotency-Key`: a retried request replays the first answer instead of finding the old contract ended.\n\nThe answer is 202 with the new contract (its `replaces` is the old code) and `meta.charged` — what this call\ndeducted from the wallet, in toman (0 when the payment carried — and 0 when the half was taken from your package\nquota instead) — and `meta.refunds_due`: the total of refunds the resend left due (a certificate pre-payment back to\nyou, AND a certificate fee back to the signer's own wallet who paid it), paid as soon as no enrolment can use them.\n\nScope: `contracts:write`."
parameters: []
responses:
402:
description: 'one-shot send with signers, wallet cannot cover the fee — nothing is created; retrying will not help until the wallet is topped up'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/insufficient_balance'
status: 402
code: insufficient_balance
title_fa: 'موجودی کیف پول کافی نیست'
title_en: 'Insufficient wallet balance'
meta:
balance_toman: 29750
required_toman: 60500
shortfall_toman: 30750
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/insufficient_balance'
status:
type: integer
example: 402
code:
type: string
example: insufficient_balance
title_fa:
type: string
example: 'موجودی کیف پول کافی نیست'
title_en:
type: string
example: 'Insufficient wallet balance'
meta:
type: object
properties:
balance_toman:
type: integer
example: 29750
required_toman:
type: integer
example: 60500
shortfall_toman:
type: integer
example: 30750
403:
description: 'replaces: refused for a reason that can change (the switch, your verification or company, the withdraw rule) — nothing ended or charged; not stored under the Idempotency-Key'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/replace_not_available'
status: 403
code: replace_not_available
title_fa: 'ارسالِ دوباره با امضای الکترونیک فعلاً فعال نیست.'
title_en: 'This contract cannot be sent again as electronic right now; fix the cause and send the same request again'
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/replace_not_available'
status:
type: integer
example: 403
code:
type: string
example: replace_not_available
title_fa:
type: string
example: 'ارسالِ دوباره با امضای الکترونیک فعلاً فعال نیست.'
title_en:
type: string
example: 'This contract cannot be sent again as electronic right now; fix the cause and send the same request again'
409:
description: ''
content:
application/json:
schema:
oneOf:
-
description: 'replaces: this contract can never be resent (e.g. signers pay, already ended) — nothing ended or charged'
type: object
example:
type: 'https://docs.elemza.com/errors/replace_not_allowed'
status: 409
code: replace_not_allowed
title_fa: 'این قرارداد منتظرِ امضا نیست.'
title_en: 'This contract cannot be sent again as electronic in its current state'
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/replace_not_allowed'
status:
type: integer
example: 409
code:
type: string
example: replace_not_allowed
title_fa:
type: string
example: 'این قرارداد منتظرِ امضا نیست.'
title_en:
type: string
example: 'This contract cannot be sent again as electronic in its current state'
-
description: 'replaces: another resend of the same contract is running — retry shortly'
type: object
example:
type: 'https://docs.elemza.com/errors/replace_busy'
status: 409
code: replace_busy
title_fa: 'همین قرارداد همین حالا در حالِ ارسالِ دوباره است؛ چند ثانیهٔ دیگر دوباره امتحان کنید.'
title_en: 'This contract is being sent again by another request; retry shortly'
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/replace_busy'
status:
type: integer
example: 409
code:
type: string
example: replace_busy
title_fa:
type: string
example: 'همین قرارداد همین حالا در حالِ ارسالِ دوباره است؛ چند ثانیهٔ دیگر دوباره امتحان کنید.'
title_en:
type: string
example: 'This contract is being sent again by another request; retry shortly'
-
description: 'replaces: a signature landed (or the price changed) while it was being sent — nothing ended or charged; not stored under the Idempotency-Key, send the same request again'
type: object
example:
type: 'https://docs.elemza.com/errors/replace_state_changed'
status: 409
code: replace_state_changed
title_fa: 'هزینهٔ نسخهٔ تازه از وقتی این پنجره باز شد عوض شده است؛ دوباره باز کنید و ببینید.'
title_en: 'The contract changed while it was being sent again; nothing changed — send the same request again'
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/replace_state_changed'
status:
type: integer
example: 409
code:
type: string
example: replace_state_changed
title_fa:
type: string
example: 'هزینهٔ نسخهٔ تازه از وقتی این پنجره باز شد عوض شده است؛ دوباره باز کنید و ببینید.'
title_en:
type: string
example: 'The contract changed while it was being sent again; nothing changed — send the same request again'
422:
description: ''
content:
application/json:
schema:
oneOf:
-
description: 'template_id not reachable by the caller'
type: object
example:
type: 'https://docs.elemza.com/errors/template_not_accessible'
status: 422
code: template_not_accessible
title_fa: 'قالب انتخابشده وجود ندارد یا در دسترس شما نیست'
title_en: 'The selected template does not exist or is not accessible to you'
request_id: 01KRH8JRC4Y855P10CYC1C0AYS
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/template_not_accessible'
status:
type: integer
example: 422
code:
type: string
example: template_not_accessible
title_fa:
type: string
example: 'قالب انتخابشده وجود ندارد یا در دسترس شما نیست'
title_en:
type: string
example: 'The selected template does not exist or is not accessible to you'
request_id:
type: string
example: 01KRH8JRC4Y855P10CYC1C0AYS
-
description: 'discount_code is unknown, inactive, expired, used up or not issued to this account — nothing is created'
type: object
example:
type: 'https://docs.elemza.com/errors/discount_code_invalid'
status: 422
code: discount_code_invalid
title_fa: 'کد تخفیف معتبر نیست یا برای این حساب قابل استفاده نیست؛ آن را اصلاح کنید یا نفرستید'
title_en: 'The discount code is not valid for this account; correct it or omit discount_code'
request_id: 01KRH8JRC4Y855P10CYC1C0AYS
errors:
-
field: discount_code
code: invalid
title_fa: 'کد تخفیف معتبر نیست'
title_en: 'Invalid discount code'
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/discount_code_invalid'
status:
type: integer
example: 422
code:
type: string
example: discount_code_invalid
title_fa:
type: string
example: 'کد تخفیف معتبر نیست یا برای این حساب قابل استفاده نیست؛ آن را اصلاح کنید یا نفرستید'
title_en:
type: string
example: 'The discount code is not valid for this account; correct it or omit discount_code'
request_id:
type: string
example: 01KRH8JRC4Y855P10CYC1C0AYS
errors:
type: array
example:
-
field: discount_code
code: invalid
title_fa: 'کد تخفیف معتبر نیست'
title_en: 'Invalid discount code'
items:
type: object
properties:
field:
type: string
example: discount_code
code:
type: string
example: invalid
title_fa:
type: string
example: 'کد تخفیف معتبر نیست'
title_en:
type: string
example: 'Invalid discount code'
-
description: 'replaces sent with another field — nothing is ended or created'
type: object
example:
type: 'https://docs.elemza.com/errors/replaces_conflict'
status: 422
code: replaces_conflict
title_fa: 'با «replaces» همان سند و همان امضاکنندگان دوباره فرستاده میشوند؛ فیلدِ دیگری نفرستید'
title_en: 'With replaces the same document and signers are sent again; send no other field'
errors:
-
field: title
code: not_allowed_with_replaces
title_fa: 'این فیلد کنارِ replaces پذیرفته نمیشود'
title_en: 'Not allowed with replaces'
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/replaces_conflict'
status:
type: integer
example: 422
code:
type: string
example: replaces_conflict
title_fa:
type: string
example: 'با «replaces» همان سند و همان امضاکنندگان دوباره فرستاده میشوند؛ فیلدِ دیگری نفرستید'
title_en:
type: string
example: 'With replaces the same document and signers are sent again; send no other field'
errors:
type: array
example:
-
field: title
code: not_allowed_with_replaces
title_fa: 'این فیلد کنارِ replaces پذیرفته نمیشود'
title_en: 'Not allowed with replaces'
items:
type: object
properties:
field:
type: string
example: title
code:
type: string
example: not_allowed_with_replaces
title_fa:
type: string
example: 'این فیلد کنارِ replaces پذیرفته نمیشود'
title_en:
type: string
example: 'Not allowed with replaces'
tags:
- Contracts
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
title:
type: string
description: 'Contract title (1..255 chars — the same limit as the panel).'
example: 'قرارداد بیمه شخص ثالث'
replaces:
type: string
description: "Optional — the 16-character code of YOUR waiting DIGITAL contract to send again as\n electronic (see «Send a stuck digital contract again as electronic» above). Sent alone: then `title` is not\n required and every other field is refused (422 `replaces_conflict`)."
example: ABC1234567XYZ890
discount_code:
type: string
description: "Optional discount code (max 32 chars, case-insensitive). A code that is\n unknown, inactive, expired, used up or not issued to your account is rejected with 422\n `discount_code_invalid` and nothing is created — it is never silently dropped. Validity is\n checked now and the amount is computed when signers are added; nothing is reserved in\n between (see «Discount code» above for when a stored code gives no discount). A contract's\n code cannot be changed after creation."
example: WELCOME10
signature_method:
type: string
description: "electronic|digital. Default electronic. `digital` = PADES\n signature via the Pendar CA cloud-HSM. Requires the PKI feature to be enabled for\n your account (pre-flight via `GET /me` → `data.capabilities.pki`), otherwise\n **403 `pki_not_available`**. The method is contract-wide (all signers sign the same\n way) and IMMUTABLE after creation — to change it, cancel and recreate (ADR-0009)."
example: architecto
all_pages_signature:
type: boolean
description: "Default false. When true, every page must carry the signature element.\n Refused (422) together with `signer_mode=multi`."
example: false
signer_mode:
type: string
description: "Only with `signature_method=digital`: `solo` (exactly one signer — electronic-style\n placement, then one invisible digital seal) or `multi` (two or more signers, each adding one signature\n in turn). Omit it and a digital contract behaves exactly as before — nothing below is checked. When\n sent: with `electronic` it is 422; the signer count must fit (inline `signers` at creation, and the\n `POST /contracts/{code}/signers` batch later — 422 `signer_mode_mismatch`, nothing added or charged);\n with `multi` the template must suit a multi-signer digital contract (signers 2+ pin at most one\n «signature» each, no stamp/name/date, no «all signers» box — 422 `template_not_digital_compatible`)\n and `all_pages_signature` must not be true."
example: multi
wet_signature_page:
type: integer
description: "`0` = no visible signature mark: the signed PDF carries only the digital\n signature, and each signer only confirms they read the document. Only with `signature_method=digital`\n and `signer_mode=multi` (where the panel offers it); anywhere else 422. `-1` (or omitting it) keeps\n the default — each signer places a visible signature."
example: 0
send_at:
type: string
description: "Optional scheduled send: ISO-8601 date-time WITH an explicit offset (`Z` or `+03:30`),\n strictly in the future and at most 3 months ahead (the panel's window); outside it is 422 and nothing\n is created. The signers are added — and the send is charged — when they are added (inline or by\n `POST /contracts/{code}/signers`); only the signing SMS waits until this moment. Signers added after\n it has passed get their SMS at once. With `send_at`, the bounds of `signing_deadline_at` are measured\n from `send_at`, not from now."
example: '2026-11-20T06:30:00Z'
is_private:
type: boolean
description: 'Default false. When true, hides contract from org-ancestors.'
example: false
legal_entity_id:
type: integer
description: "Optional — send this contract on behalf of one of your\n registered companies. The signer's SMS, the signing page and the signed PDF then\n carry that company's name instead of yours. List the ids you may use via\n `GET /api/v1/me` (`data.legal_entities`).\n\n **Account default.** If you set a default company in the panel\n («شرکتهای من» → «پیشفرضِ من باشد»), OMITTING this field sends the contract on\n behalf of that company — so an integration that always signs as the company needs\n no code change at all. `GET /api/v1/me` reports it as\n `data.default_legal_entity_id`, so you can always tell which name a contract will\n go out under BEFORE you create it. With no default set, omitting the field sends\n under your own name, exactly as before.\n\n **To send one contract personally while a default is set, pass `0`** (or `null`).\n An absent field means «use my default»; an explicit `0` means «me, personally».\n These are deliberately different — a caller that cannot say «personally» would\n have no way back out of the default."
example: 16
organisation_sender:
type: boolean
description: 'Optional — `true` sends this one contract under the name of the ORGANISATION you are a member of (its verified company), even when your account has a default company. Only for a member the organisation lends its name to (a full manager, or a member set to «بهنامِ سازمان»), and only while the organisation has a verified company; otherwise 422 `organisation_not_available` and nothing is created. It cannot be sent together with `legal_entity_id` or `trade_name_id`, whatever their value (422 `sender_conflict`). Absent or `false`: nothing changes.'
example: false
trade_name_id:
type: integer
description: "Optional — send this contract under one of your TRADE NAMES (نامِ تجاری, e.g. a shop name from your guild licence); the signer reads «فروشگاه مهر (علی رضایی)» in the SMS, e-mail and signing page. You remain the party of the contract, the signer and the invoice buyer. List the ids via `GET /api/v1/me` → `data.trade_names` (`can_use`). **A trade name is never chosen by omitting this field**; `0` means «me, personally» (and overrides an account default company). Another user's id → 422 `trade_name_not_accessible`; yours but not usable now (licence ended, identity to be re-verified) → 422 `trade_name_not_usable`; together with `legal_entity_id` > 0 → 422 `sender_conflict`. The response carries `data.sender` {name, as, trade_name, legal_entity_id}.\n `legal_entity_id: 0` now means «personally» for organisation members too (it used to let an organisation's company speak for an Admin member who asked to be personal).\n\n A company you do not actively represent is rejected with 422\n `legal_entity_not_accessible`; one whose registered board term has expired with\n 422 `legal_entity_board_expired`. If your account default has itself become\n unusable (representation revoked, company archived), creation fails with 422\n `default_legal_entity_unusable` rather than silently reverting to your personal\n name."
example: 7
template_id:
type: integer
description: "Optional — must be owned by the caller or shared from the org root;\n anything else is rejected with 422 `template_not_accessible` (never silently dropped).\n List valid ids via `GET /api/v1/templates`."
example: 26
template_enforcement:
type: string
description: "locked|suggested (legacy aliases: strict|loose).\n Defaults to `locked` when `template_id` is set."
example: locked
require_all_placements:
type: boolean
description: "Default false. With a `locked` template: the signer must use\n every slot the template pins for them (signature, stamp, name, date) before the signature is\n recorded. Ignored without a `locked` template that pins a slot."
example: false
redirect_url:
type: string
description: "HTTPS URL to send the signer back to after they finish signing.\n They see our confirmation first, then return automatically. Without it they stay on our\n confirmation page."
example: 'https://partner.example/contracts/42/signed'
file:
type: string
format: binary
description: 'PDF or PNG/JPG, max 4MB (multipart/form-data only).'
source:
type: object
description: "Optional document source instead of `file` (JSON body). One of:\n\n `{type: \"form_submission\", code: \"ABCD1234EFGH5678\"}` — uses the rendered PDF of one\n of YOUR form submissions as this contract's document (the فرم → PDF → امضا chain,\n works with both signature methods). 409 `not_ready` if the submission PDF is still\n rendering; 422 `not_applicable` for online-renderer forms (no PDF artifact).\n\n `{type: \"url\", url: \"https://…\"}` — we download the document from that link once, before\n anything is created: HTTPS on port 443 only, no redirects, at most 4 MB, and it must be a\n PDF, PNG or JPEG by its content. A link that points at a private or internal address (or\n whose name resolves to one) is refused. Every refusal is 422 `source_url_refused` with\n `meta.reason` (`not_https`, `credentials_in_url`, `port_not_allowed`, `internal_hostname`,\n `dns_unresolvable`, `private_address`, `redirect`, `http_status`, `too_large`,\n `unsupported_type`, `empty`, `timeout`, `connect_failed`, `tls_error`, `fetch_failed`).\n The link itself is not stored and its query string is never logged.\n\n `{type: \"upload\", id: \"01J…\"}` — a file the account owner put on an elEMZA upload page\n started by an AI-assistant connection. Usable once, by that owner, while it has not\n expired; anything else is 422 `upload_not_usable` with `meta.reason` (`not_found`,\n `not_ready`, `expired`, `consumed`, `files_invalid`). The upload belongs to the mode of\n the connection that started it: a test-mode upload with a live token (or the reverse)\n is 409 `upload_mode_mismatch`, and the upload is not consumed.\n\n Whatever the source, the created contract records the SHA-256 of the document's bytes\n (for several files, of their digests joined by newlines in order)."
example: []
properties: { }
signers:
type: array
description: 'Optional inline signers (one-shot). Same shape as POST /contracts/{code}/signers.'
example:
- architecto
items:
type: string
signature_sheet_labels:
type: array
description: "Optional — «امضا روی برگِ پایانی»: instead of boxes on the document, ONE\n A4 page is appended to it with one labelled box per signature, and every signature lands in its own\n box on that page. 1 to 8 labels; each is printed above its box as given (at most 60 characters\n after trimming, no control characters), and an empty string prints «امضاکنندهٔ ۱», «امضاکنندهٔ ۲» ….\n Box *i* belongs to the signer whose `template_slot` is *i* — every signer, inline or added later with\n `POST /contracts/{code}/signers`, must send one, and every box needs its own signer: send exactly as\n many signers as labels, each person once (fewer, or one mobile twice, is 422 — a box nobody holds\n would stay empty on the completed document). The page is part of the document people sign (it is\n counted in `page_count` and in the document digest); `GET /contracts/{code}` returns its page as\n `signature_sheet_page` once the document is processed. The boxes are `locked`: each signature is\n accepted only in its box. Refused (422, nothing created) together with `template_id`,\n `all_pages_signature=true`, `wet_signature_page=0` or `template_enforcement=suggested`. The page is\n always A4 portrait, so a landscape or non-A4 document ends on a page of another size; more than 8\n signatures cannot use it."
example:
- 'امضای فروشنده'
- 'امضای خریدار'
items:
type: string
payer_mode:
type: string
description: "Who pays the signature fee. `creator` (default) — your wallet pays the whole\n fee when signers are added, exactly as before. `signer` — the fee is split equally between ALL\n signers and each pays their share on the signing page before signing. `designated` — split only\n between the signers you flag with `is_payer: true`; everyone else signs for free.\n\n In `signer` and `designated` your wallet is charged a **commitment** of half of each payer's\n share when signers are added. It comes back to you when that signer pays. If a payer neither\n pays nor signs within the settlement window, the contract is cancelled and that half is kept.\n Check availability first via `GET /me` → `data.capabilities.signer_pays`\n (and `signer_pays_window_days`).\n\n A sharing mode that is not available is rejected with 422 `payer_mode_unavailable` — it is\n never silently switched to `creator`. `designated` with signers but no `is_payer` is 422\n `payer_required`; `is_payer` in any other mode is 422 `payer_not_applicable`. Test (sandbox)\n tokens record the mode but move no money and ask no signer to pay."
example: signer
signing_deadline_at:
type: string
description: "Optional ISO-8601 date-time WITH an explicit offset (`Z` or `+03:30`) after which nobody new may sign — a zone-less or relative value («tomorrow») is 422. At least\n one hour and at most 180 days from now (the life of the signing link); outside that range is\n 422 `validation` and nothing is created. Omit it for no deadline (the default — exactly as\n before). When it passes: a contract nobody has signed is cancelled (`contract.canceled` with\n `reason: signing_deadline`, refund by the usual cancel rule); a contract someone has signed stays\n `waiting_signature` but accepts no further signature until the owner extends the deadline in\n the panel. Either way `contract.signing_deadline.passed` fires with `outcome` `canceled` or\n `closed`. With `payer_mode` `signer`/`designated` the payment window never ends later than this.\n In the two-step flow the deadline is re-checked when the document or the signers arrive:\n passed or less than an hour away ⇒ 422 `signing_deadline_passed`.\n Returned as `signing_deadline_at` (and `signing_closed_at` once signing was closed)."
example: '2026-11-05T14:30:00Z'
facts:
type: object
description: "Optional facts you DECLARE about the contract, so you can later list «which\n contracts end next quarter» (`GET /contracts?ends_before=…`). Keys, all optional:\n `counterparty_name` (≤ 190), `contract_type` (≤ 64), `start_date`, `end_date` (Jalali\n `1405/08/01` or ISO `2026-10-23`; the end not before the start), `amount_toman` (integer\n ≥ 0), `auto_renew` (boolean), `notes` (≤ 1000), `end_reminder_days` (`7`, `30` or `60` — we remind\n you that many days before `end_date`, and with 30 or 60 again 7 days before; needs an `end_date`).\n An unknown key or an unreadable date is\n 422 and nothing is created. They are returned on every contract response as `facts`\n (dates in both calendars, `declared: true`, `source`), and can be corrected later with\n `PATCH /contracts/{code}/facts`. Apart from that reminder, nothing automatic acts on them."
example:
counterparty_name: 'شرکت آلفا'
end_date: 1406/07/29
end_reminder_days: 30
properties: { }
on_company_warning:
type: string
description: "With inline company signers: `continue` (default — sent, and the 202 carries\n `meta.company_checks`) or `refuse` (409 `company_check_warning` on a high warning; nothing is created)."
example: refuse
required:
- title
'/api/v1/contracts/{code}':
get:
summary: 'Get contract'
operationId: getContract
description: "Returns full contract shape with embedded signers, per-page geometry,\nand template positions snapshot.\n\nScope: `contracts:read`."
parameters: []
responses:
401:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/token_invalid'
status: 401
code: token_invalid
title_fa: 'توکن نامعتبر است'
title_en: 'Invalid token'
request_id: 01M7RWG8ZX94862188Q12E80ZJ
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/token_invalid'
status:
type: integer
example: 401
code:
type: string
example: token_invalid
title_fa:
type: string
example: 'توکن نامعتبر است'
title_en:
type: string
example: 'Invalid token'
request_id:
type: string
example: 01M7RWG8ZX94862188Q12E80ZJ
tags:
- Contracts
delete:
summary: 'Cancel contract'
operationId: cancelContract
description: "Cancels a contract in `draft` or `waiting_signature` state. Refunds the\nbilled amount to the original wallet (100% if no signer signed, 50% if any\nShahkar was consumed). Deletes contract files from storage. Waiting signers\nreceive an SMS notifying them the contract was canceled.\n\nUse the same kind of token (live/test) that created the contract: a test token on a live\ncontract, or a live token on a test one, is 409 `sandbox_mode_mismatch` and nothing is\ncancelled, deleted, refunded or sent.\n\nScope: `contracts:write`."
parameters: []
responses:
200:
description: ''
content:
application/json:
schema:
type: object
example:
data:
code: ABC1234567XYZ890
status: canceled
canceled_at: '2026-05-11T10:00:00.000Z'
refund:
amount: 60000
currency: IRT
end_reason: manual
properties:
data:
type: object
properties:
code:
type: string
example: ABC1234567XYZ890
status:
type: string
example: canceled
canceled_at:
type: string
example: '2026-05-11T10:00:00.000Z'
refund:
type: object
properties:
amount:
type: integer
example: 60000
currency:
type: string
example: IRT
end_reason:
type: string
example: manual
409:
description: 'token of the other mode (test token, live contract — or the reverse); nothing changed'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/sandbox_mode_mismatch'
status: 409
code: sandbox_mode_mismatch
title_fa: 'این قرارداد با توکنِ زنده ساخته شده؛ آن را با همان نوع توکن لغو کنید'
title_en: 'This contract was created with a live token; cancel it with the same kind of token'
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/sandbox_mode_mismatch'
status:
type: integer
example: 409
code:
type: string
example: sandbox_mode_mismatch
title_fa:
type: string
example: 'این قرارداد با توکنِ زنده ساخته شده؛ آن را با همان نوع توکن لغو کنید'
title_en:
type: string
example: 'This contract was created with a live token; cancel it with the same kind of token'
tags:
- Contracts
parameters:
-
in: path
name: code
description: '16-char public code (A-Z, 0-9).'
example: ABC1234567XYZ890
required: true
schema:
type: string
'/api/v1/contracts/{code}/pdf':
get:
summary: 'Download signed PDF'
operationId: downloadSignedPDF
description: "Returns the final signed PDF in one of three formats (Phase 3):\n\n- `format=redirect` (default) — `302 Found` to a signed URL (24h TTL).\n The signed URL points at the unauthenticated `/api/v1/contracts/{code}/dl`\n route, which validates the signature and streams the file. Use this when\n embedding in `` for partner-facing UIs.\n- `format=url` — JSON envelope with `url`, `expires_at`, `filename`, `size_bytes`,\n `checksum_sha256`. Use this when the API client wants to hand the URL\n to another system, embed in email, or pre-flight before downloading.\n- `format=stream` — streams the PDF inline (consumes API egress). Use when\n the caller is a backend service that wants the bytes in one round-trip.\n\nScope: `contracts:read`."
parameters:
-
in: query
name: format
description: 'redirect|url|stream. Default redirect.'
example: url
required: false
schema:
type: string
description: 'redirect|url|stream. Default redirect.'
example: url
-
in: query
name: ttl
description: 'Signed URL lifetime in seconds (60..86400). Default 86400. Ignored when `format=stream`.'
example: 16
required: false
schema:
type: integer
description: 'Signed URL lifetime in seconds (60..86400). Default 86400. Ignored when `format=stream`.'
example: 16
responses:
404:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/not_found'
status: 404
code: not_found
title_fa: 'منبع یافت نشد'
title_en: 'Resource not found'
request_id: 01M7RWG90BPSV23D8MVNN9X59C
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/not_found'
status:
type: integer
example: 404
code:
type: string
example: not_found
title_fa:
type: string
example: 'منبع یافت نشد'
title_en:
type: string
example: 'Resource not found'
request_id:
type: string
example: 01M7RWG90BPSV23D8MVNN9X59C
tags:
- Contracts
parameters:
-
in: path
name: code
description: '16-char public code.'
example: architecto
required: true
schema:
type: string
'/api/v1/contracts/{code}/processing':
get:
summary: 'Poll processing status'
operationId: pollProcessingStatus
description: "Lightweight (<200 bytes) status of the rasterization + signer-creation job.\n\n🩸 THIS DOCBLOCK USED TO SAY «no DB hit», AND THAT WAS FALSE — corrected 2026-08-31.\n It reads one `SELECT` for the contract, `ContractPolicy::view()` then calls\n `$user->hasRole([...])`, and the outermost middleware on this route\n (`App\\Http\\Middleware\\Api\\LogApiRequest`) writes a synchronous `INSERT` into\n `api_request_logs`. So the honest description is: at least two reads and one write,\n per poll, and the load-lab measured this single endpoint taking **84.9% of all server\n time** in a saturation run (1,494 calls at a fixed 1.5 s interval).\n\n That mattered more than a wrong sentence usually does: a session reading «no DB hit»\n concludes this endpoint is already cheap and never looks at the expensive part, which\n is not in this controller at all.\n\nTwo things went the same day: the `withCount('signers')` this query used to carry — a\ncorrelated sub-SELECT on every poll whose result the JSON below never returned — and the\ntwo redundant single-column indexes on `api_request_logs`.\n\n**Step values:** `files`, `signers`, `sms`, `done`, `error`.\n\nReturns `ready=true` when `step=done`. If progress key is gone (TTL expired)\nand contract has signers + pages, falls back to `ready=true` (job finished\nearlier and key was reaped).\n\n🔑 An integrator polling this in a loop is doing it the expensive way. The\n`contract.processing.completed` webhook fires from the same moment\n(`ProcessContractFilesJob` → `ContractProcessingCompletedApiEvent` →\n`FanOutContractProcessingCompleted`) and removes the loop entirely.\n\nScope: `contracts:read`."
parameters: []
responses:
404:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/not_found'
status: 404
code: not_found
title_fa: 'منبع یافت نشد'
title_en: 'Resource not found'
request_id: 01M7RWG90TR4QAYYVF30NAAVSA
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/not_found'
status:
type: integer
example: 404
code:
type: string
example: not_found
title_fa:
type: string
example: 'منبع یافت نشد'
title_en:
type: string
example: 'Resource not found'
request_id:
type: string
example: 01M7RWG90TR4QAYYVF30NAAVSA
tags:
- Contracts
parameters:
-
in: path
name: code
description: '16-char contract code.'
example: architecto
required: true
schema:
type: string
'/api/v1/contracts/{code}/files':
post:
summary: 'Upload contract file(s) (two-step flow)'
operationId: uploadContractFilestwoStepFlow
description: "Attaches a file to an existing **draft** contract that has no pages yet.\nSame async pipeline as `POST /contracts` one-shot: stages bytes, dispatches\n`ProcessContractFilesJob`, returns 202 with the `processing` link.\n\nA contract has exactly one document. Once one is attached — by `POST /contracts` with a\n`file`/`source`, or by an earlier call here, even while it is still processing — another\nupload is 409 `document_already_attached` and the recorded document is unchanged. To use a\ndifferent document, cancel the contract and create a new one. Use the same kind of token\n(live/test) that created the contract, else 409 `sandbox_mode_mismatch`.\n\nThe one exception: a document that **could not be processed** (`GET /contracts/{code}/processing` answers\n`step=error` and the contract has no pages) is no document. Upload the corrected file here; it replaces the\nfailed one. Signers sent inline with the failed one-shot request were never added — add them with\n`POST /contracts/{code}/signers` once the new document is ready.\n\nAn electronic replacement (`replaces` set) takes no file here, in any state — its document is the replaced\ncontract's: 409 `replacement_document_fixed`. If it failed for good, the answer says so; cancel it or contact support.\n\nAfter the 202, wait for `GET /contracts/{code}/processing` to answer `ready=true` (or for the\n`contract.processing.completed` webhook) before adding signers: the signing SMS does not wait for the pages.\n\nA contract created with `signing_deadline_at` is re-checked here against the CURRENT time: if the deadline\nhas passed or is less than an hour away the upload is 422 `signing_deadline_passed` and nothing is staged.\n\nScope: `contracts:write`."
parameters: []
responses:
409:
description: ''
content:
application/json:
schema:
oneOf:
-
description: 'the contract already has its document (attached at creation or by an earlier upload)'
type: object
example:
type: 'https://docs.elemza.com/errors/document_already_attached'
status: 409
code: document_already_attached
title_fa: 'این قرارداد قبلاً سند دارد و سندش جایگزین نمیشود؛ برای سندِ دیگر، این قرارداد را لغو و قراردادِ تازه بسازید'
title_en: 'This contract already has its document and it cannot be replaced; cancel it and create a new contract for another document'
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/document_already_attached'
status:
type: integer
example: 409
code:
type: string
example: document_already_attached
title_fa:
type: string
example: 'این قرارداد قبلاً سند دارد و سندش جایگزین نمیشود؛ برای سندِ دیگر، این قرارداد را لغو و قراردادِ تازه بسازید'
title_en:
type: string
example: 'This contract already has its document and it cannot be replaced; cancel it and create a new contract for another document'
-
description: "an electronic replacement (`replaces` set): its document is the replaced contract's and is prepared by the system — no file is accepted, in any state"
type: object
example:
type: 'https://docs.elemza.com/errors/replacement_document_fixed'
status: 409
code: replacement_document_fixed
title_fa: 'سندِ این نسخهٔ الکترونیک همان سندِ قراردادِ قبلی است و سامانه خودش آن را آماده میکند؛ فایلِ دیگری پذیرفته نمیشود.'
title_en: "This electronic replacement's document is the replaced contract's and is prepared by the system; another file is not accepted."
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/replacement_document_fixed'
status:
type: integer
example: 409
code:
type: string
example: replacement_document_fixed
title_fa:
type: string
example: 'سندِ این نسخهٔ الکترونیک همان سندِ قراردادِ قبلی است و سامانه خودش آن را آماده میکند؛ فایلِ دیگری پذیرفته نمیشود.'
title_en:
type: string
example: "This electronic replacement's document is the replaced contract's and is prepared by the system; another file is not accepted."
-
description: 'an electronic replacement whose document could not be prepared — waiting will not help; cancel it or contact support'
type: object
example:
type: 'https://docs.elemza.com/errors/replacement_document_fixed'
status: 409
code: replacement_document_fixed
title_fa: 'سندِ این نسخهٔ الکترونیک آماده نشد و امضاکنندگانش منتقل نمیشوند؛ صبرکردن کمکی نمیکند. این قرارداد را لغو کنید یا با پشتیبانی تماس بگیرید.'
title_en: "This electronic replacement's document could not be prepared; another file is not accepted. Cancel it or contact support."
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/replacement_document_fixed'
status:
type: integer
example: 409
code:
type: string
example: replacement_document_fixed
title_fa:
type: string
example: 'سندِ این نسخهٔ الکترونیک آماده نشد و امضاکنندگانش منتقل نمیشوند؛ صبرکردن کمکی نمیکند. این قرارداد را لغو کنید یا با پشتیبانی تماس بگیرید.'
title_en:
type: string
example: "This electronic replacement's document could not be prepared; another file is not accepted. Cancel it or contact support."
tags:
- Contracts
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
file:
type: string
format: binary
description: 'PDF or PNG/JPG, max 4MB (multipart/form-data).'
required:
- file
parameters:
-
in: path
name: code
description: '16-char contract code.'
example: architecto
required: true
schema:
type: string
'/api/v1/contracts/{code}/withdraw':
post:
summary: 'Withdraw contract'
operationId: withdrawContract
description: "Takes a contract back **after at least one signer has signed and before the last one has** — the\nsender changed his mind, or found a mistake the signers must not sign. Until everyone has signed\nnothing is binding, so no one else's consent is needed. Use `DELETE /contracts/{code}` instead\nwhile nobody has signed.\n\nThe contract becomes `voided` with `end_reason` `withdrawn_by_sender`. The signed pages are KEPT\n(they are evidence), the refund and the package quota follow the same rule as a cancel, waiting\nsigners receive the cancellation SMS, and signers who already signed are told. Your `reason` is\nstored for your own records and the audit trail; it is not sent to the signers or in the webhook.\nThe `contract.voided` webhook fires — the specific event — and `contract.canceled` fires too, with\n`reason` `withdrawn_by_sender`, so an integration that only knows `contract.canceled` still learns the\ncontract ended. Handle `contract.voided` and ignore a `contract.canceled` whose `reason` is\n`withdrawn_by_sender` if you subscribe to both.\n\nOnly the account that created the contract may withdraw it. The feature is switched off until it\nis enabled for the platform; while off, every call is 403 `withdraw_not_available`. With a test\ntoken on a test contract nothing is charged, refunded or texted.\n\nScope: `contracts:write`."
parameters: []
responses:
200:
description: ''
content:
application/json:
schema:
type: object
example:
data:
code: ABC1234567XYZ890
status: voided
voided_at: '2026-10-29T10:00:00.000Z'
refund:
amount: 30000
currency: IRT
reason: contract_withdrawn
end_reason: withdrawn_by_sender
properties:
data:
type: object
properties:
code:
type: string
example: ABC1234567XYZ890
status:
type: string
example: voided
voided_at:
type: string
example: '2026-10-29T10:00:00.000Z'
refund:
type: object
properties:
amount:
type: integer
example: 30000
currency:
type: string
example: IRT
reason:
type: string
example: contract_withdrawn
end_reason:
type: string
example: withdrawn_by_sender
403:
description: "not the contract's creator"
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/policy_denied'
status: 403
code: policy_denied
title_fa: 'فقط فرستندهٔ قرارداد میتواند آن را پس بگیرد.'
title_en: "Only the contract's creator can withdraw it"
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/policy_denied'
status:
type: integer
example: 403
code:
type: string
example: policy_denied
title_fa:
type: string
example: 'فقط فرستندهٔ قرارداد میتواند آن را پس بگیرد.'
title_en:
type: string
example: "Only the contract's creator can withdraw it"
409:
description: 'nobody has signed yet, everyone has signed, or the contract has ended'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/not_withdrawable'
status: 409
code: not_withdrawable
title_fa: 'همهٔ امضاکنندگان امضا کردهاند؛ این قرارداد دیگر پسگرفتنی نیست.'
title_en: 'The contract cannot be withdrawn in its current state'
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/not_withdrawable'
status:
type: integer
example: 409
code:
type: string
example: not_withdrawable
title_fa:
type: string
example: 'همهٔ امضاکنندگان امضا کردهاند؛ این قرارداد دیگر پسگرفتنی نیست.'
title_en:
type: string
example: 'The contract cannot be withdrawn in its current state'
tags:
- Contracts
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
reason:
type: string
description: 'Why you are taking it back, 10–500 characters.'
example: 'مبلغِ بندِ دوم اشتباه نوشته شده بود.'
required:
- reason
parameters:
-
in: path
name: code
description: '16-char public code.'
example: architecto
required: true
schema:
type: string
'/api/v1/contracts/{code}/facts':
patch:
summary: "Declare or correct a contract's facts"
operationId: declareOrCorrectAContractsFacts
description: "Merges into what is already declared: a key you leave out is unchanged, a key sent as `null`\nis cleared. Only the contract's creator may declare — a signer can read the facts on\n`GET /contracts/{code}`, not change them. Every change clears `confirmed_at` (a confirmation\nwas of the old values). When every field ends up empty the facts are removed and `data` is\n`null`.\n\nSend `confirm: true` to mark the declared facts as confirmed — e.g. once the contract has gone\nout with them. Alone it changes no field (and not `source`); with changes in the same body it\nconfirms the new values. Confirming again keeps the first `confirmed_at`. With nothing declared\nthere is nothing to confirm: `data` is `null`. Any value other than `true` is 422.\n\nDates: Jalali `1405/08/01` (Persian digits accepted) or ISO `2026-10-23`; stored as the\nGregorian day and returned in both calendars. A Jalali year written with dashes\n(`1405-08-01`) is refused, never shifted six centuries.\n\nScope: `contracts:write`. Send an `Idempotency-Key` to make a retry safe."
parameters: []
responses:
200:
description: ''
content:
application/json:
schema:
type: object
example:
data:
counterparty_name: 'شرکت آلفا'
contract_type: اجاره
start_date: '2026-10-23'
start_date_jalali: 1405/08/01
end_date: '2027-10-21'
end_date_jalali: 1406/07/29
amount_toman: 120000000
auto_renew: false
notes: null
source: api
confirmed: false
confirmed_at: null
confirmed_at_jalali: null
declared: true
properties:
data:
type: object
properties:
counterparty_name:
type: string
example: 'شرکت آلفا'
contract_type:
type: string
example: اجاره
start_date:
type: string
example: '2026-10-23'
start_date_jalali:
type: string
example: 1405/08/01
end_date:
type: string
example: '2027-10-21'
end_date_jalali:
type: string
example: 1406/07/29
amount_toman:
type: integer
example: 120000000
auto_renew:
type: boolean
example: false
notes:
type: string
example: null
nullable: true
source:
type: string
example: api
confirmed:
type: boolean
example: false
confirmed_at:
type: string
example: null
nullable: true
confirmed_at_jalali:
type: string
example: null
nullable: true
declared:
type: boolean
example: true
403:
description: 'you can see it (e.g. as a signer) but did not create it'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/policy_denied'
status: 403
code: policy_denied
title_fa: 'فقط سازندهٔ قرارداد میتواند اطلاعاتِ آن را اعلام کند'
title_en: "Only the contract's creator can declare its facts"
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/policy_denied'
status:
type: integer
example: 403
code:
type: string
example: policy_denied
title_fa:
type: string
example: 'فقط سازندهٔ قرارداد میتواند اطلاعاتِ آن را اعلام کند'
title_en:
type: string
example: "Only the contract's creator can declare its facts"
404:
description: 'unknown code, or a contract you cannot see'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/not_found'
status: 404
code: not_found
title_fa: 'قرارداد یافت نشد'
title_en: 'Contract not found'
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/not_found'
status:
type: integer
example: 404
code:
type: string
example: not_found
title_fa:
type: string
example: 'قرارداد یافت نشد'
title_en:
type: string
example: 'Contract not found'
tags:
- Contracts
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
counterparty_name:
type: string
description: 'The other party, as written on the document (≤ 190).'
example: 'شرکت آلفا'
contract_type:
type: string
description: 'What kind of contract it is (≤ 64), e.g. «اجاره», «خدمات».'
example: اجاره
start_date:
type: string
description: 'First day of the term — Jalali `1405/08/01` or ISO `2026-10-23`.'
example: 1405/08/01
end_date:
type: string
description: 'Last day of the term; not before `start_date`. Same formats.'
example: 1406/07/30
amount_toman:
type: integer
description: 'The contract amount in Toman, ≥ 0.'
example: 120000000
auto_renew:
type: boolean
description: 'Whether the contract renews by itself.'
example: false
notes:
type: string
description: 'Free text, ≤ 1000 characters.'
example: 'تمدید با توافق کتبی'
end_reminder_days:
type: integer
description: "Remind the contract's sender this many days before `end_date` — `7`, `30` or `60`, or `null` for no reminder. Needs an `end_date` that has not passed. With 30 or 60 a second reminder follows 7 days before."
example: 30
confirm:
type: boolean
description: 'Only `true`: mark the declared facts as confirmed (`confirmed`, `confirmed_at`).'
example: true
parameters:
-
in: path
name: code
description: '16-char public code.'
example: ABC1234567XYZ890
required: true
schema:
type: string
/api/v1/certificates:
get:
summary: 'Certificate status for one of your people'
operationId: certificateStatusForOneOfYourPeople
description: "Answers \"can this person sign digitally yet?\" for somebody you have enrolled.\n\n**Privacy** — this is not a lookup service for arbitrary national codes. It only answers for\npeople you yourself started an enrolment for; anyone else returns 404, so the endpoint cannot\nbe used to discover whether a given Iranian holds a certificate.\n\nScope required: `certificates:read`."
parameters:
-
in: query
name: national_code
description: "The person's national code."
example: '0010350829'
required: true
schema:
type: string
description: "The person's national code."
example: '0010350829'
responses:
200:
description: ''
content:
application/json:
schema:
oneOf:
-
description: 'Active certificate'
type: object
example:
data:
national_code: '0010350829'
status: active
valid_from: '2026-07-30T09:12:00.000Z'
valid_until: '2027-07-30T09:12:00.000Z'
mode: live
properties:
data:
type: object
properties:
national_code:
type: string
example: '0010350829'
status:
type: string
example: active
valid_from:
type: string
example: '2026-07-30T09:12:00.000Z'
valid_until:
type: string
example: '2027-07-30T09:12:00.000Z'
mode:
type: string
example: live
-
description: 'Enrolment still in progress'
type: object
example:
data:
national_code: '0010350829'
status: pending_ekyc
valid_from: null
valid_until: null
mode: live
properties:
data:
type: object
properties:
national_code:
type: string
example: '0010350829'
status:
type: string
example: pending_ekyc
valid_from:
type: string
example: null
nullable: true
valid_until:
type: string
example: null
nullable: true
mode:
type: string
example: live
tags:
- 'Digital certificates (PKI)'
'/api/v1/certificates/{id}':
get:
summary: 'One enrolment request'
operationId: oneEnrolmentRequest
description: "The state of a single enrolment you started, by the `request_id` you received.\n\nScope required: `certificates:read`."
parameters: []
responses:
401:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/token_invalid'
status: 401
code: token_invalid
title_fa: 'توکن نامعتبر است'
title_en: 'Invalid token'
request_id: 01M7RWG9758NSZWEFCPQ3SPB8K
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/token_invalid'
status:
type: integer
example: 401
code:
type: string
example: token_invalid
title_fa:
type: string
example: 'توکن نامعتبر است'
title_en:
type: string
example: 'Invalid token'
request_id:
type: string
example: 01M7RWG9758NSZWEFCPQ3SPB8K
tags:
- 'Digital certificates (PKI)'
parameters:
-
in: path
name: id
description: 'The `request_id` from the onboarding call.'
example: 01jqk8x2m4n6p8r0s2t4v6w8y0
required: true
schema:
type: string
/api/v1/certificates/onboarding:
post:
summary: 'Start a certificate enrolment'
operationId: startACertificateEnrolment
description: "Creates a short-lived, single-use link for one of your users to obtain a digital certificate.\nSend them to `onboarding_url`; they complete the SMS code, the identity form and the video\ncheck on our pages, and you learn the outcome from `certificate.issued` / `certificate.failed`\n(or by polling `GET /api/v1/certificates/{request_id}`).\n\n**Who pays** — `pay_by: \"issuer\"` charges YOUR wallet for the one-time issuance fee right now\nand refunds it automatically if no certificate is ever issued. `pay_by: \"subject\"` (default)\nlets the person pay on the page.\n\n**Idempotency** — while an enrolment for the same national code is still open you get the SAME\nlink back, not a second one. Pendar treats an open enrolment as a single order.\n\nScope required: `certificates:write`."
parameters: []
responses:
201:
description: 'Link created'
content:
application/json:
schema:
type: object
example:
data:
request_id: 01jqk8x2m4n6p8r0s2t4v6w8y0
onboarding_url: 'https://elemza.com/pki/onboarding/01jqk8x2m4n6p8r0s2t4v6w8y0?expires=...&signature=...'
expires_at: '2026-07-30T12:00:00.000Z'
status: pending
pay_by: issuer
mode: live
properties:
data:
type: object
properties:
request_id:
type: string
example: 01jqk8x2m4n6p8r0s2t4v6w8y0
onboarding_url:
type: string
example: 'https://elemza.com/pki/onboarding/01jqk8x2m4n6p8r0s2t4v6w8y0?expires=...&signature=...'
expires_at:
type: string
example: '2026-07-30T12:00:00.000Z'
status:
type: string
example: pending
pay_by:
type: string
example: issuer
mode:
type: string
example: live
tags:
- 'Digital certificates (PKI)'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
national_code:
type: string
description: "The person's 10-digit national code."
example: '0010350829'
mobile:
type: string
description: 'Their mobile, 09xxxxxxxxx.'
example: '09121234567'
first_name:
type: string
description: 'Optional, prefills the form.'
example: علی
last_name:
type: string
description: 'Optional, prefills the form.'
example: رضایی
pay_by:
type: string
description: '`issuer` or `subject` (default).'
example: issuer
redirect_url:
type: string
description: 'HTTPS URL to send the person back to when they finish.'
example: 'https://partner.example/done'
ttl_minutes:
type: integer
description: 'Link lifetime, 5–1440 (default 60).'
example: 120
required:
- national_code
- mobile
/api/documentation:
get:
summary: 'Invoke the controller method.'
operationId: invokeTheControllerMethod
description: ''
parameters: []
responses:
500:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/internal_error'
status: 500
code: internal_error
title_fa: 'خطای داخلی سرور'
title_en: 'Internal server error'
request_id: 01M7RWG9DWE7WEE3KA8MTMPXY1
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/internal_error'
status:
type: integer
example: 500
code:
type: string
example: internal_error
title_fa:
type: string
example: 'خطای داخلی سرور'
title_en:
type: string
example: 'Internal server error'
request_id:
type: string
example: 01M7RWG9DWE7WEE3KA8MTMPXY1
tags:
- Endpoints
'/api/v1/form-submissions/{code}/dl':
get:
summary: "Public signed-URL download twin (no Bearer — the URL signature is the auth proof,\nminted by downloadPdf() after the bearer was verified). Mirrors contracts /dl."
operationId: publicSignedURLDownloadTwinnoBearerTheURLSignatureIsTheAuthProofMintedByDownloadPdfAfterTheBearerWasVerifiedMirrorsContractsdl
description: ''
parameters: []
responses:
404:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/not_found'
status: 404
code: not_found
title_fa: 'منبع یافت نشد'
title_en: 'Resource not found'
request_id: 01M7RWG8WEN7FG20F0QQ53D2A9
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/not_found'
status:
type: integer
example: 404
code:
type: string
example: not_found
title_fa:
type: string
example: 'منبع یافت نشد'
title_en:
type: string
example: 'Resource not found'
request_id:
type: string
example: 01M7RWG8WEN7FG20F0QQ53D2A9
tags:
- 'Form submissions — fill a form through the API (ADR-0029)'
parameters:
-
in: path
name: code
description: '16-char submission code.'
example: architecto
required: true
schema:
type: string
'/api/v1/form-submissions/{code}/files/{field}/dl':
get:
summary: "Public signed-URL twin for a single field file (no Bearer — the signature is the auth\nproof, minted by downloadFieldFile() only after the bearer was verified)."
operationId: publicSignedURLTwinForASingleFieldFilenoBearerTheSignatureIsTheAuthProofMintedByDownloadFieldFileOnlyAfterTheBearerWasVerified
description: ''
parameters: []
responses:
404:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/not_found'
status: 404
code: not_found
title_fa: 'منبع یافت نشد'
title_en: 'Resource not found'
request_id: 01M7RWG8WN0SYK2DV0P3HVRFEV
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/not_found'
status:
type: integer
example: 404
code:
type: string
example: not_found
title_fa:
type: string
example: 'منبع یافت نشد'
title_en:
type: string
example: 'Resource not found'
request_id:
type: string
example: 01M7RWG8WN0SYK2DV0P3HVRFEV
tags:
- 'Form submissions — fill a form through the API (ADR-0029)'
parameters:
-
in: path
name: code
description: '16-char submission code.'
example: architecto
required: true
schema:
type: string
-
in: path
name: field
description: "The field's technical `name`."
example: architecto
required: true
schema:
type: string
'/api/v1/forms/{slug}/submissions':
get:
summary: 'List submissions'
operationId: listSubmissions
description: 'Paginated, newest first. Scope: `forms:read`.'
parameters:
-
in: query
name: status
description: draft|pending_payment|submitted|processing|completed|signed.
example: architecto
required: false
schema:
type: string
description: draft|pending_payment|submitted|processing|completed|signed.
example: architecto
-
in: query
name: submitted_after
description: 'ISO 8601.'
example: architecto
required: false
schema:
type: string
description: 'ISO 8601.'
example: architecto
-
in: query
name: submitted_before
description: 'ISO 8601.'
example: architecto
required: false
schema:
type: string
description: 'ISO 8601.'
example: architecto
-
in: query
name: has_contract
description: 'Only submissions that bridged to a contract that is still live (true), or that have none — never made, or cancelled/withdrawn (false).'
example: false
required: false
schema:
type: boolean
description: 'Only submissions that bridged to a contract that is still live (true), or that have none — never made, or cancelled/withdrawn (false).'
example: false
-
in: query
name: reference
description: 'Only the submission(s) you stored under this `reference` (exact match).'
example: 'wc:shop.ir:1234'
required: false
schema:
type: string
description: 'Only the submission(s) you stored under this `reference` (exact match).'
example: 'wc:shop.ir:1234'
-
in: query
name: per_page
description: 'Max 100, default 20.'
example: 16
required: false
schema:
type: integer
description: 'Max 100, default 20.'
example: 16
responses:
401:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/token_invalid'
status: 401
code: token_invalid
title_fa: 'توکن نامعتبر است'
title_en: 'Invalid token'
request_id: 01M7RWG94TETS16W58DNC7KJH0
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/token_invalid'
status:
type: integer
example: 401
code:
type: string
example: token_invalid
title_fa:
type: string
example: 'توکن نامعتبر است'
title_en:
type: string
example: 'Invalid token'
request_id:
type: string
example: 01M7RWG94TETS16W58DNC7KJH0
tags:
- 'Form submissions — fill a form through the API (ADR-0029)'
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
status:
type: string
description: ''
example: signed
enum:
- draft
- pending_payment
- submitted
- processing
- completed
- signed
nullable: true
submitted_after:
type: string
description: 'value یک تاریخ معتبر نیست.'
example: '2026-11-19T06:39:48'
nullable: true
submitted_before:
type: string
description: 'value یک تاریخ معتبر نیست.'
example: '2026-11-19T06:39:48'
nullable: true
has_contract:
type: boolean
description: ''
example: false
nullable: true
reference:
type: string
description: 'value نباید بیشتر از 100 کاراکتر باشد.'
example: b
nullable: true
page:
type: integer
description: 'value باید حداقل 1 باشد.'
example: 22
nullable: true
per_page:
type: integer
description: 'value باید حداقل 1 باشد. value نباید بیشتر از 100 باشد.'
example: 7
nullable: true
post:
summary: ''
operationId: postApiV1FormsSlugSubmissions
description: ''
parameters: []
responses: { }
tags:
- 'Form submissions — fill a form through the API (ADR-0029)'
parameters:
-
in: path
name: slug
description: "The form's slug."
example: architecto
required: true
schema:
type: string
'/api/v1/forms/{slug}/submissions/{code}':
get:
summary: 'Get one submission'
operationId: getOneSubmission
description: 'Scope: `forms:read`.'
parameters: []
responses:
404:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/not_found'
status: 404
code: not_found
title_fa: 'منبع یافت نشد'
title_en: 'Resource not found'
request_id: 01M7RWG95490WW1DTM1VVFS9K4
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/not_found'
status:
type: integer
example: 404
code:
type: string
example: not_found
title_fa:
type: string
example: 'منبع یافت نشد'
title_en:
type: string
example: 'Resource not found'
request_id:
type: string
example: 01M7RWG95490WW1DTM1VVFS9K4
tags:
- 'Form submissions — fill a form through the API (ADR-0029)'
parameters:
-
in: path
name: slug
description: "The form's slug."
example: architecto
required: true
schema:
type: string
-
in: path
name: code
description: '16-char submission code.'
example: architecto
required: true
schema:
type: string
'/api/v1/forms/{slug}/submissions/{code}/pdf':
get:
summary: 'Download submission PDF'
operationId: downloadSubmissionPDF
description: "Image-overlay forms render a final PDF per submission (queued at submit). Same\nsigned-URL family as the contracts PDF endpoint:\n\n- `format=redirect` (default) — 302 to a signed URL (anon-safe, forwardable)\n- `format=url` — JSON envelope with url/expiry/checksum\n- `format=stream` — bytes in this response\n\nScope: `forms:read`."
parameters:
-
in: query
name: format
description: 'redirect|url|stream. Default redirect.'
example: architecto
required: false
schema:
type: string
description: 'redirect|url|stream. Default redirect.'
example: architecto
-
in: query
name: ttl
description: 'Signed URL lifetime seconds (60..86400). Default 86400.'
example: 16
required: false
schema:
type: integer
description: 'Signed URL lifetime seconds (60..86400). Default 86400.'
example: 16
responses:
404:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/not_found'
status: 404
code: not_found
title_fa: 'منبع یافت نشد'
title_en: 'Resource not found'
request_id: 01M7RWG95H331GN5Z7EBX17BW5
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/not_found'
status:
type: integer
example: 404
code:
type: string
example: not_found
title_fa:
type: string
example: 'منبع یافت نشد'
title_en:
type: string
example: 'Resource not found'
request_id:
type: string
example: 01M7RWG95H331GN5Z7EBX17BW5
tags:
- 'Form submissions — fill a form through the API (ADR-0029)'
parameters:
-
in: path
name: slug
description: "The form's slug."
example: architecto
required: true
schema:
type: string
-
in: path
name: code
description: '16-char submission code.'
example: architecto
required: true
schema:
type: string
'/api/v1/forms/{slug}/submissions/{code}/files/{field}':
get:
summary: 'Download one uploaded field file'
operationId: downloadOneUploadedFieldFile
description: "Serves whatever the submission actually holds for `{field}`: a stored `forms/…` path,\nOR an inline `data:…;base64,…` URI. Both shapes are real and both are served — the\ndata-URI is what a drawn signature is, and what API callers necessarily wrote before\nan uploads endpoint existed, so refusing it would orphan real historical data.\n\nThe field's type is resolved from the submission's OWN schema snapshot, not the live\nform: editing a form must never change what an already-recorded submission is\nunderstood to contain.\n\nSame three formats as the submission PDF endpoint.\n\nScope: `forms:read`."
parameters:
-
in: query
name: format
description: 'redirect|url|stream. Default redirect.'
example: architecto
required: false
schema:
type: string
description: 'redirect|url|stream. Default redirect.'
example: architecto
-
in: query
name: ttl
description: 'Signed URL lifetime seconds (60..86400). Default 86400.'
example: 16
required: false
schema:
type: integer
description: 'Signed URL lifetime seconds (60..86400). Default 86400.'
example: 16
responses:
404:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/not_found'
status: 404
code: not_found
title_fa: 'منبع یافت نشد'
title_en: 'Resource not found'
request_id: 01M7RWG95WYM35P3RBTJD7S2X5
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/not_found'
status:
type: integer
example: 404
code:
type: string
example: not_found
title_fa:
type: string
example: 'منبع یافت نشد'
title_en:
type: string
example: 'Resource not found'
request_id:
type: string
example: 01M7RWG95WYM35P3RBTJD7S2X5
tags:
- 'Form submissions — fill a form through the API (ADR-0029)'
parameters:
-
in: path
name: slug
description: "The form's slug."
example: architecto
required: true
schema:
type: string
-
in: path
name: code
description: '16-char submission code.'
example: architecto
required: true
schema:
type: string
-
in: path
name: field
description: "The field's technical `name`."
example: architecto
required: true
schema:
type: string
'/api/v1/forms/{slug}/uploads':
post:
summary: 'Upload a file for a `file` / `image` field'
operationId: uploadAFileForAfileimageField
description: "Multipart, ONE file per call. The returned `path` is what you then put in\n`data.{field}` on `POST /forms/{slug}/submissions`. The bytes land in the form's own\nfolder byte-identically to what the web fill flow produces, so the submissions table,\nthe answer sheet and the image-overlay PDF all render it the same way — an API fill\nand a browser fill become indistinguishable downstream, which is the whole point.\n\nSize and type come from the FIELD's own config (`max_size_kb` / `allowed_mimes` as the\ndesigner set them), clamped to the server ceiling, and the MIME is read from the\nfile's magic bytes — never from its name or extension.\n\n`signature` is deliberately not accepted here: it is drawn, and the canvas yields a\n`data:image/png;base64,…` value that goes straight into `data`.\n\nScope: `forms:write` + `Idempotency-Key` supported."
parameters: []
responses: { }
tags:
- 'Form submissions — fill a form through the API (ADR-0029)'
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
field:
type: string
description: "The target field's technical `name` (see `/schema`)."
example: national_card
file:
type: string
format: binary
description: 'The file itself — multipart/form-data.'
required:
- field
- file
parameters:
-
in: path
name: slug
description: "The form's slug."
example: architecto
required: true
schema:
type: string
/api/v1/forms:
get:
summary: "List forms (v2 only — schema_version='2.0')"
operationId: listFormsv2OnlySchemaVersion20
description: "Paginated list of v2-schema forms owned by the calling user, most recent\nfirst. Form Builder v1 records are excluded — use the dashboard for those.\nReturns the standard `data` + `meta` + `links` envelope, consistent with the\nother list endpoints (API-G1, audit 2026-06 — previously a silent limit(100)).\n\nScope required: `forms:read`."
parameters:
-
in: query
name: page
description: 'Page number. Default 1.'
example: 16
required: false
schema:
type: integer
description: 'Page number. Default 1.'
example: 16
-
in: query
name: per_page
description: 'Items per page. Max 100. Default 50.'
example: 16
required: false
schema:
type: integer
description: 'Items per page. Max 100. Default 50.'
example: 16
responses:
401:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/token_invalid'
status: 401
code: token_invalid
title_fa: 'توکن نامعتبر است'
title_en: 'Invalid token'
request_id: 01M7RWG93P8VG474862STXRZ61
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/token_invalid'
status:
type: integer
example: 401
code:
type: string
example: token_invalid
title_fa:
type: string
example: 'توکن نامعتبر است'
title_en:
type: string
example: 'Invalid token'
request_id:
type: string
example: 01M7RWG93P8VG474862STXRZ61
tags:
- 'Forms — read-only access to v2 forms owned by the authenticated user.'
'/api/v1/forms/{slug}':
get:
summary: 'Show one form (metadata only — schema available via dedicated /schema endpoint in future)'
operationId: showOneFormmetadataOnlySchemaAvailableViaDedicatedschemaEndpointInFuture
description: "Scope required: `forms:read`.\n\n`cost` (added 2026-08-24) answers «what does ONE response to this form cost me?» from the\nsame engine that takes the money — `weight` is the signature units a response consumes\n(1 for a single signer, +0.5 per extra signer, 0.5 for an استعلام-only form) and\n`unit_cost` is the Toman amount after your quota and package discount. It is present only\non this endpoint, never on the list: it costs a quota and a wallet read per form.\n\n⚠️ `is_estimate: true` on a `payer = filler` form — a different person pays each response,\nso the figure is the price on YOUR tariff, not one anybody will actually be charged.\n`ok: false` means the figures could not be computed; the zeros then mean «unknown», not\n«free»."
parameters: []
responses:
200:
description: ''
content:
application/json:
schema:
type: object
example:
data:
id: 142
slug: frm-e7465df28dd45785
title: 'قرارداد همکاری'
status: published
renderer_type: online
requires_signature: true
payer: owner
signature_method: electronic
submission_count: 23
views_count: 187
created_at: '2026-05-10T14:32:00.000Z'
cost:
ok: true
is_free: false
weight: 1.5
unit_cost: 30000
currency: IRT
is_estimate: false
quota_unlimited: false
quota_remaining: 13
responses_left_on_quota: 8
properties:
data:
type: object
properties:
id:
type: integer
example: 142
slug:
type: string
example: frm-e7465df28dd45785
title:
type: string
example: 'قرارداد همکاری'
status:
type: string
example: published
renderer_type:
type: string
example: online
requires_signature:
type: boolean
example: true
payer:
type: string
example: owner
signature_method:
type: string
example: electronic
submission_count:
type: integer
example: 23
views_count:
type: integer
example: 187
created_at:
type: string
example: '2026-05-10T14:32:00.000Z'
cost:
type: object
properties:
ok:
type: boolean
example: true
is_free:
type: boolean
example: false
weight:
type: number
example: 1.5
unit_cost:
type: integer
example: 30000
currency:
type: string
example: IRT
is_estimate:
type: boolean
example: false
quota_unlimited:
type: boolean
example: false
quota_remaining:
type: integer
example: 13
responses_left_on_quota:
type: integer
example: 8
404:
description: 'Not found or not owned'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/form_not_found'
status: 404
code: form_not_found
title_fa: 'فرم یافت نشد یا متعلق به شما نیست'
title_en: 'Form not found or not owned by the caller'
request_id: 01KRH8JRC4Y855P10CYC1C0AYS
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/form_not_found'
status:
type: integer
example: 404
code:
type: string
example: form_not_found
title_fa:
type: string
example: 'فرم یافت نشد یا متعلق به شما نیست'
title_en:
type: string
example: 'Form not found or not owned by the caller'
request_id:
type: string
example: 01KRH8JRC4Y855P10CYC1C0AYS
tags:
- 'Forms — read-only access to v2 forms owned by the authenticated user.'
parameters:
-
in: path
name: slug
description: "The form's public slug."
example: frm-e7465df28dd45785
required: true
schema:
type: string
'/api/v1/forms/{slug}/stats':
get:
summary: 'Form analytics (views/starts/submissions/conversion rates).'
operationId: formAnalyticsviewsstartssubmissionsconversionRates
description: "Aggregated funnel counters for one form: lifetime totals plus 7-day and 30-day windows, so\nyou can chart trends without additional queries.\n\n⚠️ Two engines count submissions here, and the response names both.\n\n- `submissions` — the lifetime counter, incremented once per accepted submission. It never\n decreases, so a deleted submission stays counted, and it is written in exactly one place,\n so a row created by any other path is invisible to it. **This is the v1 meaning and it\n does not change without a version bump.** `submissions_recorded` is the same integer under\n a name that says so.\n- `submissions_stored` — non-draft rows held right now. This is the number the owner sees in\n their panel, and it can differ from `submissions` in either direction.\n\n`abandons`, `completion_rate` and `abandon_rate` all derive from `submissions`, so the funnel\nadds up. `completion_rate_stored` is `null` when stored rows exceed recorded starts: the two\ncounters disagree, and a ratio across them would be drift rather than a measurement.\n\nAdded 2026-08-20 — `submissions_recorded`, `submissions_stored`, `completion_rate_stored`.\nPurely additive; no existing field changed meaning or value.\n\nScope required: `forms:read`."
parameters: []
responses:
200:
description: ''
content:
application/json:
schema:
type: object
example:
data:
views: 187
starts: 41
abandons: 18
submissions: 23
submissions_recorded: 23
submissions_stored: 25
start_rate: 21.9
completion_rate: 56.1
completion_rate_stored: 61.0
abandon_rate: 43.9
last_submission_at: '2026-08-19T11:02:44+00:00'
submissions_last_7d: 4
submissions_last_30d: 21
properties:
data:
type: object
properties:
views:
type: integer
example: 187
starts:
type: integer
example: 41
abandons:
type: integer
example: 18
submissions:
type: integer
example: 23
submissions_recorded:
type: integer
example: 23
submissions_stored:
type: integer
example: 25
start_rate:
type: number
example: 21.9
completion_rate:
type: number
example: 56.1
completion_rate_stored:
type: number
example: 61.0
abandon_rate:
type: number
example: 43.9
last_submission_at:
type: string
example: '2026-08-19T11:02:44+00:00'
submissions_last_7d:
type: integer
example: 4
submissions_last_30d:
type: integer
example: 21
404:
description: 'Not found or not owned'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/form_not_found'
status: 404
code: form_not_found
title_fa: 'فرم یافت نشد یا متعلق به شما نیست'
title_en: 'Form not found or not owned by the caller'
request_id: 01KRH8JRC4Y855P10CYC1C0AYS
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/form_not_found'
status:
type: integer
example: 404
code:
type: string
example: form_not_found
title_fa:
type: string
example: 'فرم یافت نشد یا متعلق به شما نیست'
title_en:
type: string
example: 'Form not found or not owned by the caller'
request_id:
type: string
example: 01KRH8JRC4Y855P10CYC1C0AYS
tags:
- 'Forms — read-only access to v2 forms owned by the authenticated user.'
parameters:
-
in: path
name: slug
description: "The form's public slug."
example: frm-e7465df28dd45785
required: true
schema:
type: string
'/api/v1/forms/{slug}/schema':
get:
summary: 'Form schema (fillable-field catalog)'
operationId: formSchemafillableFieldCatalog
description: "Everything an integrator needs to build their own fill UI and construct a valid\n`POST /forms/{slug}/submissions` payload: field names, types, labels, required flags,\noptions, pages, visibility conditions, and — per field — the SHAPE its value must take\n(`value_format`).\n\n`supported` used to report `false` for file/image \"because the web fill flow does not\nsupport them either\". Both halves were wrong: the web renderer has had real uploads\nsince 2026-06-22, and nothing ever rejected an inline base64 value on the API side. It\nnow reports true for every fillable field, and `value_format` carries the real answer:\n\n - `upload_path_or_data_uri` — file/image: either the `path` from\n `POST /forms/{slug}/uploads`, or an inline `data:;base64,…`\n - `data_uri` — signature: what the canvas produces\n - `verify_field_result` — query fields: from `POST /forms/{slug}/verify-field`\n - `rows` — «جدولِ ردیفدار» (`line_items`): a JSON ARRAY of row objects, each keyed\n by the column keys in `config.columns` — `[{\"desc\":\"یخچال\",\"qty\":1,\"price\":450000}]`.\n Send only the columns whose `type` is not `formula`: computed columns are derived\n server-side and any you send are dropped. `config.max_rows` is a hard limit — more\n rows are REJECTED, never silently trimmed.\n - `scalar` — everything else\n\n**`id` is the key to keep.** It is generated once and never changes — not when the\nfield is renamed, relabelled, reordered or moved. Key your local copy of a form by\n`id`, never by `name`: a client keyed by name cannot tell a RENAME apart from \"one\nfield deleted, one added\", and those call for opposite actions. `repeat.config.ref`\nand the `fill_flow` sections both reference fields by this same id.\n\n`pages` describes what each field's `page` points at, and is never empty.\n\n`fill_flow` is present only for `image_overlay` forms (null otherwise) and says\nwhich of the two presentations the owner chose: `document` draws fields at absolute\ncoordinates on a page bitmap, while `guided` turns them into ordered question cards\n— with `doc` saying whether the document is shown alongside. Only `guided` is\nreasonable to reproduce outside our own renderer.\n\nScope required: `forms:read`."
parameters: []
responses:
200:
description: 'An online form with one text field'
content:
application/json:
schema:
type: object
example:
data:
form:
slug: frm-e7465df28dd45785
title: 'قرارداد همکاری'
version: 12
pages:
-
id: page_a1b2c3d4e5f60718
title: 'مشخصات فردی'
description: null
sort_order: 0
visibility_condition: null
fill_flow: null
fields:
-
id: fld_9a3f1c72e4b58d06
name: full_name
type: text
label: 'نام و نام خانوادگی'
required: true
is_input: true
supported: true
value_format: scalar
page: page_a1b2c3d4e5f60718
help_text: null
placeholder: null
default_value: null
options: null
config: { }
has_visibility_condition: false
visibility_condition: null
is_formula: false
formula: null
validations: []
sort_order: 0
properties:
data:
type: object
properties:
form:
type: object
properties:
slug:
type: string
example: frm-e7465df28dd45785
title:
type: string
example: 'قرارداد همکاری'
version:
type: integer
example: 12
pages:
type: array
example:
-
id: page_a1b2c3d4e5f60718
title: 'مشخصات فردی'
description: null
sort_order: 0
visibility_condition: null
items:
type: object
properties:
id:
type: string
example: page_a1b2c3d4e5f60718
title:
type: string
example: 'مشخصات فردی'
description:
type: string
example: null
nullable: true
sort_order:
type: integer
example: 0
visibility_condition:
type: string
example: null
nullable: true
fill_flow:
type: string
example: null
description: 'Image-overlay forms only (`null` otherwise): `style` is `document` or `guided`, `doc` is `live` or `hidden`, plus the ordered `sections` and any `unassigned` field ids.'
fields:
type: array
example:
-
id: fld_9a3f1c72e4b58d06
name: full_name
type: text
label: 'نام و نام خانوادگی'
required: true
is_input: true
supported: true
value_format: scalar
page: page_a1b2c3d4e5f60718
help_text: null
placeholder: null
default_value: null
options: null
config: []
has_visibility_condition: false
visibility_condition: null
is_formula: false
formula: null
validations: []
sort_order: 0
items:
type: object
properties:
id:
type: string
example: fld_9a3f1c72e4b58d06
name:
type: string
example: full_name
type:
type: string
example: text
label:
type: string
example: 'نام و نام خانوادگی'
required:
type: boolean
example: true
is_input:
type: boolean
example: true
supported:
type: boolean
example: true
value_format:
type: string
example: scalar
page:
type: string
example: page_a1b2c3d4e5f60718
help_text:
type: string
example: null
nullable: true
placeholder:
type: string
example: null
nullable: true
default_value:
type: string
example: null
nullable: true
options:
type: string
example: null
nullable: true
config:
type: object
properties: { }
has_visibility_condition:
type: boolean
example: false
visibility_condition:
type: string
example: null
nullable: true
is_formula:
type: boolean
example: false
formula:
type: string
example: null
nullable: true
validations:
type: array
example: []
sort_order:
type: integer
example: 0
tags:
- 'Forms — read-only access to v2 forms owned by the authenticated user.'
parameters:
-
in: path
name: slug
description: "The form's public slug."
example: architecto
required: true
schema:
type: string
'/api/v1/forms/{slug}/verify-field':
post:
summary: 'Verify a query field (Shahkar / legal entity)'
operationId: verifyAQueryFieldShahkarLegalEntity
description: "Runs the SAME server-side verification the web renderer's «استعلام» buttons run, and\nwrites the same server-side binding that `POST /forms/{slug}/submissions` checks — echo\nthe returned `value` back inside `data.{field}` when you submit, FROM THE SAME IP.\n\nThe form OWNER's daily Shahkar quota pays for the lookup (identical to web). Sandbox\ntokens short-circuit to `matched=true` without any provider call.\n\nEvery lookup (Shahkar, civil, postal, legal entity, and the company / owner inquiries:\n`query_company_iban`, `query_sayad_cheque` with the form owner as holder) counts against the\nform's hourly lookup ceiling, shared with the public form page. Past it the answer is `429`\nwith code `inquiry_rate_limited`; retry later. Sandbox lookups are not counted.\n\nEvery lookup is billed to the form owner and counts against the owner's daily inquiry\nallowance; past it the answer is `422` `verify_failed` («سقفِ امروزِ استعلامِ فرمهای شما پر شده است»).\n\nAn inquiry ABOUT A PERSON (`query_guild_licence`, `query_iban_owner`, `query_military_service`,\n`query_sana`, `query_card_owner`, `query_bounced_cheques`, and `query_sayad_cheque` with the\nfiller as holder — its schema `value_format` is `form_page_only`) runs only on the form page,\nwith that person's own confirmation: the answer is `409` with code `inquiry_requires_form_page`\nand `meta.public_url`. Send the respondent there.\n\nScope required: `forms:write`."
parameters: []
responses: { }
tags:
- 'Forms — read-only access to v2 forms owned by the authenticated user.'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
field:
type: string
description: "The query field's name."
example: architecto
values:
type: object
description: 'Raw values of the referenced input fields.'
example:
mobile: '09121234567'
national_code: '0010350829'
properties: { }
required:
- field
- values
parameters:
-
in: path
name: slug
description: "The form's public slug."
example: architecto
required: true
schema:
type: string
/api/v1/health:
get:
summary: 'Health check'
operationId: healthCheck
description: "Liveness + shallow dependency probe. **No authentication required.**\nReturns 200 when every dependency answers, 503 when one does not.\n\n── 🩸 چرا این متد عوض شد (۱۴۰۵/۰۶/۰۹) ───────────────────────────────────────────────\n\nتا امروز این کنترلر ۳۶ خط بود و **همیشه ۲۰۰** برمیگرداند، بدونِ یک تماس با دیتابیس،\nردیس یا صف. پاسخِ زندهٔ دیروز:\n\n {\"status\":\"ok\",\"time\":\"2026-08-30T20:43:08.244Z\",\"version\":\"v1.0.0\"}\n\nیعنی تنها چیزی که ثابت میکرد این بود که php-fpm زنده است و مسیریابی کار میکند. اگر\nپستگرس میخوابید، این endpoint همچنان `\"status\":\"ok\"` میگفت — و اولین چیزی که یک\nمشتریِ یکپارچهساز به آن وصل میشود همین است. یک probeِ سلامتی که نمیتواند ناسالم\nبگوید، از نداشتنش بدتر است، چون کسی به آن تکیه میکند.\n\n── آنچه این عمداً **نمیسنجد** ──────────────────────────────────────────────────────\n\nسلامتِ عمیق (پندار، جیبیت، کاوهنگار، فضای دیسک) اینجا نیست. آن نیازِ یک مسیرِ\n**احرازشدهٔ** جدا است، و افزودنِ مسیر یعنی نوشتن در `routes/api.php` که مالکیتِ\nبستهٔ ۲ است. تا آنوقت، پاسخِ اینجا صریحاً میگوید چه چیزی را پوشش میدهد\n(`\"scope\":\"shallow\"`) تا کسی آن را عمیقتر از آنچه هست نخواند."
parameters: []
responses:
200:
description: ''
content:
application/json:
schema:
type: object
example:
status: ok
time: '2026-05-11T11:53:29.399Z'
version: v1.0.0
scope: shallow
checks:
database: ok
cache: ok
queue: ok
properties:
status:
type: string
example: ok
time:
type: string
example: '2026-05-11T11:53:29.399Z'
version:
type: string
example: v1.0.0
scope:
type: string
example: shallow
checks:
type: object
properties:
database:
type: string
example: ok
cache:
type: string
example: ok
queue:
type: string
example: ok
503:
description: ''
content:
application/json:
schema:
type: object
example:
status: degraded
time: '2026-05-11T11:53:29.399Z'
version: v1.0.0
scope: shallow
checks:
database: fail
cache: ok
queue: unknown
properties:
status:
type: string
example: degraded
time:
type: string
example: '2026-05-11T11:53:29.399Z'
version:
type: string
example: v1.0.0
scope:
type: string
example: shallow
checks:
type: object
properties:
database:
type: string
example: fail
cache:
type: string
example: ok
queue:
type: string
example: unknown
tags:
- 'Meta — health, identity, quota, cost'
security: []
/api/v1/me:
get:
summary: 'Caller identity'
operationId: callerIdentity
description: "Returns information about the authenticated token, its owner user, and\nthe billing context (wallet balance, org root). Any valid token can call this —\nno specific scope required.\n\nUse the `token.mode` field to confirm whether your token is in **live** mode\n(charges your wallet, real KYC/SMS) or **test** sandbox mode (zero wallet\nimpact, mocked side effects). `wallet_balance` is always in tomans (IRR/10).\n\n🩸 You do not have to call this endpoint to find out. **Every** authenticated API\nresponse carries `X-Emza-Mode: live|test`, including error envelopes — so an\nintegration can assert on it continuously rather than checking once at setup.\nThat header was added on 1405/06/10 after a live site ran for seven hours on a\nsandbox token: every response was a 200, every contract was mocked, no SMS reached\nany signer, and nothing on the wire said so."
parameters: []
responses:
200:
description: ''
content:
application/json:
schema:
oneOf:
-
description: 'Live token'
type: object
example:
data:
token:
id: '42'
name: production-server-2026
mode: live
scopes:
- 'contracts:read'
- 'contracts:write'
- 'webhooks:manage'
ip_whitelist:
- 203.0.113.5/32
expires_at: '2027-01-01T00:00:00.000Z'
last_used_at: '2026-05-13T18:00:42.000Z'
user:
id: 1234
name: 'آرش بنائیان چمله'
type: personal
is_org_root: false
org_root_id: null
billing_actor_user_id: 1234
wallet_balance: 849310
properties:
data:
type: object
properties:
token:
type: object
properties:
id:
type: string
example: '42'
name:
type: string
example: production-server-2026
mode:
type: string
example: live
description: 'Either `live` or `test`. Sandbox tokens never debit the wallet.'
scopes:
type: array
example:
- 'contracts:read'
- 'contracts:write'
- 'webhooks:manage'
description: 'of granted abilities. `["*"]` means full access.'
items:
type: string
ip_whitelist:
type: array
example:
- 203.0.113.5/32
description: 'If non-empty, requests from other IPs are rejected with 403 `ip_not_allowed`. Five failures within 1h auto-revoke the token.'
items:
type: string
expires_at:
type: string
example: '2027-01-01T00:00:00.000Z'
last_used_at:
type: string
example: '2026-05-13T18:00:42.000Z'
user:
type: object
properties:
id:
type: integer
example: 1234
name:
type: string
example: 'آرش بنائیان چمله'
type:
type: string
example: personal
is_org_root:
type: boolean
example: false
description: 'True when this user is the root of a Sub-Organization tree (can invite sub-users).'
org_root_id:
type: string
example: null
description: 'ID of the org root if this user is a member, else null.'
billing_actor_user_id:
type: integer
example: 1234
description: 'The wallet that pays for this request. Same as `user.id` for solo users; may be `org_root_id` for org members with `auto_charge_from_parent=true`.'
wallet_balance:
type: integer
example: 849310
description: 'Current wallet balance in tomans (Iranian Rials ÷ 10).'
-
description: 'Sandbox/test token'
type: object
example:
data:
token:
id: '13'
name: ci-tests-sandbox
mode: test
scopes:
- '*'
ip_whitelist: []
expires_at: null
last_used_at: '2026-05-13T17:52:23.000Z'
user:
id: 1234
name: 'آرش بنائیان چمله'
type: personal
is_org_root: false
org_root_id: null
billing_actor_user_id: 1234
wallet_balance: 849310
properties:
data:
type: object
properties:
token:
type: object
properties:
id:
type: string
example: '13'
name:
type: string
example: ci-tests-sandbox
mode:
type: string
example: test
description: 'Either `live` or `test`. Sandbox tokens never debit the wallet.'
scopes:
type: array
example:
- '*'
description: 'of granted abilities. `["*"]` means full access.'
items:
type: string
ip_whitelist:
type: array
example: []
description: 'If non-empty, requests from other IPs are rejected with 403 `ip_not_allowed`. Five failures within 1h auto-revoke the token.'
expires_at:
type: string
example: null
nullable: true
last_used_at:
type: string
example: '2026-05-13T17:52:23.000Z'
user:
type: object
properties:
id:
type: integer
example: 1234
name:
type: string
example: 'آرش بنائیان چمله'
type:
type: string
example: personal
is_org_root:
type: boolean
example: false
description: 'True when this user is the root of a Sub-Organization tree (can invite sub-users).'
org_root_id:
type: string
example: null
description: 'ID of the org root if this user is a member, else null.'
billing_actor_user_id:
type: integer
example: 1234
description: 'The wallet that pays for this request. Same as `user.id` for solo users; may be `org_root_id` for org members with `auto_charge_from_parent=true`.'
wallet_balance:
type: integer
example: 849310
description: 'Current wallet balance in tomans (Iranian Rials ÷ 10).'
tags:
- 'Meta — health, identity, quota, cost'
/api/v1/quota:
get:
summary: 'Current quota'
operationId: currentQuota
description: "Returns the caller's current-month signature quota usage + remaining,\npackage tier, and today's Shahkar verification credits.\n\n**Quota semantics:**\n- `free_quota` is the per-period allowance from the user's active package\n (Free=3 lifetime, Bronze=100/mo, Silver=300/mo, Gold=600/mo — verify against\n live `/admin/packages`, these are the 2026-06 tariff). Returns 0 if the package\n is expired or unset.\n- `used`/`remaining` may be FRACTIONAL: additional signers on one contract count\n as half a unit each (a 2-signer contract consumes 1.5). Whole values serialize\n as integers; a half consumes serializes as e.g. `1.5`.\n- `used` is total signature-units recorded since `package_started_at` (so\n pre-purchase usage doesn't deplete a freshly-bought plan). Free tier counts\n lifetime (no monthly reset).\n- `remaining = free_quota - used` for limited plans. **null** means\n genuinely unlimited (`signature_limit` IS NULL).\n- When `remaining` reaches 0, signatures still work — billed as overage from the\n wallet at `base × (1 − overage_discount)`; the OVERAGE discount is\n Free=0%, Bronze=5%, Silver=15%, Gold=25% (separate from, and smaller than, the\n 10/20/30% in-package discount encoded in the package price).\n\n**Shahkar credits** are separate from signature quota. Daily allowance\nby package (Free=3, Bronze=5, Silver=10, Gold=20). Once exhausted, the\nclient must purchase batch top-ups before further Shahkar verifications.\n\nScope required: `contracts:read`."
parameters: []
responses:
200:
description: ''
content:
application/json:
schema:
oneOf:
-
description: 'Bronze user mid-month'
type: object
example:
data:
service: electronic_signature
period_start: '2026-05-01T00:00:00.000Z'
period_end: '2026-05-31T23:59:59.999Z'
package:
slug: bronze
name: برنزی
free_quota: 30
used: 17
remaining: 13
shahkar:
free_limit: 5
used_today: 2
free_remaining: 3
extra_credits: 0
extra_remaining: 0
allowed: true
properties:
data:
type: object
properties:
service:
type: string
example: electronic_signature
period_start:
type: string
example: '2026-05-01T00:00:00.000Z'
period_end:
type: string
example: '2026-05-31T23:59:59.999Z'
package:
type: object
properties:
slug:
type: string
example: bronze
name:
type: string
example: برنزی
free_quota:
type: integer
example: 30
description: 'Monthly signature allowance from active package. Zero if package expired or none.'
used:
type: integer
example: 17
description: 'Signatures recorded this period (since package_started_at).'
remaining:
type: integer
example: 13
description: 'Signatures left this period. `null` means unlimited (Gold).'
shahkar:
type: object
properties:
free_limit:
type: integer
example: 5
used_today:
type: integer
example: 2
free_remaining:
type: integer
example: 3
extra_credits:
type: integer
example: 0
extra_remaining:
type: integer
example: 0
allowed:
type: boolean
example: true
description: 'Whether the user may attempt a Shahkar verification right now. False = quota exhausted, must purchase batch top-up.'
-
description: 'Gold (unlimited)'
type: object
example:
data:
service: electronic_signature
period_start: '2026-05-01T00:00:00.000Z'
period_end: '2026-05-31T23:59:59.999Z'
package:
slug: gold
name: طلایی
free_quota: 0
used: 412
remaining: null
shahkar:
free_limit: 20
used_today: 4
free_remaining: 16
extra_credits: 0
extra_remaining: 0
allowed: true
properties:
data:
type: object
properties:
service:
type: string
example: electronic_signature
period_start:
type: string
example: '2026-05-01T00:00:00.000Z'
period_end:
type: string
example: '2026-05-31T23:59:59.999Z'
package:
type: object
properties:
slug:
type: string
example: gold
name:
type: string
example: طلایی
free_quota:
type: integer
example: 0
description: 'Monthly signature allowance from active package. Zero if package expired or none.'
used:
type: integer
example: 412
description: 'Signatures recorded this period (since package_started_at).'
remaining:
type: string
example: null
description: 'Signatures left this period. `null` means unlimited (Gold).'
shahkar:
type: object
properties:
free_limit:
type: integer
example: 20
used_today:
type: integer
example: 4
free_remaining:
type: integer
example: 16
extra_credits:
type: integer
example: 0
extra_remaining:
type: integer
example: 0
allowed:
type: boolean
example: true
description: 'Whether the user may attempt a Shahkar verification right now. False = quota exhausted, must purchase batch top-up.'
-
description: 'No active package (pay-per-use)'
type: object
example:
data:
service: electronic_signature
period_start: '2026-05-01T00:00:00.000Z'
period_end: '2026-05-31T23:59:59.999Z'
package: null
free_quota: 0
used: 0
remaining: 0
shahkar:
free_limit: 0
used_today: 0
free_remaining: 0
extra_credits: 0
extra_remaining: 0
allowed: false
properties:
data:
type: object
properties:
service:
type: string
example: electronic_signature
period_start:
type: string
example: '2026-05-01T00:00:00.000Z'
period_end:
type: string
example: '2026-05-31T23:59:59.999Z'
package:
type: string
example: null
nullable: true
free_quota:
type: integer
example: 0
description: 'Monthly signature allowance from active package. Zero if package expired or none.'
used:
type: integer
example: 0
description: 'Signatures recorded this period (since package_started_at).'
remaining:
type: integer
example: 0
description: 'Signatures left this period. `null` means unlimited (Gold).'
shahkar:
type: object
properties:
free_limit:
type: integer
example: 0
used_today:
type: integer
example: 0
free_remaining:
type: integer
example: 0
extra_credits:
type: integer
example: 0
extra_remaining:
type: integer
example: 0
allowed:
type: boolean
example: false
description: 'Whether the user may attempt a Shahkar verification right now. False = quota exhausted, must purchase batch top-up.'
tags:
- 'Meta — health, identity, quota, cost'
/api/v1/cost-estimate:
get:
summary: 'Cost estimate'
operationId: costEstimate
description: "What sending a contract to N signers will debit, computed by the same engine the send uses\n(`SendCost` — the charge's own price function and wallet decision), without committing anything.\nUse it before `POST /contracts` or `POST /contracts/{code}/signers`.\n\nScope required: `contracts:read`.\n\n**The old shape is unchanged.** Called with only `signers` (and optionally `discount_code`) the\nresponse is exactly what it always was: an electronic signature, the caller's own wallet, no\nprivacy. Passing any of `signature_method`, `is_private`, `payer_mode`, `payers` or `contract`\nadds `service_type`, `payer_mode`, `existing_signers`, `share` and `payment_plan`.\n\n**`payment_plan.can_cover` is the truthful «will this send go through».** `sufficient_balance`\nkeeps its old meaning — the caller's OWN wallet against `total_cost` — so a member of an\norganisation whose send the organisation wallet pays reads `sufficient_balance: false` and\n`payment_plan: {source: \"parent_wallet\", can_cover: true}`. The organisation wallet's balance is\nnever returned.\n\n**`total_cost` is what leaves a wallet at send time.** In `payer_mode=creator` it is the creator's\ncharge (free quota applied). In `signer` / `designated` it is the creator's commitment — the\nadvance the creator puts down for the other signers' shares (quota is not used in these modes,\nso the quota/tariff keys are null); the split is in `share`.\n\n**Discount codes.** The send applies the code stored on the contract — the one given as\n`discount_code` to `POST /contracts` (or typed in the panel). With `contract` the estimate reads\nthat code itself, so it is the amount that will be charged. Without `contract`, `discount_code`\nprices a send for a contract you would create with that code; here an unusable code is not an\nerror — it simply gives `discount_amount: 0` — whereas `POST /contracts` rejects it."
parameters:
-
in: query
name: signers
description: 'Number of NEW signers in this send (1-20).'
example: 3
required: true
schema:
type: integer
description: 'Number of NEW signers in this send (1-20).'
example: 3
-
in: query
name: discount_code
description: 'Optional discount code — the one you will pass to `POST /contracts`.'
example: WELCOME10
required: false
schema:
type: string
description: 'Optional discount code — the one you will pass to `POST /contracts`.'
example: WELCOME10
-
in: query
name: signature_method
description: '`electronic` (default) or `digital`.'
example: electronic
required: false
schema:
type: string
description: '`electronic` (default) or `digital`.'
example: electronic
-
in: query
name: is_private
description: "A private contract is paid from the caller's own wallet only, never the organisation's: `true`/`false`/`1`/`0`."
example: 'false'
required: false
schema:
type: string
description: "A private contract is paid from the caller's own wallet only, never the organisation's: `true`/`false`/`1`/`0`."
example: 'false'
-
in: query
name: payer_mode
description: 'Who pays: `creator` (default), `signer` (split among all signers) or `designated` (split among `payers` of them).'
example: creator
required: false
schema:
type: string
description: 'Who pays: `creator` (default), `signer` (split among all signers) or `designated` (split among `payers` of them).'
example: creator
-
in: query
name: payers
description: 'Only with `payer_mode=designated`: how many of the signers pay (1..signers).'
example: 1
required: false
schema:
type: integer
description: 'Only with `payer_mode=designated`: how many of the signers pay (1..signers).'
example: 1
-
in: query
name: creator_is_signer
description: 'You are one of the `signers` yourself (your own row will carry `is_creator` on `POST /contracts/{code}/signers`): `true`/`false`/`1`/`0`. It changes the figure only when the cost is shared: with `payer_mode=signer` you then pay your own share in full at send, plus the reserve for the others. The figure assumes your own row is the FIRST of the paying rows you send; elsewhere in the list it can differ by the rounding remainder (at most `payers − 1` toman).'
example: 'false'
required: false
schema:
type: string
description: 'You are one of the `signers` yourself (your own row will carry `is_creator` on `POST /contracts/{code}/signers`): `true`/`false`/`1`/`0`. It changes the figure only when the cost is shared: with `payer_mode=signer` you then pay your own share in full at send, plus the reserve for the others. The figure assumes your own row is the FIRST of the paying rows you send; elsewhere in the list it can differ by the rounding remainder (at most `payers − 1` toman).'
example: 'false'
-
in: query
name: creator_pays
description: 'With `creator_is_signer=true` and `payer_mode=designated`: your own row is one of the `payers` (`is_payer`); at least one payer must be someone else. In the other modes it only states what is already true (`signer`: every signer pays, you included — `false` is refused; `creator`: you pay everything).'
example: 'false'
required: false
schema:
type: string
description: 'With `creator_is_signer=true` and `payer_mode=designated`: your own row is one of the `payers` (`is_payer`); at least one payer must be someone else. In the other modes it only states what is already true (`signer`: every signer pays, you included — `false` is refused; `creator`: you pay everything).'
example: 'false'
-
in: query
name: contract
description: "A draft contract YOU created (16-char code): its current signers are counted as existing (extra signers are priced as such), and its signature method, privacy and payer mode are used. An explicit parameter that contradicts the contract ⇒ 422 `estimate_contract_mismatch`; someone else's or unknown ⇒ 404."
example: ABCD1234EFGH5678
required: false
schema:
type: string
description: "A draft contract YOU created (16-char code): its current signers are counted as existing (extra signers are priced as such), and its signature method, privacy and payer mode are used. An explicit parameter that contradicts the contract ⇒ 422 `estimate_contract_mismatch`; someone else's or unknown ⇒ 404."
example: ABCD1234EFGH5678
responses:
200:
description: 'extended (any new parameter)'
content:
application/json:
schema:
type: object
example:
data:
tariff_cost: 55000
quota_used: 0
billable_units: 1
overage_cost: 55000
discount_amount: 0
tax_amount: 5500
total_cost: 60500
currency: IRT
discount_code: null
package: null
wallet_balance: 20000
wallet_balance_after: 0
sufficient_balance: false
service_type: electronic_signature
payer_mode: creator
existing_signers: 0
share: null
payment_plan:
source: parent_wallet
can_cover: true
blocked_reason: null
message_fa: 'موجودی شما کافی نیست — هزینه از کیفِ سازمان پرداخت خواهد شد.'
properties:
data:
type: object
properties:
tariff_cost:
type: integer
example: 55000
quota_used:
type: integer
example: 0
billable_units:
type: integer
example: 1
overage_cost:
type: integer
example: 55000
discount_amount:
type: integer
example: 0
tax_amount:
type: integer
example: 5500
total_cost:
type: integer
example: 60500
currency:
type: string
example: IRT
discount_code:
type: string
example: null
nullable: true
package:
type: string
example: null
nullable: true
wallet_balance:
type: integer
example: 20000
wallet_balance_after:
type: integer
example: 0
sufficient_balance:
type: boolean
example: false
service_type:
type: string
example: electronic_signature
payer_mode:
type: string
example: creator
existing_signers:
type: integer
example: 0
share:
type: string
example: null
nullable: true
payment_plan:
type: object
properties:
source:
type: string
example: parent_wallet
can_cover:
type: boolean
example: true
blocked_reason:
type: string
example: null
nullable: true
message_fa:
type: string
example: 'موجودی شما کافی نیست — هزینه از کیفِ سازمان پرداخت خواهد شد.'
404:
description: 'contract not yours / unknown'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/not_found'
status: 404
code: not_found
title_fa: 'قرارداد یافت نشد'
title_en: 'Contract not found'
request_id: 01J...
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/not_found'
status:
type: integer
example: 404
code:
type: string
example: not_found
title_fa:
type: string
example: 'قرارداد یافت نشد'
title_en:
type: string
example: 'Contract not found'
request_id:
type: string
example: 01J...
422:
description: 'parameter contradicts the contract'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/estimate_contract_mismatch'
status: 422
code: estimate_contract_mismatch
title_fa: 'پارامترِ ارسالی با خودِ قرارداد نمیخواند'
title_en: 'A parameter contradicts the contract'
errors:
-
field: signature_method
code: mismatch
title_fa: 'این قرارداد digital است'
title_en: 'This contract is digital'
request_id: 01J...
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/estimate_contract_mismatch'
status:
type: integer
example: 422
code:
type: string
example: estimate_contract_mismatch
title_fa:
type: string
example: 'پارامترِ ارسالی با خودِ قرارداد نمیخواند'
title_en:
type: string
example: 'A parameter contradicts the contract'
errors:
type: array
example:
-
field: signature_method
code: mismatch
title_fa: 'این قرارداد digital است'
title_en: 'This contract is digital'
items:
type: object
properties:
field:
type: string
example: signature_method
code:
type: string
example: mismatch
title_fa:
type: string
example: 'این قرارداد digital است'
title_en:
type: string
example: 'This contract is digital'
request_id:
type: string
example: 01J...
tags:
- 'Meta — health, identity, quota, cost'
'/api/v1/contracts/{code}/signers':
get:
summary: 'List signers'
operationId: listSigners
description: "Lists all signers on a contract. PII (mobile, national_code) is masked\nunless the caller's token has `signers:read_pii` scope.\n\nScope: `contracts:read`."
parameters: []
responses:
404:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/not_found'
status: 404
code: not_found
title_fa: 'منبع یافت نشد'
title_en: 'Resource not found'
request_id: 01M7RWG92AFXQAXH954QHS42A6
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/not_found'
status:
type: integer
example: 404
code:
type: string
example: not_found
title_fa:
type: string
example: 'منبع یافت نشد'
title_en:
type: string
example: 'Resource not found'
request_id:
type: string
example: 01M7RWG92AFXQAXH954QHS42A6
tags:
- Signers
post:
summary: 'Add signers'
operationId: addSigners
description: "Adds one or more signers to a draft contract. Runs **mandatory** Shahkar\npre-validation (mobile ↔ national_code match) per signer in production.\nOn success, contract transitions to `waiting_signature` and SMS dispatch\njobs are queued for first-order signers.\n\n**The contract must have its document first.** A contract created as JSON without `file`/`source` (the\nmulti-step flow) has none until `POST /contracts/{code}/files`; adding signers to it is 422\n`document_required` — no signer is added, nothing is charged, nobody is texted, and the contract stays a\n`draft` (`meta.reason: no_document`). A document that could not be processed (`GET /contracts/{code}/processing`\nanswers `step=error`) is no document either (`meta.reason: document_failed`): upload a corrected file with\n`POST /contracts/{code}/files`. **Add signers once the document is ready:** after the upload, wait until\n`GET /contracts/{code}/processing` answers `ready=true` (or the `contract.processing.completed` webhook) — the\nsigning SMS does not wait for the pages, so a signer reached earlier can open a page that is not ready yet. To\nskip the wait, send the signers inline with the file in one `POST /contracts`. A `template_id` gives a contract\nsignature boxes, not a document. Like every 4xx this answer is stored under your `Idempotency-Key`: attach the\ndocument, then send the signers with a new key.\n\nA contract created with `signing_deadline_at` is re-checked here against the CURRENT time: if the deadline\nhas passed or is less than an hour away this is 422 `signing_deadline_passed` — no signer is added, charged\nor texted.\n\nAn attached document — an amendment or a rescission of a completed contract (`parent_contract` set) — takes no\nsigners here, in any status: its signers are the original contract's parties, fixed when it is made. 409\n`attached_document_signers_fixed`, before any other check; nothing is added, charged or texted.\n\nAn electronic replacement of a digital contract (`POST /contracts` with `replaces`; its `replaces` is set) takes\nno signers here while it is a draft: its roster is the replaced contract's, copied by the system once the\ndocument is processed — 409 `replacement_signers_pending`; nothing is added, charged or texted. Once the roster\nhas arrived the contract is waiting for signatures and, like any such contract, takes no new batch.\n\nA digital contract created with `signer_mode` checks this batch against it: `solo` takes exactly one signer,\n`multi` at least two — otherwise 422 `signer_mode_mismatch`, before any identity check, charge or row.\n\nWhen the identity registry itself does not answer (an outage — nothing is known about the signers), the\nanswer is 503 `identity_service_unavailable` with `Retry-After`: no signer was added and nothing was charged,\nand the same request can simply be sent again. 422 `shahkar_mismatch` is only for an answer that says the\nmobile and the national code do not belong together.\n\nWhen your account's DAILY identity-inquiry quota is used up (each mismatch the registry answers counts against\nit), nobody is asked and the answer is 429 `identity_inquiry_quota_exhausted` with `Retry-After` (seconds until\nthe quota opens at the start of the next day) and `meta.resets_at`: no signer was added and nothing was charged.\nIt says nothing about the signers' data. Like every 429 it is not stored under your `Idempotency-Key` — send the\nsame request again after the reset, or sooner once an inquiry batch is bought in the panel (`GET /quota` →\n`shahkar.allowed`). An account whose daily allowance is ZERO (every day starts used up) gets no promise of a reset: 403\n`identity_inquiry_quota_exhausted` with `meta.resets: false` and no `Retry-After` — buy an inquiry batch in the panel,\nthen send the same request again (it is not stored under your `Idempotency-Key`).\n\nScope: `signers:write`."
parameters: []
responses:
403:
description: 'your account has NO daily identity-inquiry allowance (every day starts used up) — nobody asked, nothing added or charged; no Retry-After: buy an inquiry batch in the panel, then send the same request again'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/identity_inquiry_quota_exhausted'
status: 403
code: identity_inquiry_quota_exhausted
title_fa: 'حسابِ شما سهمیهٔ رایگانِ روزانه برای استعلامِ هویت ندارد، پس هویتِ امضاکنندگان استعلام نشد — این پاسخ دربارهٔ اطلاعاتِ آنها نیست. هیچ امضاکنندهای اضافه نشد و هزینهای کسر نشد. این سقف با گذشتِ روز باز نمیشود؛ در پنل، در صفحهٔ ساختِ قرارداد، بستهٔ استعلامِ اضافه بخرید و سپس همین درخواست را دوباره بفرستید.'
title_en: "Your account has no daily identity-inquiry allowance, so the signers' identities were not checked — this says nothing about their data. No signer was added and nothing was charged. Waiting will not open it: buy an inquiry batch in the panel, then send the same request again."
request_id: 01KRH8JRC4Y855P10CYC1C0AYS
meta:
resets: false
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/identity_inquiry_quota_exhausted'
status:
type: integer
example: 403
code:
type: string
example: identity_inquiry_quota_exhausted
title_fa:
type: string
example: 'حسابِ شما سهمیهٔ رایگانِ روزانه برای استعلامِ هویت ندارد، پس هویتِ امضاکنندگان استعلام نشد — این پاسخ دربارهٔ اطلاعاتِ آنها نیست. هیچ امضاکنندهای اضافه نشد و هزینهای کسر نشد. این سقف با گذشتِ روز باز نمیشود؛ در پنل، در صفحهٔ ساختِ قرارداد، بستهٔ استعلامِ اضافه بخرید و سپس همین درخواست را دوباره بفرستید.'
title_en:
type: string
example: "Your account has no daily identity-inquiry allowance, so the signers' identities were not checked — this says nothing about their data. No signer was added and nothing was charged. Waiting will not open it: buy an inquiry batch in the panel, then send the same request again."
request_id:
type: string
example: 01KRH8JRC4Y855P10CYC1C0AYS
meta:
type: object
properties:
resets:
type: boolean
example: false
409:
description: ''
content:
application/json:
schema:
oneOf:
-
description: 'an electronic replacement (`replaces` set) whose roster the system is still copying — nothing added, charged or texted'
type: object
example:
type: 'https://docs.elemza.com/errors/replacement_signers_pending'
status: 409
code: replacement_signers_pending
title_fa: 'این قرارداد نسخهٔ الکترونیکِ یک قراردادِ دیجیتال است و امضاکنندگانش همان امضاکنندگانِ قراردادِ قبلیاند که سامانه پس از پردازشِ سند خودش اضافه میکند؛ امضاکنندهای اضافه نشد. صبر کنید تا GET /contracts/{code}/processing آمادهبودن را بگوید.'
title_en: "This contract is the electronic replacement of a digital one; its signers are the replaced contract's, added by the system once the document is processed, so no signer was added. Wait for GET /contracts/{code}/processing to say ready."
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/replacement_signers_pending'
status:
type: integer
example: 409
code:
type: string
example: replacement_signers_pending
title_fa:
type: string
example: 'این قرارداد نسخهٔ الکترونیکِ یک قراردادِ دیجیتال است و امضاکنندگانش همان امضاکنندگانِ قراردادِ قبلیاند که سامانه پس از پردازشِ سند خودش اضافه میکند؛ امضاکنندهای اضافه نشد. صبر کنید تا GET /contracts/{code}/processing آمادهبودن را بگوید.'
title_en:
type: string
example: "This contract is the electronic replacement of a digital one; its signers are the replaced contract's, added by the system once the document is processed, so no signer was added. Wait for GET /contracts/{code}/processing to say ready."
-
description: 'an attached document (an amendment or a rescission of a completed contract) — its signers are fixed; nothing added, charged or texted'
type: object
example:
type: 'https://docs.elemza.com/errors/attached_document_signers_fixed'
status: 409
code: attached_document_signers_fixed
title_fa: 'این سند پیوستِ قراردادِ دیگری است (الحاقیه یا اقالهنامه)؛ امضاکنندگانش همان طرفینِ قراردادِ اصلیاند و هنگامِ ساختِ سند تعیین شدهاند، پس امضاکنندهای اضافه نشد.'
title_en: 'This is an attached document (an amendment or a rescission) of another contract; its signers are the parties of the original contract, fixed when it was made, so no signer was added.'
request_id: 01KRH8JRC4Y855P10CYC1C0AYS
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/attached_document_signers_fixed'
status:
type: integer
example: 409
code:
type: string
example: attached_document_signers_fixed
title_fa:
type: string
example: 'این سند پیوستِ قراردادِ دیگری است (الحاقیه یا اقالهنامه)؛ امضاکنندگانش همان طرفینِ قراردادِ اصلیاند و هنگامِ ساختِ سند تعیین شدهاند، پس امضاکنندهای اضافه نشد.'
title_en:
type: string
example: 'This is an attached document (an amendment or a rescission) of another contract; its signers are the parties of the original contract, fixed when it was made, so no signer was added.'
request_id:
type: string
example: 01KRH8JRC4Y855P10CYC1C0AYS
-
description: 'the contract is no longer a draft — signers were already added (waiting for signatures) or it has ended; also the loser of two batches sent at the same moment — nothing added, charged or texted'
type: object
example:
type: 'https://docs.elemza.com/errors/wrong_contract_status'
status: 409
code: wrong_contract_status
title_fa: 'فقط روی قرارداد در وضعیت پیشنویس میتوان امضاکننده اضافه کرد'
title_en: 'Only draft contracts accept new signers'
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/wrong_contract_status'
status:
type: integer
example: 409
code:
type: string
example: wrong_contract_status
title_fa:
type: string
example: 'فقط روی قرارداد در وضعیت پیشنویس میتوان امضاکننده اضافه کرد'
title_en:
type: string
example: 'Only draft contracts accept new signers'
422:
description: 'the contract has no document yet (created as JSON without file or source) — nothing added, charged or texted; the contract stays draft'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/document_required'
status: 422
code: document_required
title_fa: 'این قرارداد هنوز سندی ندارد؛ ابتدا فایلِ قرارداد را پیوست کنید — با فیلدِ file (multipart) در همان POST /contracts، یا با POST /contracts/{code}/files — و وقتی GET /contracts/{code}/processing آمادهبودن (ready) را گفت، امضاکنندگان را اضافه کنید؛ یا امضاکنندگان را همراهِ فایل در همان POST /contracts بفرستید. هیچ امضاکنندهای اضافه نشد، پیامکی نرفت و هزینهای کسر نشد.'
title_en: 'This contract has no document yet. Attach it — the multipart `file` field of POST /contracts, or POST /contracts/{code}/files — and add the signers once GET /contracts/{code}/processing says ready; or send the signers inline with the file in one POST /contracts. No signer was added, nothing was charged and nobody was texted.'
request_id: 01KRH8JRC4Y855P10CYC1C0AYS
meta:
reason: no_document
contract_status: draft
files: 'https://elemza.com/api/v1/contracts/ABCD1234EFGH5678/files'
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/document_required'
status:
type: integer
example: 422
code:
type: string
example: document_required
title_fa:
type: string
example: 'این قرارداد هنوز سندی ندارد؛ ابتدا فایلِ قرارداد را پیوست کنید — با فیلدِ file (multipart) در همان POST /contracts، یا با POST /contracts/{code}/files — و وقتی GET /contracts/{code}/processing آمادهبودن (ready) را گفت، امضاکنندگان را اضافه کنید؛ یا امضاکنندگان را همراهِ فایل در همان POST /contracts بفرستید. هیچ امضاکنندهای اضافه نشد، پیامکی نرفت و هزینهای کسر نشد.'
title_en:
type: string
example: 'This contract has no document yet. Attach it — the multipart `file` field of POST /contracts, or POST /contracts/{code}/files — and add the signers once GET /contracts/{code}/processing says ready; or send the signers inline with the file in one POST /contracts. No signer was added, nothing was charged and nobody was texted.'
request_id:
type: string
example: 01KRH8JRC4Y855P10CYC1C0AYS
meta:
type: object
properties:
reason:
type: string
example: no_document
contract_status:
type: string
example: draft
files:
type: string
example: 'https://elemza.com/api/v1/contracts/ABCD1234EFGH5678/files'
429:
description: "your account's daily identity-inquiry quota is used up — nobody was asked, nothing added or charged; header Retry-After: seconds until the reset"
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/identity_inquiry_quota_exhausted'
status: 429
code: identity_inquiry_quota_exhausted
title_fa: 'سقفِ روزانهٔ استعلامِ هویتِ حسابِ شما پر شده است، پس هویتِ امضاکنندگان استعلام نشد — این پاسخ دربارهٔ اطلاعاتِ آنها نیست. هیچ امضاکنندهای اضافه نشد و هزینهای کسر نشد. سقف در آغازِ روزِ بعد دوباره باز میشود (زمانش در Retry-After و meta.resets_at)؛ یا در پنل، در صفحهٔ ساختِ قرارداد، بستهٔ استعلامِ اضافه بخرید. سپس همین درخواست را دوباره بفرستید.'
title_en: "Your account's daily identity-inquiry quota is used up, so the signers' identities were not checked — this says nothing about their data. No signer was added and nothing was charged. The quota opens again at the start of the next day (Retry-After, meta.resets_at), or sooner after buying an inquiry batch in the panel; then send the same request again."
request_id: 01KRH8JRC4Y855P10CYC1C0AYS
meta:
retry_after_seconds: 30512
resets_at: '2026-11-19T00:00:00+03:30'
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/identity_inquiry_quota_exhausted'
status:
type: integer
example: 429
code:
type: string
example: identity_inquiry_quota_exhausted
title_fa:
type: string
example: 'سقفِ روزانهٔ استعلامِ هویتِ حسابِ شما پر شده است، پس هویتِ امضاکنندگان استعلام نشد — این پاسخ دربارهٔ اطلاعاتِ آنها نیست. هیچ امضاکنندهای اضافه نشد و هزینهای کسر نشد. سقف در آغازِ روزِ بعد دوباره باز میشود (زمانش در Retry-After و meta.resets_at)؛ یا در پنل، در صفحهٔ ساختِ قرارداد، بستهٔ استعلامِ اضافه بخرید. سپس همین درخواست را دوباره بفرستید.'
title_en:
type: string
example: "Your account's daily identity-inquiry quota is used up, so the signers' identities were not checked — this says nothing about their data. No signer was added and nothing was charged. The quota opens again at the start of the next day (Retry-After, meta.resets_at), or sooner after buying an inquiry batch in the panel; then send the same request again."
request_id:
type: string
example: 01KRH8JRC4Y855P10CYC1C0AYS
meta:
type: object
properties:
retry_after_seconds:
type: integer
example: 30512
resets_at:
type: string
example: '2026-11-19T00:00:00+03:30'
tags:
- Signers
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
signers:
type: array
description: 'Array of signer objects. A contract whose signers were sent WITH it (inline on a one-shot `POST /contracts`) together with `signer_mode` or `template_slot` takes no further signers here: 409 `signers_sent_with_contract`.'
example:
- architecto
items:
type: string
on_company_warning:
type: string
description: "What to do when a company signer has a high registry warning (company\n not found / dissolved / in liquidation / not active, board term ended, signer not on the current board):\n `continue` (default — the contract is sent and each signer's `legal.company_check` carries the warning) or\n `refuse` (409 `company_check_warning`, before any identity check, charge or row)."
example: refuse
required:
- signers
parameters:
-
in: path
name: code
description: '16-char contract code.'
example: architecto
required: true
schema:
type: string
'/api/v1/contracts/{code}/signers/{slug}':
get:
summary: 'Get signer'
operationId: getSigner
description: "Detailed view of a single signer. PII masked unless token has `signers:read_pii`.\n\nScope: `contracts:read`."
parameters: []
responses:
404:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/not_found'
status: 404
code: not_found
title_fa: 'منبع یافت نشد'
title_en: 'Resource not found'
request_id: 01M7RWG92KFSNW8561ASM220XZ
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/not_found'
status:
type: integer
example: 404
code:
type: string
example: not_found
title_fa:
type: string
example: 'منبع یافت نشد'
title_en:
type: string
example: 'Resource not found'
request_id:
type: string
example: 01M7RWG92KFSNW8561ASM220XZ
tags:
- Signers
delete:
summary: 'Remove signer'
operationId: removeSigner
description: "Removes a signer from a contract. Only allowed when:\n- Signer status is `waiting` (not yet signed)\n- Contract status is `draft` or `waiting_signature`\n- The token is of the same kind (live/test) that created the contract, else 409\n `sandbox_mode_mismatch` and nothing is removed\n- The contract is not an attached document (an amendment or a rescission of a completed contract): its\n signers are the original contract's parties and none can be removed — 409 `attached_document_signers_fixed`;\n cancel the whole document instead\n- The contract is not an electronic replacement whose copied roster has not arrived yet (a draft with\n `replaces` set) — 409 `replacement_signers_pending`. After it has arrived, removing works as on any contract.\n\nScope: `signers:write`."
parameters: []
responses:
204:
description: ''
content:
application/json:
schema:
type: object
example: { }
properties: { }
409:
description: ''
content:
application/json:
schema:
oneOf:
-
description: 'an electronic replacement whose roster the system is still copying — nothing removed'
type: object
example:
type: 'https://docs.elemza.com/errors/replacement_signers_pending'
status: 409
code: replacement_signers_pending
title_fa: 'امضاکنندگانِ این نسخهٔ الکترونیک هنوز از قراردادِ قبلی منتقل نشدهاند؛ امضاکنندهای حذف نشد. پس از آمادهشدنِ قرارداد دوباره امتحان کنید.'
title_en: "This replacement's signers have not been copied from the replaced contract yet; no signer was removed. Try again once the contract is ready."
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/replacement_signers_pending'
status:
type: integer
example: 409
code:
type: string
example: replacement_signers_pending
title_fa:
type: string
example: 'امضاکنندگانِ این نسخهٔ الکترونیک هنوز از قراردادِ قبلی منتقل نشدهاند؛ امضاکنندهای حذف نشد. پس از آمادهشدنِ قرارداد دوباره امتحان کنید.'
title_en:
type: string
example: "This replacement's signers have not been copied from the replaced contract yet; no signer was removed. Try again once the contract is ready."
-
description: 'an attached document (an amendment or a rescission of a completed contract) — none of its signers can be removed; cancel the whole document instead'
type: object
example:
type: 'https://docs.elemza.com/errors/attached_document_signers_fixed'
status: 409
code: attached_document_signers_fixed
title_fa: 'این سند پیوستِ قراردادِ دیگری است (الحاقیه یا اقالهنامه)؛ امضاکنندگانش همان طرفینِ قراردادِ اصلیاند و هیچکدام حذف نمیشود. اگر نمیخواهید ادامه دهید، کلِ سند را لغو کنید.'
title_en: 'This is an attached document (an amendment or a rescission) of another contract; its signers are the parties of the original contract and none can be removed. Cancel the whole document instead.'
request_id: 01KRH8JRC4Y855P10CYC1C0AYS
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/attached_document_signers_fixed'
status:
type: integer
example: 409
code:
type: string
example: attached_document_signers_fixed
title_fa:
type: string
example: 'این سند پیوستِ قراردادِ دیگری است (الحاقیه یا اقالهنامه)؛ امضاکنندگانش همان طرفینِ قراردادِ اصلیاند و هیچکدام حذف نمیشود. اگر نمیخواهید ادامه دهید، کلِ سند را لغو کنید.'
title_en:
type: string
example: 'This is an attached document (an amendment or a rescission) of another contract; its signers are the parties of the original contract and none can be removed. Cancel the whole document instead.'
request_id:
type: string
example: 01KRH8JRC4Y855P10CYC1C0AYS
tags:
- Signers
parameters:
-
in: path
name: code
description: '16-char contract code.'
example: architecto
required: true
schema:
type: string
-
in: path
name: slug
description: 'Per-signer slug.'
example: DEF456GHJ789KLM
required: true
schema:
type: string
'/api/v1/contracts/{code}/signers/{slug}/resend':
post:
summary: 'Resend signing link SMS'
operationId: resendSigningLinkSMS
description: "Re-sends the signing-link SMS to a waiting signer. Rate-limited to 3 per\n5 minutes per signer (returns 429 `rate_limit_exceeded`). Use the same kind of token\n(live/test) that created the contract, else 409 `sandbox_mode_mismatch` and nothing is sent.\nA contract with no document gets no signing link: 422 `document_required`, nothing sent, no resend spent.\n\nScope: `signers:write`."
parameters: []
responses:
422:
description: 'the contract has no document (never attached, or it could not be processed) — no SMS sent, no resend spent'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/document_required'
status: 422
code: document_required
title_fa: 'سندِ این قرارداد پردازش نشد و بدونِ سند برای امضا فرستاده نمیشود؛ فایلِ درست را با POST /contracts/{code}/files دوباره بفرستید و وقتی GET /contracts/{code}/processing آمادهبودن (ready) را گفت، امضاکنندگان را اضافه کنید. هیچ امضاکنندهای اضافه نشد، پیامکی نرفت و هزینهای کسر نشد.'
title_en: "This contract's document could not be processed, so it has no document. Upload a corrected file with POST /contracts/{code}/files, wait until GET /contracts/{code}/processing says ready, then add the signers. No signer was added, nothing was charged and nobody was texted."
meta:
reason: document_failed
contract_status: waiting_signature
files: 'https://elemza.com/api/v1/contracts/ABCD1234EFGH5678/files'
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/document_required'
status:
type: integer
example: 422
code:
type: string
example: document_required
title_fa:
type: string
example: 'سندِ این قرارداد پردازش نشد و بدونِ سند برای امضا فرستاده نمیشود؛ فایلِ درست را با POST /contracts/{code}/files دوباره بفرستید و وقتی GET /contracts/{code}/processing آمادهبودن (ready) را گفت، امضاکنندگان را اضافه کنید. هیچ امضاکنندهای اضافه نشد، پیامکی نرفت و هزینهای کسر نشد.'
title_en:
type: string
example: "This contract's document could not be processed, so it has no document. Upload a corrected file with POST /contracts/{code}/files, wait until GET /contracts/{code}/processing says ready, then add the signers. No signer was added, nothing was charged and nobody was texted."
meta:
type: object
properties:
reason:
type: string
example: document_failed
contract_status:
type: string
example: waiting_signature
files:
type: string
example: 'https://elemza.com/api/v1/contracts/ABCD1234EFGH5678/files'
tags:
- Signers
parameters:
-
in: path
name: code
description: '16-char contract code.'
example: architecto
required: true
schema:
type: string
-
in: path
name: slug
description: 'Per-signer slug.'
example: architecto
required: true
schema:
type: string
/api/v1/templates:
get:
summary: 'List templates'
operationId: listTemplates
description: "Lists contract templates the caller can use.\n\n`view_scope` options:\n- `self` — own templates only (default)\n- `shared_from_parent` — own + templates shared by org parent/root\n- `all_org` — entire org tree (org root only)\n\nScope: `templates:read`."
parameters:
-
in: query
name: view_scope
description: 'self | shared_from_parent | all_org. Default self.'
example: architecto
required: false
schema:
type: string
description: 'self | shared_from_parent | all_org. Default self.'
example: architecto
-
in: query
name: active
description: 'Filter by active status.'
example: false
required: false
schema:
type: boolean
description: 'Filter by active status.'
example: false
-
in: query
name: page
description: ''
example: 16
required: false
schema:
type: integer
description: ''
example: 16
-
in: query
name: per_page
description: 'Max 100. Default 20.'
example: 16
required: false
schema:
type: integer
description: 'Max 100. Default 20.'
example: 16
responses:
401:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/token_invalid'
status: 401
code: token_invalid
title_fa: 'توکن نامعتبر است'
title_en: 'Invalid token'
request_id: 01M7RWG97SP3A7BXDG6GEM9PAE
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/token_invalid'
status:
type: integer
example: 401
code:
type: string
example: token_invalid
title_fa:
type: string
example: 'توکن نامعتبر است'
title_en:
type: string
example: 'Invalid token'
request_id:
type: string
example: 01M7RWG97SP3A7BXDG6GEM9PAE
tags:
- Templates
'/api/v1/templates/{id}':
get:
summary: 'Get template'
operationId: getTemplate
description: "Full template shape with embedded positions + page geometry + sample preview link.\n\nScope: `templates:read`."
parameters: []
responses:
404:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/not_found'
status: 404
code: not_found
title_fa: 'منبع یافت نشد'
title_en: 'Resource not found'
request_id: 01M7RWG983V8QES7ZAACGMA3EP
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/not_found'
status:
type: integer
example: 404
code:
type: string
example: not_found
title_fa:
type: string
example: 'منبع یافت نشد'
title_en:
type: string
example: 'Resource not found'
request_id:
type: string
example: 01M7RWG983V8QES7ZAACGMA3EP
tags:
- Templates
parameters:
-
in: path
name: id
description: 'The ID of the template.'
example: architecto
required: true
schema:
type: string
-
in: path
name: template
description: 'Template ID.'
example: 16
required: true
schema:
type: integer
'/api/v1/templates/{template}/preview/{page}':
get:
summary: 'Template page preview'
operationId: templatePagePreview
description: "**NOT IMPLEMENTED YET** — returns `501 preview_not_available`. The signed\npage-preview URL lands in a later phase (Storage::temporaryUrl). Documented\nas a stub so merchants do not code against a fake `url:null` 200.\n\nScope: `templates:read`."
parameters: []
responses:
401:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/token_invalid'
status: 401
code: token_invalid
title_fa: 'توکن نامعتبر است'
title_en: 'Invalid token'
request_id: 01M7RWG98AXEH2KSPYMJT94TW5
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/token_invalid'
status:
type: integer
example: 401
code:
type: string
example: token_invalid
title_fa:
type: string
example: 'توکن نامعتبر است'
title_en:
type: string
example: 'Invalid token'
request_id:
type: string
example: 01M7RWG98AXEH2KSPYMJT94TW5
501:
description: 'Stub — not implemented'
content:
application/json:
schema:
type: object
example:
status: 501
code: preview_not_available
properties:
status:
type: integer
example: 501
code:
type: string
example: preview_not_available
tags:
- Templates
parameters:
-
in: path
name: template
description: 'Template ID.'
example: 16
required: true
schema:
type: integer
-
in: path
name: page
description: 'Page number (1-indexed).'
example: 16
required: true
schema:
type: integer
'/api/v1/verify/{code}':
get:
summary: 'Verify a tracking code'
operationId: verifyATrackingCode
description: "Public — no token. The same answer as the «استعلام سند» page on elemza.com: whether a document\nwith this tracking code exists, its status, and — only when it is completed — its title, completion\ntime, signer count and the platform seal's time.\n\n**`valid` is true only for a completed contract that is not a test (sandbox) contract.** A test\ncontract was signed under a `pat_test_*` token with no real identity check; it answers\n`is_test: true, valid: false` whatever its status. A contract that is not completed returns its\nstatus only.\n\n`company_signatures` (completed, non-test contracts only) lists, for each signature made on behalf of a\ncompany, the company and the basis the platform recorded for that signer's authority — never a person's name.\n\n`identity_summary` (completed, non-test contracts only) counts how the signers' identities were checked —\n`category` is one of `registry` (Shahkar and the civil registry), `registry_no_mobile` (the civil registry; the\nmobile ↔ national-code match was not made at signing), `foreigners`, `otp_only`, `manual`, `account`,\n`guardian` — with a Persian `label`. Counts only, never a name.\n\nNo signer names, mobiles or national codes are ever returned. Dates are ISO-8601 with a Jalali\ntwin (`Y/m/d H:i`, Tehran time). Rate limit: 60 requests per minute per IP (`throttle:api-anon`)."
parameters: []
responses:
200:
description: ''
content:
application/json:
schema:
oneOf:
-
description: completed
type: object
example:
data:
code: ABCD1234EFGH5678
found: true
status: completed
is_test: false
valid: true
completed_at: '2026-08-20T10:00:00+03:30'
completed_at_jalali: '1405/05/29 10:00'
signers_count: 2
sealed_at: null
sealed_at_jalali: null
title: 'قرارداد همکاری'
company_signatures:
-
company: '«آرین تجارت پارس»'
basis: 'حقِ امضای منفرد طبقِ مرجعِ ثبت'
identity_summary:
-
category: registry
label: 'شاهکار و ثبتاحوال'
count: 2
properties:
data:
type: object
properties:
code:
type: string
example: ABCD1234EFGH5678
found:
type: boolean
example: true
status:
type: string
example: completed
is_test:
type: boolean
example: false
valid:
type: boolean
example: true
completed_at:
type: string
example: '2026-08-20T10:00:00+03:30'
completed_at_jalali:
type: string
example: '1405/05/29 10:00'
signers_count:
type: integer
example: 2
sealed_at:
type: string
example: null
nullable: true
sealed_at_jalali:
type: string
example: null
nullable: true
title:
type: string
example: 'قرارداد همکاری'
company_signatures:
type: array
example:
-
company: '«آرین تجارت پارس»'
basis: 'حقِ امضای منفرد طبقِ مرجعِ ثبت'
items:
type: object
properties:
company:
type: string
example: '«آرین تجارت پارس»'
basis:
type: string
example: 'حقِ امضای منفرد طبقِ مرجعِ ثبت'
identity_summary:
type: array
example:
-
category: registry
label: 'شاهکار و ثبتاحوال'
count: 2
items:
type: object
properties:
category:
type: string
example: registry
label:
type: string
example: 'شاهکار و ثبتاحوال'
count:
type: integer
example: 2
-
description: 'test contract'
type: object
example:
data:
code: ABCD1234EFGH5678
found: true
status: completed
is_test: true
valid: false
completed_at: '2026-08-20T10:00:00+03:30'
completed_at_jalali: '1405/05/29 10:00'
signers_count: 1
sealed_at: null
sealed_at_jalali: null
title: آزمایشی
company_signatures: []
identity_summary: []
properties:
data:
type: object
properties:
code:
type: string
example: ABCD1234EFGH5678
found:
type: boolean
example: true
status:
type: string
example: completed
is_test:
type: boolean
example: true
valid:
type: boolean
example: false
completed_at:
type: string
example: '2026-08-20T10:00:00+03:30'
completed_at_jalali:
type: string
example: '1405/05/29 10:00'
signers_count:
type: integer
example: 1
sealed_at:
type: string
example: null
nullable: true
sealed_at_jalali:
type: string
example: null
nullable: true
title:
type: string
example: آزمایشی
company_signatures:
type: array
example: []
identity_summary:
type: array
example: []
-
description: 'not completed'
type: object
example:
data:
code: ABCD1234EFGH5678
found: true
status: waiting_signature
is_test: false
valid: false
completed_at: null
completed_at_jalali: null
signers_count: null
sealed_at: null
sealed_at_jalali: null
title: null
company_signatures: []
identity_summary: []
properties:
data:
type: object
properties:
code:
type: string
example: ABCD1234EFGH5678
found:
type: boolean
example: true
status:
type: string
example: waiting_signature
is_test:
type: boolean
example: false
valid:
type: boolean
example: false
completed_at:
type: string
example: null
nullable: true
completed_at_jalali:
type: string
example: null
nullable: true
signers_count:
type: string
example: null
nullable: true
sealed_at:
type: string
example: null
nullable: true
sealed_at_jalali:
type: string
example: null
nullable: true
title:
type: string
example: null
nullable: true
company_signatures:
type: array
example: []
identity_summary:
type: array
example: []
404:
description: 'unknown code'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/not_found'
status: 404
code: not_found
title_fa: 'سندی با این کد رهگیری ثبت نشده است'
title_en: 'No document has this tracking code'
request_id: 01J...
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/not_found'
status:
type: integer
example: 404
code:
type: string
example: not_found
title_fa:
type: string
example: 'سندی با این کد رهگیری ثبت نشده است'
title_en:
type: string
example: 'No document has this tracking code'
request_id:
type: string
example: 01J...
429:
description: 'too many requests'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/rate_limit_exceeded'
status: 429
code: rate_limit_exceeded
title_fa: 'تعداد درخواست از حد مجاز فراتر رفت'
title_en: 'Rate limit exceeded'
request_id: 01J...
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/rate_limit_exceeded'
status:
type: integer
example: 429
code:
type: string
example: rate_limit_exceeded
title_fa:
type: string
example: 'تعداد درخواست از حد مجاز فراتر رفت'
title_en:
type: string
example: 'Rate limit exceeded'
request_id:
type: string
example: 01J...
tags:
- Verification
security: []
parameters:
-
in: path
name: code
description: "The document's tracking code."
example: ABCD1234EFGH5678
required: true
schema:
type: string
/api/v1/webhooks:
get:
summary: 'List webhook subscriptions'
operationId: listWebhookSubscriptions
description: ''
parameters:
-
in: query
name: active
description: 'Filter by active state.'
example: false
required: false
schema:
type: boolean
description: 'Filter by active state.'
example: false
-
in: query
name: page
description: ''
example: 16
required: false
schema:
type: integer
description: ''
example: 16
-
in: query
name: per_page
description: 'Max 100.'
example: 16
required: false
schema:
type: integer
description: 'Max 100.'
example: 16
responses:
401:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/token_invalid'
status: 401
code: token_invalid
title_fa: 'توکن نامعتبر است'
title_en: 'Invalid token'
request_id: 01M7RWG9AV9ZC2F3Q3D3JBPXMQ
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/token_invalid'
status:
type: integer
example: 401
code:
type: string
example: token_invalid
title_fa:
type: string
example: 'توکن نامعتبر است'
title_en:
type: string
example: 'Invalid token'
request_id:
type: string
example: 01M7RWG9AV9ZC2F3Q3D3JBPXMQ
tags:
- Webhooks
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
active:
type: boolean
description: ''
example: false
nullable: true
page:
type: integer
description: 'value باید حداقل 1 باشد.'
example: 16
nullable: true
per_page:
type: integer
description: 'value باید حداقل 1 باشد. value نباید بیشتر از 100 باشد.'
example: 22
nullable: true
post:
summary: 'Create webhook subscription'
operationId: createWebhookSubscription
description: "Registers an HTTPS endpoint to receive event deliveries. We POST each\nmatching event to your URL and sign it with HMAC-SHA256:\n\n X-Emza-Timestamp: \n X-Emza-Signature: sha256=\n\nCompare with `hash_equals`, and reject anything whose timestamp is more than 5 minutes old.\n\nNOTE: this docblock is published to customers by Scribe. Until 2026-07-31 it described a\nStripe-style `X-Emza-Signature: t=,v1=` header that this platform has never sent —\nsee App\\Services\\Webhook\\WebhookSigner, which is the only authority on the wire format, and\ntests/Feature/Sdk/SdkWebhookVerificationTest, which pins the two together.\n\n**The plain signing `secret` is returned ONCE — store it immediately.**\nSubsequent reads (`index`, `show`) omit the secret entirely. Use\n`PATCH /webhooks/{id}` with `rotate_secret=true` to issue a fresh secret\n(invalidates the previous one immediately).\n\n**URL validation (SSRF guard):** the `url` field is rejected with `422`\nif it fails any of:\n - Non-HTTPS scheme (`http://`, `ftp://`, `javascript:`, `file://`)\n - Loopback IPs (`127.0.0.0/8`, `::1`)\n - RFC 1918 private (`10/8`, `172.16/12`, `192.168/16`)\n - Link-local + cloud metadata (`169.254.0.0/16`, `100.100.100.200`)\n - IPv6 link-local (`fe80::/10`) or unique-local (`fc00::/7`)\n - Hostname suffix `.local`, `.internal`, `.private`, `.lan` or `localhost`\n - Hostname whose DNS resolves to any of the above\n\n**Allowed event names** (set in `events` array — use `[\"*\"]` for all):\n`contract.created`, `contract.processing.completed`, `contract.processing.failed`,\n`contract.signer.added`, `contract.signer.authenticated`, `contract.signer.signed`,\n`contract.signer.rejected`, `contract.completed`, `contract.canceled`,\n`contract.voided`, `contract.refunded`,\n`form.submission.created`, `form.submission.completed`, `form.submission.bridged`,\n`form.submission.bridge_failed`,\n`certificate.issued`, `certificate.failed`, `certificate.expiring`,\n`certificate.expired`, `certificate.revoked`,\n`contract.signature.failed`, `signer.certificate.missing`,\n`contract.signing_deadline.passed`,\n`contract.amendment.completed`, `contract.rescinded`,\nplus `*` (wildcard).\n\nNOTE: this list is typed by hand because Scribe publishes the docblock verbatim and cannot\nread a constant. It is pinned to `ALLOWED_EVENTS` by\n`ApiDocsFreshnessTest::test_the_webhook_docblock_lists_exactly_the_allowed_events` — until\n1405/06/18 it advertised ten of the twenty events and had been half a product behind since\nthe form and certificate workstreams shipped.\n\nIf `*` is present alongside specific events, the specifics are dropped\n(the wildcard makes them redundant). Same event listed twice is deduped.\n\nScope: `webhooks:manage`. Idempotency-Key required (24h replay window)."
parameters: []
responses:
201:
description: ''
content:
application/json:
schema:
type: object
example:
data:
id: 01krh7z0e8a4n39gf2ary73xbj
url: 'https://example.com/webhooks/emza'
events:
- contract.completed
- contract.signer.signed
active: true
disabled_at: null
failed_deliveries_count: 0
last_delivery_at: null
last_delivery_status: null
created_at: '2026-05-13T18:00:42.000Z'
updated_at: '2026-05-13T18:00:42.000Z'
secret: 35ada3b45aa00df901b74b2b483114315a0c21f7c096f17e0bb29ab7d907fe32
_warning: 'Save this secret now — it will NOT be shown again.'
properties:
data:
type: object
properties:
id:
type: string
example: 01krh7z0e8a4n39gf2ary73xbj
url:
type: string
example: 'https://example.com/webhooks/emza'
events:
type: array
example:
- contract.completed
- contract.signer.signed
items:
type: string
active:
type: boolean
example: true
disabled_at:
type: string
example: null
nullable: true
failed_deliveries_count:
type: integer
example: 0
last_delivery_at:
type: string
example: null
nullable: true
last_delivery_status:
type: string
example: null
nullable: true
created_at:
type: string
example: '2026-05-13T18:00:42.000Z'
updated_at:
type: string
example: '2026-05-13T18:00:42.000Z'
secret:
type: string
example: 35ada3b45aa00df901b74b2b483114315a0c21f7c096f17e0bb29ab7d907fe32
_warning:
type: string
example: 'Save this secret now — it will NOT be shown again.'
409:
description: 'URL already subscribed'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/subscription_exists'
status: 409
code: subscription_exists
title_fa: 'این نشانی از قبل ثبت شده است'
title_en: 'This URL already has an active subscription'
detail_en: 'Reuse subscription 01krh7z0e8a4n39gf2ary73xbj, or DELETE it and create a new one. If you lost its signing secret, call PATCH /webhooks/01krh7z0e8a4n39gf2ary73xbj with rotate_secret=true.'
request_id: 01KRH8JRC4Y855P10CYC1C0AYS
meta:
subscription_id: 01krh7z0e8a4n39gf2ary73xbj
url: 'https://example.com/webhooks/emza'
events:
- contract.completed
created_at: '2026-05-13T18:00:42.000Z'
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/subscription_exists'
status:
type: integer
example: 409
code:
type: string
example: subscription_exists
title_fa:
type: string
example: 'این نشانی از قبل ثبت شده است'
title_en:
type: string
example: 'This URL already has an active subscription'
detail_en:
type: string
example: 'Reuse subscription 01krh7z0e8a4n39gf2ary73xbj, or DELETE it and create a new one. If you lost its signing secret, call PATCH /webhooks/01krh7z0e8a4n39gf2ary73xbj with rotate_secret=true.'
request_id:
type: string
example: 01KRH8JRC4Y855P10CYC1C0AYS
meta:
type: object
properties:
subscription_id:
type: string
example: 01krh7z0e8a4n39gf2ary73xbj
url:
type: string
example: 'https://example.com/webhooks/emza'
events:
type: array
example:
- contract.completed
items:
type: string
created_at:
type: string
example: '2026-05-13T18:00:42.000Z'
422:
description: 'SSRF blocked URL'
content:
application/json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/validation'
status: 422
code: validation
title_fa: 'اعتبارسنجی ورودی شکست خورد'
title_en: 'Request validation failed'
errors:
url:
- 'آدرسهای داخلی شبکه (localhost / *.local / *.internal) مجاز نیستند.'
request_id: 01KRH8JRC4Y855P10CYC1C0AYS
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/validation'
status:
type: integer
example: 422
code:
type: string
example: validation
title_fa:
type: string
example: 'اعتبارسنجی ورودی شکست خورد'
title_en:
type: string
example: 'Request validation failed'
errors:
type: object
properties:
url:
type: array
example:
- 'آدرسهای داخلی شبکه (localhost / *.local / *.internal) مجاز نیستند.'
items:
type: string
request_id:
type: string
example: 01KRH8JRC4Y855P10CYC1C0AYS
tags:
- Webhooks
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
url:
type: string
description: 'HTTPS endpoint to receive deliveries. Max 500 chars.'
example: 'https://example.com/webhooks/emza'
events:
type: array
description: 'Event names from the allowed list. Use `["*"]` for all.'
example:
- contract.completed
- contract.signer.signed
items:
type: string
active:
type: boolean
description: 'When false, subscription is paused (no deliveries). Default true.'
example: false
required:
- url
- events
'/api/v1/webhooks/{id}':
get:
summary: 'Get webhook subscription'
operationId: getWebhookSubscription
description: ''
parameters: []
responses:
401:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/token_invalid'
status: 401
code: token_invalid
title_fa: 'توکن نامعتبر است'
title_en: 'Invalid token'
request_id: 01M7RWG9B17S595X9G04BMPX6D
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/token_invalid'
status:
type: integer
example: 401
code:
type: string
example: token_invalid
title_fa:
type: string
example: 'توکن نامعتبر است'
title_en:
type: string
example: 'Invalid token'
request_id:
type: string
example: 01M7RWG9B17S595X9G04BMPX6D
tags:
- Webhooks
patch:
summary: 'Update webhook subscription'
operationId: updateWebhookSubscription
description: "Partial update — any field omitted is left unchanged. New `url` values\npass through the same SSRF guard as `POST /webhooks` (see Create endpoint).\n\nWhen `rotate_secret=true`, a fresh HMAC signing secret is generated and\nreturned in the response — the previous secret is invalidated immediately,\nso any in-flight or already-sent webhook deliveries signed with the old\nsecret will fail verification on the receiver side. Plan rotations during\na quiet period or pause via `active=false` first.\n\nScope: `webhooks:manage`. Idempotency-Key required (24h replay window)."
parameters: []
responses:
200:
description: ''
content:
application/json:
schema:
type: object
example:
data:
id: 01krh7z0e8a4n39gf2ary73xbj
url: 'https://example.com/webhooks/emza'
events:
- '*'
active: false
failed_deliveries_count: 2
last_delivery_at: '2026-05-13T17:30:00.000Z'
last_delivery_status: delivered
properties:
data:
type: object
properties:
id:
type: string
example: 01krh7z0e8a4n39gf2ary73xbj
url:
type: string
example: 'https://example.com/webhooks/emza'
events:
type: array
example:
- '*'
items:
type: string
active:
type: boolean
example: false
failed_deliveries_count:
type: integer
example: 2
last_delivery_at:
type: string
example: '2026-05-13T17:30:00.000Z'
last_delivery_status:
type: string
example: delivered
tags:
- Webhooks
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
url:
type: string
description: 'New endpoint URL (subject to same SSRF guard as create).'
example: 'http://www.bailey.biz/quos-velit-et-fugiat-sunt-nihil-accusantium-harum.html'
events:
type: array
description: 'Replaces the entire events list. Same allowed values as create.'
example:
- architecto
items:
type: string
active:
type: boolean
description: 'Toggle the subscription on/off without deleting it.'
example: false
rotate_secret:
type: boolean
description: 'When true, issues a fresh secret (returned in response under `secret` + `_warning`).'
example: false
delete:
summary: 'Delete webhook subscription'
operationId: deleteWebhookSubscription
description: "Soft-deletes the subscription. In-flight deliveries that have already\nbeen queued will complete; no new deliveries are dispatched."
parameters: []
responses: { }
tags:
- Webhooks
parameters:
-
in: path
name: id
description: 'The ID of the webhook.'
example: B8c6F7NNfcj9m6RJYC6RtkmZN6
required: true
schema:
type: string
/api/v1/webhook-deliveries:
get:
summary: 'List webhook deliveries'
operationId: listWebhookDeliveries
description: ''
parameters:
-
in: query
name: subscription_id
description: 'Filter by subscription.'
example: architecto
required: false
schema:
type: string
description: 'Filter by subscription.'
example: architecto
-
in: query
name: event_name
description: 'Filter by event name.'
example: architecto
required: false
schema:
type: string
description: 'Filter by event name.'
example: architecto
-
in: query
name: status
description: pending|delivered|failed|dead-letter
example: architecto
required: false
schema:
type: string
description: pending|delivered|failed|dead-letter
example: architecto
-
in: query
name: page
description: ''
example: 16
required: false
schema:
type: integer
description: ''
example: 16
-
in: query
name: per_page
description: 'Max 100.'
example: 16
required: false
schema:
type: integer
description: 'Max 100.'
example: 16
responses:
401:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/token_invalid'
status: 401
code: token_invalid
title_fa: 'توکن نامعتبر است'
title_en: 'Invalid token'
request_id: 01M7RWG9BEZ238YA5TWR04PH6P
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/token_invalid'
status:
type: integer
example: 401
code:
type: string
example: token_invalid
title_fa:
type: string
example: 'توکن نامعتبر است'
title_en:
type: string
example: 'Invalid token'
request_id:
type: string
example: 01M7RWG9BEZ238YA5TWR04PH6P
tags:
- Webhooks
'/api/v1/webhook-deliveries/{id}':
get:
summary: 'Get webhook delivery'
operationId: getWebhookDelivery
description: 'Shows full payload, response code, error message, attempt history.'
parameters: []
responses:
401:
description: ''
content:
application/problem+json:
schema:
type: object
example:
type: 'https://docs.elemza.com/errors/token_invalid'
status: 401
code: token_invalid
title_fa: 'توکن نامعتبر است'
title_en: 'Invalid token'
request_id: 01M7RWG9BM0SBP422S36W750BD
properties:
type:
type: string
example: 'https://docs.elemza.com/errors/token_invalid'
status:
type: integer
example: 401
code:
type: string
example: token_invalid
title_fa:
type: string
example: 'توکن نامعتبر است'
title_en:
type: string
example: 'Invalid token'
request_id:
type: string
example: 01M7RWG9BM0SBP422S36W750BD
tags:
- Webhooks
parameters:
-
in: path
name: id
description: 'The ID of the webhook delivery.'
example: B8c6F7NNfcj9m6RJYC6RtkmZN6
required: true
schema:
type: string
'/api/v1/webhooks/{id}/test':
post:
summary: 'Send a synthetic test event'
operationId: sendASyntheticTestEvent
description: "Fires a `webhook.test` event to verify the endpoint is reachable + signed\ncorrectly. Counts toward `webhook_deliveries` like a real event."
parameters: []
responses: { }
tags:
- Webhooks
parameters:
-
in: path
name: id
description: 'The ID of the webhook.'
example: B8c6F7NNfcj9m6RJYC6RtkmZN6
required: true
schema:
type: string
'/api/v1/webhook-deliveries/{id}/replay':
post:
summary: 'Replay webhook delivery'
operationId: replayWebhookDelivery
description: "Creates a NEW delivery row with the same payload + subscription. The\noriginal row keeps its terminal status (failed / dead-letter / delivered)."
parameters: []
responses: { }
tags:
- Webhooks
parameters:
-
in: path
name: id
description: 'The ID of the webhook delivery.'
example: B8c6F7NNfcj9m6RJYC6RtkmZN6
required: true
schema:
type: string