SonaCORE

Referência / Quadra Command API

Attestations

1 operação em Quadra Command API 0.2.0.

POST/v1/attestations

Record a CRC professional's attestation of one accounting artifact

Record that a CRC-holding professional attested one artifact: a closed period (`PERIOD` — `COMPETENCIA_APROVADA`, `CARTA_RESPONSABILIDADE`), the closed month's complete export box (`PIECE` — `ESCRITURACAO_ASSINADA`), or a fiscal document (`FISCDOC` — `ESCRITURACAO_ASSINADA`).

⭐ **`subject_hash` must be the artifact's hash now.** Send the `current_subject_hash` from the artifact's own read; if the artifact changed since, the answer is 409 `SUBJECT_HASH_MISMATCH` and nothing is written — a stale screen can never be signed.

⭐ **Anchored in the ledger.** The record's digest is committed to the journal hash chain in the same transaction (`journal_seq_no`), so it is sealed by the next signed checkpoint and cannot be edited or removed without detection.

⛔ **One subject per request.** There is no batch form (Phase-0 P2: the act is personal and privative). A reclassification is attested on `PATCH /v1/obligations/{id}/natureza`, beside the correction itself.

Raises: 404: SUBJECT_NOT_FOUND (unknown and foreign subjects are the same miss) 409: SUBJECT_HASH_MISMATCH, IDEMPOTENCY_KEY_REUSED, ATTESTATION_CONFLICT 422: NOT_ATTESTABLE (e.g. the period is not CLOSED), ACT_NOT_ALLOWED_FOR_SUBJECT, INVALID_ATTESTATION, INVALID_SUBJECT_ID 503: JOURNAL_NOT_STARTED

Parâmetros

NomeTipoDetalhe
Idempotency-Keystringheaderobrigatório

Corpo da requisição

CreateAttestationRequest — obrigatório. Os campos estão listados em Esquemas, abaixo.

Respostas

StatusCorpoDetalhe
201AttestationRecordResposta bem-sucedida
422HTTPValidationErrorErro de validação

Esquemas

Os modelos que as operações acima aceitam e devolvem. Campos opcionais estão marcados como tal; um campo tipado como outro modelo está documentado sob o nome dele.

AttestationRecord

One CRC professional's act on one artifact.

CampoTipoDetalhe
actstringobrigatórioESCRITURACAO_ASSINADA | COMPETENCIA_APROVADA | RECLASSIFICACAO | CARTA_RESPONSABILIDADE | REABERTURA_AUTORIZADA
attestation_versionintegerobrigatório
attested_atstringobrigatórioServer clock at the write (UTC)
attested_viastringobrigatórioThe surface the act was performed on
crc_numberstringobrigatórioThe professional's CRC registration
crc_ufstringobrigatórioThe UF of that registration
firm_cnpjstringobrigatórioThe organização contábil — the contracting party
firm_crcstringobrigatórioThe firm's own CRC registration
journal_hashstringobrigatórioThat entry's journal_hash
journal_seq_nointegerobrigatórioThe journal entry that commits record_digest
natureza_fromstring, opcionalRECLASSIFICATION only: the prior natureza
natureza_tostring, opcionalRECLASSIFICATION only: the corrected natureza
professional_namestringobrigatório
record_digeststringobrigatóriosha256 over this record's fields — committed to the journal hash chain as the evidence_hash of entry journal_seq_no
seqintegerobrigatório1-based, per subject; append-only
subject_hashstringobrigatóriosha256 of the artifact exactly as attested — a canonical projection of the stored artifact, never of an API response
subject_idstringobrigatórioPERIOD/PIECE: '{scope_id}:{YYYY-MM}'; FISCDOC: the doc_id; RECLASSIFICATION: the obligation_id
subject_kindstringobrigatórioPERIOD | FISCDOC | PIECE | RECLASSIFICATION

CreateAttestationRequest

One act on one subject. ⛔ Not a list: one act, one signature (Phase-0 P2).

CampoTipoDetalhe
act"ESCRITURACAO_ASSINADA" | "COMPETENCIA_APROVADA" | "CARTA_RESPONSABILIDADE" | "REABERTURA_AUTORIZADA"obrigatórioREABERTURA_AUTORIZADA (PERIOD only, while CLOSED): the accountant's decision to reopen — binds the close being reopened, and is what POST .../reopen's attestation_seq names. It never makes a period ATTESTED
attested_viastringobrigatórioUPPER_SNAKE, e.g. CONSOLE_CONTADOR
crc_numberstringobrigatório
crc_ufstringobrigatório
firm_cnpjstringobrigatório14 characters, no punctuation; alphanumeric CNPJs accepted
firm_crcstringobrigatório
professional_namestringobrigatório
subject_hashstringobrigatórioThe current_subject_hash of the artifact the professional reviewed. A mismatch with the artifact now is 409 SUBJECT_HASH_MISMATCH
subject_idstringobrigatório
subject_kind"PERIOD" | "FISCDOC" | "PIECE"obrigatórioRECLASSIFICATION is attested beside its correction, on PATCH /v1/obligations/{id}/natureza

HTTPValidationError

CampoTipoDetalhe
detailarray de ValidationError

ValidationError

CampoTipoDetalhe
ctxobject
inputnão declarado
locarray de string ou integerobrigatório
msgstringobrigatório
typestringobrigatório