components:
  schemas:
    AttemptsBody:
      additionalProperties: false
      properties:
        budgetExhausted:
          description: true when the automatic retry budget was exhausted and the consultation became a signalled operator case.
          type: boolean
        count:
          description: Number of dispatch attempts made.
          examples:
            - 3
          format: int64
          type: integer
        lastAttemptAt:
          description: Instant of the most recent attempt; null when there has been none.
          format: date-time
          type:
            - string
            - "null"
      required:
        - count
        - lastAttemptAt
        - budgetExhausted
      type: object
    CloseOperatorCaseRequestBody:
      additionalProperties: false
      properties:
        reason:
          description: Required. Why the case needs no further operator action.
          maxLength: 2000
          minLength: 1
          type: string
      required:
        - reason
      type: object
    ConsultationAcceptedBody:
      additionalProperties: false
      properties:
        acceptedAt:
          description: Acceptance instant (RFC3339, UTC). On an idempotent replay this is the ORIGINAL acceptance instant, never the replay instant.
          format: date-time
          type: string
        id:
          description: Consultation identifier (poll via GET /v1/src/consultations/{id}).
          examples:
            - 8f14e45f-ceea-467a-9a36-dedd4bea2543
          type: string
        status:
          description: Lifecycle state of the consultation. A newly accepted consultation is always pending — a NORMAL state, never an error. An idempotent REPLAY reports the state the original consultation is in now, so it may be completed or failed.
          examples:
            - pending
          type: string
      required:
        - id
        - status
        - acceptedAt
      type: object
    ConsultationBody:
      additionalProperties: false
      properties:
        acceptedAt:
          description: Acceptance instant (RFC3339).
          format: date-time
          type: string
        attempts:
          $ref: "#/components/schemas/AttemptsBody"
          description: Dispatch attempt history summary.
        bcbControlCode:
          description: Consultation control code assigned by BACEN (NumCtrlSRC).
          examples:
            - SRC20260826000000123
          type: string
        bcbProcessedAt:
          description: Processing instant at BACEN (DtHrBC); null until completed.
          format: date-time
          type:
            - string
            - "null"
        companyConsultationId:
          description: "The company consultation this holder or representative belongs to — the LINK, seen from the child. null for individual and company. Follow it with GET /v1/src/consultations/{id}; list the other children with GET /v1/src/consultations?companyConsultationId={id}. Its verdict and this one never couple: the decision is the institution's (arts. 2º-A/4º-A §3º)."
          type:
            - string
            - "null"
        concludedAt:
          description: Conclusion instant; null while pending.
          format: date-time
          type:
            - string
            - "null"
        documentMasked:
          description: Masked consulted document.
          examples:
            - 529******25
          type: string
        documentType:
          description: Type of the consulted document.
          examples:
            - CPF
          type: string
        id:
          description: Consultation identifier.
          examples:
            - 8f14e45f-ceea-467a-9a36-dedd4bea2543
          type: string
        institutionRecord:
          $ref: "#/components/schemas/InstitutionRecordBody"
          description: "The ONE record the institution filed against this consultation (arts. 2º-A/4º-A): kind \"exceptional_proceed\" (§1º — it contracted despite the active restriction, with a justification and a circumstance) or \"refusal_explanation\" (§2º — it refused, and this is what the interested party was told). The two are mutually exclusive. null when none was filed; immutable once filed."
        motivation:
          $ref: "#/components/schemas/MotivationBody"
          description: The recorded motivation context.
        protectionTypes:
          description: The consulted protection types, in request order.
          items:
            type: string
          type:
            - array
            - "null"
        regulatoryOperationNumber:
          description: "The operation number (NUOp) that Lerian SRC creates for the consultation. It has 23 characters: the institution's 8-character CNPJ base, an 8-digit date and a 7-digit sequence. Use it to reconcile the operation with BACEN's records. Absent until the dispatch is opened."
          examples:
            - "12345678202609100000001"
          type: string
        rejection:
          $ref: "#/components/schemas/RejectionBody"
          description: Present when failed by a BACEN technical rejection (code preserved verbatim); null otherwise.
        status:
          description: "Lifecycle state: pending | completed | failed. pending is a NORMAL state, never an error."
          examples:
            - pending
          type: string
        subjectRole:
          description: "The role the consulted document plays: individual | company | holder | representative. Always present."
          examples:
            - representative
          type: string
        verdicts:
          description: Present when completed — one verdict per consulted protection type.
          items:
            $ref: "#/components/schemas/VerdictBody"
          type:
            - array
            - "null"
      required:
        - id
        - documentMasked
        - documentType
        - subjectRole
        - companyConsultationId
        - protectionTypes
        - motivation
        - status
        - bcbProcessedAt
        - rejection
        - attempts
        - institutionRecord
        - acceptedAt
        - concludedAt
      type: object
    ConsultationListBody:
      additionalProperties: false
      properties:
        items:
          description: The page's consultation summaries, newest first.
          items:
            $ref: "#/components/schemas/ConsultationSummaryBody"
          type:
            - array
            - "null"
        limit:
          description: Effective page size this request was served with.
          examples:
            - 50
          format: int64
          type: integer
        nextCursor:
          description: Opaque cursor for the following page; null on the last page.
          type:
            - string
            - "null"
        prevCursor:
          description: Opaque cursor for the preceding page; null.
          type:
            - string
            - "null"
      required:
        - items
        - limit
        - nextCursor
        - prevCursor
      type: object
    ConsultationRequestBody:
      additionalProperties: false
      properties:
        companyConsultationId:
          description: "The id of the company (CNPJ) consultation that this holder or representative belongs to: the id that the company's own request returned with its `202`. Required when `subjectRole` is `holder` or `representative` (`422` `SRC-0006` when absent). Refused for `individual` and `company` (`422` `SRC-0007` when present). It must name a CNPJ consultation of this deployment, in any status, so you can send both requests at the same time. Otherwise the request returns `422` `SRC-0008`."
          examples:
            - 8f14e45f-ceea-467a-9a36-dedd4bea2543
          type: string
        document:
          description: "CPF (11 numeric digits) or CNPJ (14 characters: 12 alphanumeric [0-9A-Z] positions plus 2 numeric check digits), unmasked. The alphanumeric CNPJ is the official BACEN class [0-9]{11}|[0-9A-Z]{12}[0-9]{2}. Check digits are validated before acceptance."
          examples:
            - "52998224725"
          pattern: ^([0-9]{11}|[0-9A-Z]{12}[0-9]{2})$
          type: string
        documentType:
          description: "Type of the consulted document: CPF or CNPJ. Must agree with the document's width."
          examples:
            - CPF
          type: string
        motivation:
          $ref: "#/components/schemas/MotivationBody"
          description: Mandatory motivation context.
        protectionTypes:
          description: "One or more protection types to consult (account_opening, ownership_change): at least one, no duplicates, each within the official catalog domain."
          examples:
            -   - account_opening
          items:
            type: string
          type:
            - array
            - "null"
        subjectRole:
          description: "The role the consulted document plays: individual | company | holder | representative. OPTIONAL — absent, it is inferred from documentType (CPF → individual, CNPJ → company). Unknown value returns 422 SRC-0004; a role the document type does not admit returns 422 SRC-0005. Declaring the inferred role explicitly does NOT change the idempotency fingerprint."
          examples:
            - representative
          type: string
      required:
        - document
        - documentType
        - protectionTypes
        - motivation
      type: object
    ConsultationSearchRequestBody:
      additionalProperties: false
      properties:
        cursor:
          description: Opaque pagination cursor from a previous page. An invalid cursor returns 400 SRC-0001. Paging is exact only inside a closed, lagged 'to' window — see the operation description.
          type: string
        document:
          description: "Filter by consulted document, unmasked: CPF (11 numeric digits) or CNPJ (14 characters, 12 alphanumeric [0-9A-Z] plus 2 numeric check digits)."
          pattern: ^([0-9]{11}|[0-9A-Z]{12}[0-9]{2})$
          type: string
        documentType:
          description: "Filter by document type: CPF | CNPJ. An unknown value returns 422 SRC-0002."
          examples:
            - CPF
          type: string
        from:
          description: Inclusive lower bound on acceptance time (RFC3339 date-time). Unparseable returns 400 SRC-0001.
          examples:
            - "2026-08-01T00:00:00Z"
          type: string
        limit:
          default: 50
          description: Page size (1..200).
          examples:
            - 50
          format: int64
          maximum: 200
          minimum: 1
          type: integer
        status:
          description: "Filter by lifecycle state: pending | completed | failed. An unknown value returns 422 SRC-0002."
          examples:
            - pending
          type: string
        to:
          description: Inclusive upper bound on acceptance time (RFC3339 date-time). Unparseable returns 400 SRC-0001; earlier than from returns 422 SRC-0002. For an EXACT page sequence set it a few seconds in the past, closing the window before you start paging — see the operation description.
          examples:
            - "2026-08-31T23:59:59Z"
          type: string
      type: object
    ConsultationSummaryBody:
      additionalProperties: false
      properties:
        acceptedAt:
          description: Acceptance instant (RFC3339).
          format: date-time
          type: string
        companyConsultationId:
          description: "The company consultation this row is linked to — the LINK, seen from the child. null for individual and company. Follow it with GET /v1/src/consultations/{id}. Its verdict and this one never couple: the decision is the institution's (arts. 2º-A/4º-A §3º)."
          type:
            - string
            - "null"
        concludedAt:
          description: Conclusion instant; null while pending.
          format: date-time
          type:
            - string
            - "null"
        documentMasked:
          description: Masked consulted document.
          examples:
            - 529******25
          type: string
        documentType:
          description: Type of the consulted document.
          examples:
            - CPF
          type: string
        id:
          description: Consultation identifier.
          examples:
            - 8f14e45f-ceea-467a-9a36-dedd4bea2543
          type: string
        restrictionActive:
          description: "When completed: whether any consulted protection type came back restricted. null when not completed — not the same as false."
          type:
            - boolean
            - "null"
        status:
          description: "Lifecycle state: pending | completed | failed."
          examples:
            - pending
          type: string
        subjectRole:
          description: "The role the consulted document plays: individual | company | holder | representative. Always present."
          examples:
            - representative
          type: string
      required:
        - id
        - documentMasked
        - documentType
        - subjectRole
        - companyConsultationId
        - status
        - restrictionActive
        - acceptedAt
        - concludedAt
      type: object
    CredentialStatusBody:
      additionalProperties: false
      properties:
        activatedAt:
          format: date-time
          type:
            - string
            - "null"
        counterpartSource:
          enum:
            - broadcast
            - operational_config
          examples:
            - operational_config
          type: string
        lastRotationAt:
          format: date-time
          type:
            - string
            - "null"
        managementEnabled:
          examples:
            - false
          type: boolean
        status:
          description: "Lifecycle state of the credential that this deployment can present, or null when the service holds no lifecycle state."
          enum:
            - active
            - expired
          examples:
            - active
          type:
            - string
            - "null"
        validNotAfter:
          description: Instant the presentable credential's validity window closes, or null when the service holds no credential metadata.
          format: date-time
          type:
            - string
            - "null"
      required:
        - managementEnabled
        - status
        - validNotAfter
        - activatedAt
        - lastRotationAt
        - counterpartSource
      type: object
    DashboardCompanyLinkageBody:
      additionalProperties: false
      properties:
        companiesConsulted:
          description: Company consultations ACCEPTED in the period — the population the other four fields are about. Equals bySubjectRole.company for the same period on a quiesced system.
          examples:
            - 238
          format: int64
          type: integer
        companiesWithLinkedSubjects:
          description: Of those, the ones at least one consultation links to as its company.
          examples:
            - 171
          format: int64
          type: integer
        companiesWithoutLinkedSubjects:
          description: "Of those, the ones that no consultation links to as its company. It does not say how many holders or representatives a company has."
          examples:
            - 67
          format: int64
          type: integer
        linkedSubjectsTotal:
          description: Consultations linked to any company of the population, whatever their OWN acceptance instant — a CPF accepted after the window closed still counts for a CNPJ accepted inside it. This is why these numbers do not reconcile against bySubjectRole.holder + bySubjectRole.representative of the same period.
          examples:
            - 190
          format: int64
          type: integer
        linkedSubjectsWithActiveRestriction:
          description: "Of those, the ones completed with at least one verdict whose `permitted` is false. A linked consultation that is still pending or failed is not counted. This number does not change the verdict or the status of any company consultation."
          examples:
            - 12
          format: int64
          type: integer
      required:
        - companiesConsulted
        - companiesWithLinkedSubjects
        - companiesWithoutLinkedSubjects
        - linkedSubjectsTotal
        - linkedSubjectsWithActiveRestriction
      type: object
    DashboardDocumentTypeBody:
      additionalProperties: false
      properties:
        cnpj:
          description: Consultations of the period whose consulted document is a CNPJ.
          examples:
            - 238
          format: int64
          type: integer
        cpf:
          description: Consultations of the period whose consulted document is a CPF.
          examples:
            - 1002
          format: int64
          type: integer
      required:
        - cpf
        - cnpj
      type: object
    DashboardOutcomeBody:
      additionalProperties: false
      properties:
        pending:
          description: Accepted and not yet concluded. A NORMAL state — BACEN publishes no SLA for the answer.
          examples:
            - 9
          format: int64
          type: integer
        technicallyRejected:
          description: "Concluded as `failed`. To see which rejections came from BACEN and which from Lerian SRC, read `rejectionsByCode`."
          examples:
            - 14
          format: int64
          type: integer
        withRestriction:
          description: Completed with at least one ACTIVE restriction.
          examples:
            - 37
          format: int64
          type: integer
        withoutRestriction:
          description: "Completed fully permitted: no restricted verdict."
          examples:
            - 1180
          format: int64
          type: integer
      required:
        - withRestriction
        - withoutRestriction
        - technicallyRejected
        - pending
      type: object
    DashboardRegistrationBody:
      additionalProperties: false
      properties:
        documentedExceptions:
          description: Refusal-explanation records registered in the period, at most one per consultation.
          examples:
            - 4
          format: int64
          type: integer
        proceededDespiteRestriction:
          description: Exceptional-proceed records registered in the period, at most one per consultation.
          examples:
            - 2
          format: int64
          type: integer
      required:
        - documentedExceptions
        - proceededDespiteRestriction
      type: object
    DashboardSubjectRoleBody:
      additionalProperties: false
      properties:
        company:
          description: Legal entities consulted as such — the consultations holders and representatives link to.
          examples:
            - 238
          format: int64
          type: integer
        holder:
          description: Natural persons consulted AS HOLDERS of a legal entity, each linked to a company consultation.
          examples:
            - 104
          format: int64
          type: integer
        individual:
          description: Natural persons consulted on their own account.
          examples:
            - 812
          format: int64
          type: integer
        representative:
          description: Natural persons consulted AS REPRESENTATIVES of a legal entity, each linked to a company consultation.
          examples:
            - 86
          format: int64
          type: integer
      required:
        - individual
        - company
        - holder
        - representative
      type: object
    DashboardSummaryBody:
      additionalProperties: false
      properties:
        byDocumentType:
          $ref: "#/components/schemas/DashboardDocumentTypeBody"
          description: Breakdown by consulted document type.
        byOutcome:
          $ref: "#/components/schemas/DashboardOutcomeBody"
          description: "Breakdown by outcome. These four partition consultations.status: their sum equals total."
        byRegistration:
          $ref: "#/components/schemas/DashboardRegistrationBody"
          description: "Institution records registered in the period, counted by registration time. They are not outcomes: do not add them to `total` or `byOutcome`."
        bySubjectRole:
          $ref: "#/components/schemas/DashboardSubjectRoleBody"
          description: "Breakdown by the role the consulted document plays. These four PARTITION total, as byDocumentType does: their sum equals total on a quiesced period."
        companyLinkage:
          $ref: "#/components/schemas/DashboardCompanyLinkageBody"
          description: "Counts over the company consultations accepted in the period: how many have linked holder or representative consultations, how many have none, and the outcome of the linked ones. The period applies to the company consultations only, so these numbers do not reconcile with `bySubjectRole.holder` and `bySubjectRole.representative`."
        from:
          description: Inclusive lower bound of the window these numbers were counted over.
          format: date-time
          type: string
        openOperatorCases:
          description: "Open operator cases now, in the four legs: `budget_exhausted`, `orphan_response`, `invalid_outbound` and `credential_operation`. It does not depend on `from` and `to`. `GET /v1/src/operator/cases` lists them."
          examples:
            - 1
          format: int64
          type: integer
        pendingBeyondExpected:
          description: "Consultations that are pending now for longer than the `src.pending.alert_threshold` runtime setting. It does not depend on `from` and `to`, so it is not a subset of `byOutcome.pending` and can be larger."
          examples:
            - 3
          format: int64
          type: integer
        rejectionsByCode:
          additionalProperties:
            format: int64
            type: integer
          description: "Rejections of the period by rejection code, as received. Each key is a BACEN error code, except `SRC-OUTBOUND-INVALID`: Lerian SRC refused to send a message that did not conform to BACEN's specification."
          type: object
        restrictionsByProtectionType:
          additionalProperties:
            format: int64
            type: integer
          description: "Active-restriction verdicts of the period by protection type. A consultation restricted on two types counts twice, so this map does not sum to `byOutcome.withRestriction`. A configured protection type with no restriction in the period shows `0`."
          type: object
        to:
          description: Inclusive upper bound of the window these numbers were counted over.
          format: date-time
          type: string
        total:
          description: Consultations accepted in the period. A request refused before acceptance creates no consultation, so this total and the breakdowns do not count it.
          examples:
            - 1240
          format: int64
          type: integer
      required:
        - from
        - to
        - total
        - byOutcome
        - byRegistration
        - byDocumentType
        - bySubjectRole
        - companyLinkage
        - restrictionsByProtectionType
        - rejectionsByCode
        - pendingBeyondExpected
        - openOperatorCases
      type: object
    EvidenceCorrectionBody:
      additionalProperties: false
      properties:
        correctsSequence:
          description: The position of the corrected record. That record remains in the trail, unchanged.
          examples:
            - 3
          format: int64
          type: integer
        sequence:
          description: The trail position of the new correction record. It is greater than `correctsSequence`.
          examples:
            - 4
          format: int64
          type: integer
      required:
        - sequence
        - correctsSequence
      type: object
    EvidenceCorrectionRequestBody:
      additionalProperties: false
      properties:
        correctsSequence:
          description: REQUIRED. Position (sequence) of the record being corrected, as returned by getEvidenceTrail. Must be at least 1 and must be held by a record in THIS consultation's trail; anything else returns 422 SRC-0002 with nothing written.
          examples:
            - 3
          format: int64
          type: integer
        reason:
          description: "Required. Free-text explanation of what was wrong with the corrected record. At most 2000 characters, and no control characters other than tab, line feed and carriage return. It must be valid UTF-8. Empty, over-long or malformed returns `422` `SRC-0002`."
          maxLength: 2000
          minLength: 1
          type: string
      type: object
      required:
        - correctsSequence
        - reason
    EvidenceRecordBody:
      additionalProperties: false
      properties:
        correctsSequence:
          description: For kind=correction, the sequence of the corrected record. The original remains in the trail — corrections chain, they never overwrite.
          format: int64
          type: integer
        data:
          additionalProperties: {}
          description: Record content; its members vary per kind.
          type: object
        kind:
          description: Record class.
          enum:
            - acceptance
            - entry_refusal
            - dispatch_attempt
            - channel_confirmation
            - response
            - rejection
            - duplicate_response
            - notification
            - client_decision
            - refusal_explanation
            - credential_operation
            - operator_case_closure
            - correction
          examples:
            - acceptance
          type: string
        occurredAt:
          description: When the recorded FACT happened (RFC3339). It is not the write time and it is not the order.
          format: date-time
          type: string
        sequence:
          description: Position in the trail, starting at 1. The trail is served in ascending sequence, which is the reconstruction order — NOT occurredAt, which is when the recorded fact happened and can be earlier for a fact recorded on a later attempt.
          examples:
            - 1
          format: int64
          type: integer
      required:
        - sequence
        - kind
        - occurredAt
      type: object
    EvidenceRecordSearchItemBody:
      additionalProperties: false
      properties:
        bcbControlCode:
          description: BACEN control code (NumCtrlSRC) this record concerned; null when it concerned none.
          type:
            - string
            - "null"
        consultationId:
          description: Consultation the record belongs to; NULL for an entry_refusal — a request refused before acceptance creates no consultation.
          type:
            - string
            - "null"
        kind:
          description: Record class.
          enum:
            - acceptance
            - entry_refusal
            - dispatch_attempt
            - channel_confirmation
            - response
            - rejection
            - duplicate_response
            - notification
            - client_decision
            - refusal_explanation
            - credential_operation
            - operator_case_closure
            - correction
          examples:
            - entry_refusal
          type: string
        occurredAt:
          description: When the recorded FACT happened (RFC3339) — not when the row was written. It is the ordering key of this page.
          format: date-time
          type: string
        recordId:
          description: Evidence record identifier.
          examples:
            - 0192f5c4-1c2f-7c3a-8a1b-9f2e3d4c5b6a
          type: string
        sequence:
          description: Position in the record's own trail, from 1. An entry_refusal is a trail of one.
          examples:
            - 1
          format: int64
          type: integer
      required:
        - recordId
        - consultationId
        - kind
        - sequence
        - bcbControlCode
        - occurredAt
      type: object
    EvidenceRecordSearchListBody:
      additionalProperties: false
      properties:
        documentMasked:
          description: "The searched document, masked."
          examples:
            - 529******26
          type: string
        items:
          description: The page's evidence records, most recently occurred first.
          items:
            $ref: "#/components/schemas/EvidenceRecordSearchItemBody"
          type:
            - array
            - "null"
        limit:
          description: Effective page size this request was served with.
          examples:
            - 50
          format: int64
          type: integer
        nextCursor:
          description: Opaque cursor for the following page; null on the last page.
          type:
            - string
            - "null"
      required:
        - items
        - documentMasked
        - limit
        - nextCursor
      type: object
    EvidenceRecordSearchRequestBody:
      additionalProperties: false
      properties:
        cursor:
          description: Opaque pagination cursor from a previous page. An invalid cursor returns 400 SRC-0001.
          type: string
        document:
          description: "Required unless `kind` is `credential_operation` or `operator_case_closure`. The consulted document, unmasked: CPF (11 numeric digits) or CNPJ (14 characters, 12 alphanumeric [0-9A-Z] plus 2 numeric check digits). Absent or off-pattern returns `422` `SRC-0002`, except that absence is accepted when `kind` is one of those two classes."
          pattern: ^([0-9]{11}|[0-9A-Z]{12}[0-9]{2})$
          type: string
        documentType:
          description: "Optional declared class of the document: CPF or CNPJ. It filters nothing and does not change the returned `documentMasked`. A value outside the vocabulary returns `422` `SRC-0002` with a violation on this member."
          enum:
            - CPF
            - CNPJ
          examples:
            - CPF
          type: string
        kind:
          description: "Optional record class that restricts the page. When it is `credential_operation` or `operator_case_closure`, `document` is optional. For every other class, `document` is required. A value outside the vocabulary returns `422` `SRC-0002` with a violation on this member."
          enum:
            - acceptance
            - entry_refusal
            - dispatch_attempt
            - channel_confirmation
            - response
            - rejection
            - duplicate_response
            - notification
            - client_decision
            - refusal_explanation
            - credential_operation
            - operator_case_closure
            - correction
          examples:
            - operator_case_closure
          type: string
        limit:
          default: 50
          description: Page size (1..200).
          examples:
            - 50
          format: int64
          maximum: 200
          minimum: 1
          type: integer
      type: object
    EvidenceSearchItemBody:
      additionalProperties: false
      properties:
        acceptedAt:
          description: Acceptance instant (RFC3339).
          format: date-time
          type: string
        bcbControlCode:
          description: BACEN control code (NumCtrlSRC); null while the consultation has none.
          type:
            - string
            - "null"
        concludedAt:
          description: Conclusion instant; null while pending.
          format: date-time
          type:
            - string
            - "null"
        consultationId:
          description: Consultation identifier.
          examples:
            - 0192f5c4-1c2f-7c3a-8a1b-9f2e3d4c5b6a
          type: string
        documentMasked:
          description: Masked consulted document.
          examples:
            - 529******25
          type: string
        status:
          description: "Lifecycle state: pending | completed | failed."
          examples:
            - completed
          type: string
      required:
        - consultationId
        - documentMasked
        - bcbControlCode
        - status
        - acceptedAt
        - concludedAt
      type: object
    EvidenceSearchListBody:
      additionalProperties: false
      properties:
        items:
          description: The page's consultation projections, most recently accepted first.
          items:
            $ref: "#/components/schemas/EvidenceSearchItemBody"
          type:
            - array
            - "null"
        limit:
          description: Effective page size this request was served with.
          examples:
            - 50
          format: int64
          type: integer
        nextCursor:
          description: Opaque cursor for the following page; null on the last page.
          type:
            - string
            - "null"
        prevCursor:
          description: Opaque cursor for the preceding page; null (backwards paging is served by neither cursor endpoint of this service).
          type:
            - string
            - "null"
      required:
        - items
        - limit
        - nextCursor
        - prevCursor
      type: object
    EvidenceSearchRequestBody:
      additionalProperties: false
      properties:
        consultationId:
          description: Filter by one consultation (UUID). A non-UUID returns 422 SRC-0002.
          examples:
            - 0192f5c4-1c2f-7c3a-8a1b-9f2e3d4c5b6a
          type: string
        controlCode:
          description: Filter by the consultation control code assigned by BACEN (NumCtrlSRC).
          maxLength: 64
          type: string
        cursor:
          description: Opaque pagination cursor from a previous page. An invalid cursor returns 400 SRC-0001.
          type: string
        document:
          description: "Filter by consulted document, unmasked: CPF (11 numeric digits) or CNPJ (14 characters, 12 alphanumeric [0-9A-Z] plus 2 numeric check digits)."
          pattern: ^([0-9]{11}|[0-9A-Z]{12}[0-9]{2})$
          type: string
        from:
          description: Inclusive lower bound on acceptance time (RFC3339 date-time). Unparseable returns 400 SRC-0001.
          examples:
            - "2026-08-01T00:00:00Z"
          type: string
        limit:
          default: 50
          description: Page size (1..200).
          examples:
            - 50
          format: int64
          maximum: 200
          minimum: 1
          type: integer
        to:
          description: Inclusive upper bound on acceptance time (RFC3339 date-time). Unparseable returns 400 SRC-0001; earlier than from returns 422 SRC-0002.
          examples:
            - "2026-08-31T23:59:59Z"
          type: string
      type: object
    EvidenceTrailBody:
      additionalProperties: false
      properties:
        consultationId:
          description: Consultation the trail belongs to.
          examples:
            - 0192f5c4-1c2f-7c3a-8a1b-9f2e3d4c5b6a
          type: string
        records:
          description: "The complete history in ascending sequence. Never empty: a consultation with no records is a 404."
          items:
            $ref: "#/components/schemas/EvidenceRecordBody"
          type:
            - array
            - "null"
      required:
        - consultationId
        - records
      type: object
    InstitutionRecordBody:
      additionalProperties: false
      properties:
        circumstance:
          description: The exceptional circumstance alleged, as filed. Empty on a refusal-explanation record.
          type: string
        explanation:
          description: The explanation given to the interested party, as filed. Empty on an exceptional-proceed record.
          type: string
        filedBy:
          examples:
            - m2m:core-banking-integration
          type: string
        justification:
          description: The mandatory justification, as filed. Empty on a refusal-explanation record.
          type: string
        kind:
          description: "Which paragraph of art. 2º-A this record answers: \"exceptional_proceed\" (§1º) or \"refusal_explanation\" (§2º). It is the member that says which prose members carry text."
          examples:
            - exceptional_proceed
          type: string
        registeredAt:
          description: Registration instant (RFC3339, UTC). The record is immutable, so this never changes.
          format: date-time
          type: string
        registeredBy:
          description: Who filed the record (institution-side identity).
          examples:
            - maria.compliance@bank.example
          type: string
      required:
        - kind
        - registeredBy
        - filedBy
        - justification
        - circumstance
        - explanation
        - registeredAt
      type: object
    InstitutionRecordRequestBody:
      additionalProperties: false
      properties:
        circumstance:
          description: The exceptional circumstance alleged (for instance, a holder prevented from removing the protection request). REQUIRED when kind is "exceptional_proceed", 1..1000 characters; REFUSED when kind is "refusal_explanation".
          maxLength: 1000
          minLength: 1
          type: string
        explanation:
          description: Content of the explanation given to the interested party. REQUIRED when kind is "refusal_explanation", 1..2000 characters; REFUSED when kind is "exceptional_proceed".
          maxLength: 2000
          minLength: 1
          type: string
        justification:
          description: Mandatory justification for proceeding despite the active restriction. REQUIRED when kind is "exceptional_proceed", 1..2000 characters; REFUSED when kind is "refusal_explanation".
          examples:
            - Holder attested inability to remove the protection; branch manager approved under policy X.
          maxLength: 2000
          minLength: 1
          type: string
        kind:
          description: "Which paragraph of art. 2º-A this record answers: \"exceptional_proceed\" (§1º — contracted despite the active restriction) or \"refusal_explanation\" (§2º — refused, and this is what the interested party was told). REQUIRED. It decides which prose members are mandatory and which are refused."
          enum:
            - exceptional_proceed
            - refusal_explanation
          examples:
            - exceptional_proceed
          type: string
        registeredBy:
          description: Who filed the record, as an institution-side identity. REQUIRED for both kinds, 1..255 characters.
          examples:
            - maria.compliance@bank.example
          maxLength: 255
          minLength: 1
          type: string
      required:
        - kind
        - registeredBy
      type: object
    MotivationBody:
      additionalProperties: false
      properties:
        note:
          description: Optional free-text context (max 1000 chars).
          maxLength: 1000
          type: string
        reference:
          description: Identifier of the originating event in the client's system (e.g. an account-opening request id). REQUIRED, 1..255 chars.
          examples:
            - acct-open-2026-000123
          maxLength: 255
          minLength: 1
          type: string
      required:
        - reference
      type: object
    OperatorCaseBody:
      additionalProperties: false
      properties:
        caseId:
          description: "The case identifier. It is unique only together with `leg`, so each closure route names its leg in the path."
          examples:
            - 8f14e45f-ceea-467a-9a36-dedd4bea2543
          type: string
        closable:
          description: "Whether an operator can close this case. It is false for `budget_exhausted`."
          type: boolean
        consultationId:
          description: The consultation this case belongs to; null when the case belongs to none — which is what an orphan_response and a credential_operation each are. Follow it with GET /v1/src/consultations/{id}.
          type:
            - string
            - "null"
        leg:
          description: "Which leg of the backlog this case is: budget_exhausted | orphan_response | invalid_outbound | credential_operation. Closure route per leg: orphan_response -> POST /v1/src/operator/orphan-responses/{caseId}/closure; invalid_outbound -> POST /v1/src/operator/invalid-dispatches/{caseId}/closure; credential_operation -> POST /v1/src/operator/credential-operations/{caseId}/closure; budget_exhausted -> none, see closable."
          examples:
            - orphan_response
          type: string
        openedAt:
          description: When the case opened (UTC). The listing is ordered and paged on this value, newest first.
          format: date-time
          type: string
        resolvedAt:
          description: When the case left the queue (UTC); null while it is open.
          format: date-time
          type:
            - string
            - "null"
        resolvedBy:
          description: The operator who closed the case; null when no person did — an unclaimed inbound resolved as matched was closed by the correlation, and an open case has nobody to name.
          type:
            - string
            - "null"
        status:
          description: "Whether this case is still in the queue: open | closed. It is not the same as `closable`, which says whether the leg accepts a closure."
          examples:
            - closed
          type: string
        summary:
          $ref: "#/components/schemas/OperatorCaseSummaryBody"
          description: "The detail this leg publishes. It is a UNION: each leg fills its own members and omits the rest."
      required:
        - leg
        - caseId
        - openedAt
        - closable
        - status
        - resolvedAt
        - resolvedBy
        - consultationId
        - summary
      type: object
    OperatorCaseClosedBody:
      additionalProperties: false
      properties:
        caseId:
          description: The operator case that was closed.
          type: string
        closedAt:
          description: When the closure was recorded (UTC).
          format: date-time
          type: string
        resolution:
          description: "The resolution written to the case: closed_by_operator."
          type: string
      required:
        - caseId
        - resolution
        - closedAt
      type: object
    OperatorCaseListBody:
      additionalProperties: false
      properties:
        items:
          description: The page's operator cases, newest-opened first.
          items:
            $ref: "#/components/schemas/OperatorCaseBody"
          type:
            - array
            - "null"
        limit:
          description: Effective page size this request was served with.
          examples:
            - 50
          format: int64
          type: integer
        nextCursor:
          description: Opaque cursor for the following page; null when this page is the last one.
          type:
            - string
            - "null"
      required:
        - items
        - limit
        - nextCursor
      type: object
    OperatorCaseSummaryBody:
      additionalProperties: false
      properties:
        attempts:
          description: "How many times the automatic loop presented the message before the retry budget ran out. Leg: budget_exhausted."
          examples:
            - 5
          format: int64
          type: integer
        budgetExhaustedAt:
          description: "When the retry budget ran out (UTC) — the stamp the rail wrote once, NOT the sort key openedAt. Leg: budget_exhausted."
          format: date-time
          type: string
        error:
          description: "Why it failed, redacted on the same terms as a consultation's rejection message. Legs: invalid_outbound, credential_operation."
          type: string
        kind:
          description: "Leg: credential_operation."
          examples:
            - rotation
          type: string
        mqMessageId:
          description: "The IBM MQ message identifier (MQMD MsgId, 48 lowercase hex characters) the queue manager stamped on the unclaimed inbound frame — the identity to quote to BACEN about this frame. Absent when the channel carried no MQ descriptor. Leg: orphan_response."
          examples:
            - 414d5120514d31202020202020202020a1b2c3d4e5f60718
          type: string
        mqPutAt:
          description: "When the sender's queue manager accepted the unclaimed inbound frame (MQMD put date and time, UTC), as distinct from receivedAt, when this deployment kept it. Absent when the channel carried no MQ descriptor. Leg: orphan_response."
          format: date-time
          type: string
        nuopClaimed:
          description: "The operation number the unclaimed inbound message CLAIMS — a value from the received envelope, not one this deployment minted. The thread an operator follows with BACEN. Leg: orphan_response."
          type: string
        receivedAt:
          description: "When the unclaimed inbound message arrived (UTC). Leg: orphan_response."
          format: date-time
          type: string
        requestedBy:
          description: "Leg: credential_operation."
          type: string
      type: object
    ProblemDetails:
      additionalProperties: false
      properties:
        code:
          type: string
        correlationId:
          examples:
            - req-7a3f9c2e
          type: string
        detail:
          examples:
            - check digits are invalid for the declared documentType
          type: string
        details:
          additionalProperties: {}
          type: object
        instance:
          examples:
            - /v1/src/consultations
          type: string
        status:
          examples:
            - 400
          format: int64
          type: integer
        title:
          examples:
            - Bad Request
          type: string
        traceId:
          examples:
            - a1b2c3d4
          type: string
        type:
          type: string
        violations:
          items:
            $ref: "#/components/schemas/Violation"
          type:
            - array
            - "null"
      required:
        - type
        - title
        - status
        - detail
        - instance
        - traceId
        - correlationId
        - violations
      type: object
    RejectionBody:
      additionalProperties: false
      properties:
        classification:
          description: transient | permanent | unknown. The rejection code and message stay as BACEN sent them.
          examples:
            - transient
          type: string
        code:
          description: Original BACEN rejection code, verbatim.
          examples:
            - ESRC0011
          type: string
        message:
          description: Original BACEN message when present, verbatim.
          type: string
        receivedAt:
          description: Instant the rejection was received (RFC3339).
          format: date-time
          type: string
      required:
        - code
        - classification
        - receivedAt
      type: object
    VerdictBody:
      additionalProperties: false
      properties:
        permitted:
          description: '`true` when BACEN reports no active restriction for this protection type; `false` when BACEN reports an active restriction.'
          examples:
            - false
          type: boolean
        protectionType:
          description: The protection type this verdict answers.
          examples:
            - account_opening
          type: string
      required:
        - protectionType
        - permitted
      type: object
    Violation:
      additionalProperties: false
      properties:
        code:
          type: string
        field:
          examples:
            - document
          type: string
        reason:
          examples:
            - check digits are invalid for the declared documentType
          type: string
      required:
        - field
        - reason
      type: object
  securitySchemes:
    m2m:
      flows:
        clientCredentials:
          scopes:
            src:consultation:read: Read/list consultations
            src:consultation:write: Create restriction consultations
            src:credential:read: Read regulatory-credential status
            src:dashboard:read: Read the aggregated numeric dashboard
            src:decision:write: File the institution's record against a consultation — exceptional proceed (§1º) or refusal explanation (§2º)
            src:evidence:correct: Append a chained correction to an evidence trail
            src:evidence:read: Search and reconstruct the evidence trail
            src:operator:close: Close an open operator case so it leaves the openOperatorCases backlog
            src:operator:read: List the operator cases
          tokenUrl: https://access-manager.example.com/v1/login/oauth/access_token
      type: oauth2
info:
  description: |-
    API for Lerian SRC, which sends your institution's restriction consultations to BACEN's BC Protege+ and keeps the evidence of each consultation.
  title: Lerian SRC API
  version: 1.0.0
openapi: 3.1.0
paths:
  /v1/src/consultations:
    get:
      description: |-
        Lists the consultations of this deployment, newest first, one page at a time. You can filter by `status`, `type`, `companyConsultationId`, `subjectRole`, `restrictionActive`, `from` and `to`. Use `companyConsultationId` to list the holder and representative consultations that link to a company consultation. To filter by document, use `POST /v1/src/consultations/search`.

        For an exact page sequence, set `to` a few seconds in the past before you read the first page.
      operationId: listConsultations
      parameters:
        - description: "Filter by lifecycle state: pending | completed | failed. An unknown value returns 422 SRC-0002."
          explode: false
          in: query
          name: status
          schema:
            description: "Filter by lifecycle state: pending | completed | failed. An unknown value returns 422 SRC-0002."
            examples:
              - pending
            type: string
        - description: "Filter by document type: CPF | CNPJ. An unknown value returns 422 SRC-0002."
          explode: false
          in: query
          name: type
          schema:
            description: "Filter by document type: CPF | CNPJ. An unknown value returns 422 SRC-0002."
            examples:
              - CPF
            type: string
        - description: "Only the consultations LINKED to this company consultation — the link seen from the company's side. The value is a consultation id. An id that does not exist, or belongs to another deployment, returns an EMPTY page and 200 — never 404/422. A value that is not a UUID returns 400 SRC-0001."
          explode: false
          in: query
          name: companyConsultationId
          schema:
            description: "Only the consultations LINKED to this company consultation — the link seen from the company's side. The value is a consultation id. An id that does not exist, or belongs to another deployment, returns an EMPTY page and 200 — never 404/422. A value that is not a UUID returns 400 SRC-0001."
            examples:
              - 8f14e45f-ceea-467a-9a36-dedd4bea2543
            type: string
        - description: "Filter by the role the consulted document plays: individual | company | holder | representative. An unknown value returns 422 SRC-0002."
          explode: false
          in: query
          name: subjectRole
          schema:
            description: "Filter by the role the consulted document plays: individual | company | holder | representative. An unknown value returns 422 SRC-0002."
            examples:
              - representative
            type: string
        - description: "Filter by whether the consultation holds an active restriction. THREE populations, and this parameter selects among them: true returns only the consultations where at least one consulted protection type came back restricted; false returns only the CONCLUDED consultations whose verdicts were all permitted; omitting the parameter returns all of them, INCLUDING the ones with no verdict yet (pending, and failed), which carry restrictionActive: null and are returned by NEITHER value — false is an assertion about a verdict RECEIVED, and a consultation BACEN has not answered has none. An empty value is the same as omitting the parameter; any other value outside true or false returns 422 SRC-0002."
          explode: false
          in: query
          name: restrictionActive
          schema:
            description: "Filter by whether the consultation holds an active restriction. THREE populations, and this parameter selects among them: true returns only the consultations where at least one consulted protection type came back restricted; false returns only the CONCLUDED consultations whose verdicts were all permitted; omitting the parameter returns all of them, INCLUDING the ones with no verdict yet (pending, and failed), which carry restrictionActive: null and are returned by NEITHER value — false is an assertion about a verdict RECEIVED, and a consultation BACEN has not answered has none. An empty value is the same as omitting the parameter; any other value outside true or false returns 422 SRC-0002."
            examples:
              - "true"
            type: string
        - description: Inclusive lower bound on acceptance time (RFC3339 date-time). Unparseable returns 400 SRC-0001.
          explode: false
          in: query
          name: from
          schema:
            description: Inclusive lower bound on acceptance time (RFC3339 date-time). Unparseable returns 400 SRC-0001.
            examples:
              - "2026-08-01T00:00:00Z"
            type: string
        - description: Inclusive upper bound on acceptance time (RFC3339 date-time). Unparseable returns 400 SRC-0001; earlier than from returns 422 SRC-0002. For an EXACT page sequence set it a few seconds in the past, closing the window before you start paging — see the operation description.
          explode: false
          in: query
          name: to
          schema:
            description: Inclusive upper bound on acceptance time (RFC3339 date-time). Unparseable returns 400 SRC-0001; earlier than from returns 422 SRC-0002. For an EXACT page sequence set it a few seconds in the past, closing the window before you start paging — see the operation description.
            examples:
              - "2026-08-31T23:59:59Z"
            type: string
        - description: Opaque pagination cursor from a previous page. An invalid cursor returns 400 SRC-0001. Paging is exact only inside a closed, lagged 'to' window — see the operation description.
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque pagination cursor from a previous page. An invalid cursor returns 400 SRC-0001. Paging is exact only inside a closed, lagged 'to' window — see the operation description.
            type: string
        - description: Page size (1..200).
          explode: false
          in: query
          name: limit
          schema:
            default: 50
            description: Page size (1..200).
            examples:
              - 50
            format: int64
            maximum: 200
            minimum: 1
            type: integer
        - description: Optional correlation id (UUID) propagated through logs/traces.
          in: header
          name: X-Request-ID
          schema:
            description: Optional correlation id (UUID) propagated through logs/traces.
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConsultationListBody"
          description: OK
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Bad Request
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Forbidden
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Internal Server Error
      security:
        - m2m:
            - src:consultation:read
      summary: List consultations
      tags:
        - consultation
      x-mint:
        href: /pt/reference/rails/src/list-consultations
    post:
      description: |-
        Accepts a restriction consultation for one CPF or CNPJ and returns `202` with the consultation id. The consultation starts as `pending`, which is a normal state. Read the outcome with `GET /v1/src/consultations/{id}` or from the events.

        Lerian SRC validates the request before it accepts it, and a refused request sends nothing to BACEN. `X-Idempotency` is required. [Idempotency](/pt/rails/src/src-integration#idempotency) describes the replay rules and how long Lerian SRC keeps a key.
      operationId: createConsultation
      parameters:
        - description: REQUIRED client-supplied idempotency key (1..255 chars). Its absence returns `400` with code `SRC-0001`. [Idempotency](/pt/rails/src/src-integration#idempotency) describes the replay rules and how long Lerian SRC keeps a key.
          in: header
          name: X-Idempotency
          schema:
            description: REQUIRED client-supplied idempotency key (1..255 chars). Its absence returns `400` with code `SRC-0001`. [Idempotency](/pt/rails/src/src-integration#idempotency) describes the replay rules and how long Lerian SRC keeps a key.
            maxLength: 255
            minLength: 1
            type: string
          required: true
        - description: Optional correlation id (UUID) propagated through logs/traces and into the evidence trail.
          in: header
          name: X-Request-ID
          schema:
            description: Optional correlation id (UUID) propagated through logs/traces and into the evidence trail.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ConsultationRequestBody"
        required: true
      responses:
        "202":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConsultationAcceptedBody"
          description: Accepted
          headers:
            Location:
              schema:
                description: URL of the created consultation resource.
                type: string
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Bad Request
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Forbidden
        "409":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Conflict
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Internal Server Error
        "503":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Service Unavailable
      security:
        - m2m:
            - src:consultation:write
      summary: Create a consultation
      tags:
        - consultation
      x-mint:
        href: /pt/reference/rails/src/create-a-consultation
  /v1/src/consultations/search:
    post:
      description: |-
        Searches the consultations of this deployment, newest first, one page at a time. It takes its filters in the request body: `status`, `documentType`, `document`, `from` and `to`. For an exact page sequence, set `to` a few seconds in the past before you read the first page.
      operationId: searchConsultations
      parameters:
        - description: Optional correlation id (UUID) propagated through logs/traces.
          in: header
          name: X-Request-ID
          schema:
            description: Optional correlation id (UUID) propagated through logs/traces.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ConsultationSearchRequestBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConsultationListBody"
          description: OK
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Bad Request
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Forbidden
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Internal Server Error
      security:
        - m2m:
            - src:consultation:read
      summary: Search consultations
      tags:
        - consultation
      x-mint:
        href: /pt/reference/rails/src/search-consultations
  /v1/src/consultations/{id}:
    get:
      description: |-
        Returns the current state of one consultation. `pending` is a normal state. A `completed` consultation carries the verdict for each protection type and BACEN's control code. A `failed` consultation carries the rejection.

        An unknown id returns `404` with code `SRC-0301`. A malformed id returns `400` with code `SRC-0001`.
      operationId: getConsultation
      parameters:
        - description: Consultation identifier (UUID). A malformed identifier returns 400 SRC-0001.
          in: path
          name: id
          required: true
          schema:
            description: Consultation identifier (UUID). A malformed identifier returns 400 SRC-0001.
            examples:
              - 8f14e45f-ceea-467a-9a36-dedd4bea2543
            type: string
        - description: Optional correlation id (UUID) propagated through logs/traces.
          in: header
          name: X-Request-ID
          schema:
            description: Optional correlation id (UUID) propagated through logs/traces.
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConsultationBody"
          description: OK
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Bad Request
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Forbidden
        "404":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Not Found
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Internal Server Error
      security:
        - m2m:
            - src:consultation:read
      summary: Retrieve a consultation
      tags:
        - consultation
      x-mint:
        href: /pt/reference/rails/src/retrieve-a-consultation
  /v1/src/consultations/{id}/institution-record:
    post:
      description: |-
        Registers the institution's record for a consultation that completed with an active restriction. Send `kind: exceptional_proceed` with a justification and a circumstance when the institution proceeds despite the restriction. Send `kind: refusal_explanation` with the explanation that the institution gave when it refused.

        A consultation holds one record, and a second request returns `409` with code `SRC-0101`. A consultation that did not complete with an active restriction returns `409` with code `SRC-0102`.
      operationId: registerInstitutionRecord
      parameters:
        - description: Consultation identifier (UUID). A malformed identifier returns 422 SRC-0002 with a field violation on id.
          in: path
          name: id
          required: true
          schema:
            description: Consultation identifier (UUID). A malformed identifier returns 422 SRC-0002 with a field violation on id.
            examples:
              - 8f14e45f-ceea-467a-9a36-dedd4bea2543
            type: string
        - description: Optional correlation id (UUID) propagated through logs/traces and into the evidence trail.
          in: header
          name: X-Request-ID
          schema:
            description: Optional correlation id (UUID) propagated through logs/traces and into the evidence trail.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/InstitutionRecordRequestBody"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InstitutionRecordBody"
          description: Created
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Bad Request
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Forbidden
        "404":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Not Found
        "409":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Conflict
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Internal Server Error
      security:
        - m2m:
            - src:decision:write
      summary: Register an institution record
      tags:
        - decision
      x-mint:
        href: /pt/reference/rails/src/register-an-institution-record
  /v1/src/credentials:
    get:
      description: |-
        Returns the status of the institution's regulatory credential.
      operationId: getCredentialStatus
      parameters:
        - description: Optional correlation id (UUID) propagated through logs/traces.
          in: header
          name: X-Request-ID
          schema:
            description: Optional correlation id (UUID) propagated through logs/traces.
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CredentialStatusBody"
          description: OK
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Forbidden
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Internal Server Error
      security:
        - m2m:
            - src:credential:read
      summary: Retrieve the credential status
      tags:
        - credential
      x-mint:
        href: /pt/reference/rails/src/retrieve-the-credential-status
  /v1/src/dashboard/consultations:
    get:
      description: |-
        Returns counts of the consultations accepted between `from` and `to`: the total, the breakdowns by outcome, document type and subject role, the restrictions by protection type, and the rejections by code. `byRegistration` counts the institution records registered in the period.

        `pendingBeyondExpected` and `openOperatorCases` count the current backlog and do not depend on `from` and `to`.
      operationId: getDashboardSummary
      parameters:
        - description: "Inclusive lower bound on acceptance time (RFC3339 date-time). REQUIRED: an absent or unparseable value returns 422 SRC-0002."
          explode: false
          in: query
          name: from
          required: true
          schema:
            description: "Inclusive lower bound on acceptance time (RFC3339 date-time). REQUIRED: an absent or unparseable value returns 422 SRC-0002."
            examples:
              - "2026-08-01T00:00:00Z"
            format: date-time
            type: string
        - description: "Inclusive upper bound on acceptance time (RFC3339 date-time). REQUIRED: an absent or unparseable value returns 422 SRC-0002; earlier than 'from' returns 422 SRC-0002 with a violation on this field."
          explode: false
          in: query
          name: to
          required: true
          schema:
            description: "Inclusive upper bound on acceptance time (RFC3339 date-time). REQUIRED: an absent or unparseable value returns 422 SRC-0002; earlier than 'from' returns 422 SRC-0002 with a violation on this field."
            examples:
              - "2026-08-31T23:59:59Z"
            format: date-time
            type: string
        - description: Optional correlation id (UUID) propagated through logs/traces.
          in: header
          name: X-Request-ID
          schema:
            description: Optional correlation id (UUID) propagated through logs/traces.
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DashboardSummaryBody"
          description: OK
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Forbidden
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Internal Server Error
      security:
        - m2m:
            - src:dashboard:read
      summary: Retrieve the consultation dashboard
      tags:
        - dashboard
      x-mint:
        href: /pt/reference/rails/src/retrieve-the-consultation-dashboard
  /v1/src/evidence:
    post:
      description: |-
        Searches the evidence trail by period, consultation id, BACEN control code or document. Each item is a consultation that has an evidence trail, most recently accepted first. To read the records of one consultation, use `GET /v1/src/evidence/consultations/{id}`.
      operationId: searchEvidence
      parameters:
        - description: Optional correlation id (UUID) propagated through logs/traces.
          in: header
          name: X-Request-ID
          schema:
            description: Optional correlation id (UUID) propagated through logs/traces.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/EvidenceSearchRequestBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EvidenceSearchListBody"
          description: OK
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Bad Request
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Forbidden
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Internal Server Error
      security:
        - m2m:
            - src:evidence:read
      summary: Search the evidence trail
      tags:
        - evidence
      x-mint:
        href: /pt/reference/rails/src/search-the-evidence-trail
  /v1/src/evidence/consultations/{id}:
    get:
      description: |-
        Returns the evidence trail of one consultation: every record, in ascending `sequence` order. This order reconstructs the history of the consultation.

        An unknown or malformed id returns `404` with code `SRC-0301`. A trail too large for one response returns `422` with code `SRC-0002`.
      operationId: getEvidenceTrail
      parameters:
        - description: "Consultation identifier (UUID). An identifier that is unknown or malformed returns 404 SRC-0301."
          in: path
          name: id
          required: true
          schema:
            description: "Consultation identifier (UUID). An identifier that is unknown or malformed returns 404 SRC-0301."
            examples:
              - 0192f5c4-1c2f-7c3a-8a1b-9f2e3d4c5b6a
            type: string
        - description: Optional correlation id (UUID) propagated through logs/traces.
          in: header
          name: X-Request-ID
          schema:
            description: Optional correlation id (UUID) propagated through logs/traces.
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EvidenceTrailBody"
          description: OK
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Forbidden
        "404":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Not Found
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Internal Server Error
      security:
        - m2m:
            - src:evidence:read
      summary: Retrieve a consultation's evidence trail
      tags:
        - evidence
      x-mint:
        href: /pt/reference/rails/src/retrieve-a-consultations-evidence-trail
  /v1/src/evidence/consultations/{id}/corrections:
    post:
      description: |-
        Appends a correction record to the evidence trail of a consultation. The correction points to the corrected record through `correctsSequence`, and the corrected record stays in the trail unchanged. The response returns the position of the new record.

        A `409` with code `SRC-0104` means that a concurrent correction took the position. Nothing was written, and you can retry. This operation is not idempotent: a repeated request appends a second correction.
      operationId: correctEvidenceRecord
      parameters:
        - description: Consultation identifier (UUID) whose evidence trail is being corrected.
          in: path
          name: id
          required: true
          schema:
            description: Consultation identifier (UUID) whose evidence trail is being corrected.
            examples:
              - 8f14e45f-ceea-467a-9a36-dedd4bea2543
            type: string
        - description: Optional correlation id (UUID) propagated through logs/traces.
          in: header
          name: X-Request-ID
          schema:
            description: Optional correlation id (UUID) propagated through logs/traces.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/EvidenceCorrectionRequestBody"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EvidenceCorrectionBody"
          description: Created
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Bad Request
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Forbidden
        "409":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Conflict
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Internal Server Error
      security:
        - m2m:
            - src:evidence:correct
      summary: Correct an evidence record
      tags:
        - evidence
      x-mint:
        href: /pt/reference/rails/src/correct-an-evidence-record
  /v1/src/evidence/records:
    post:
      description: |-
        Searches the evidence trail by document and returns the matching records, newest first by `occurredAt`. The results include requests that Lerian SRC refused before acceptance, which belong to no consultation. When `kind` is `operator_case_closure` or `credential_operation`, `document` is optional.

        The response does not carry the record content. For a record that belongs to a consultation, `GET /v1/src/evidence/consultations/{id}` returns the content.
      operationId: searchEvidenceRecords
      parameters:
        - description: Optional correlation id (UUID) propagated through logs/traces.
          in: header
          name: X-Request-ID
          schema:
            description: Optional correlation id (UUID) propagated through logs/traces.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/EvidenceRecordSearchRequestBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EvidenceRecordSearchListBody"
          description: OK
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Bad Request
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Forbidden
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Internal Server Error
      security:
        - m2m:
            - src:evidence:read
      summary: Search evidence records
      tags:
        - evidence
      x-mint:
        href: /pt/reference/rails/src/search-evidence-records
  /v1/src/operator/cases:
    get:
      description: |-
        Lists operator cases, newest first, one page at a time. Without `status`, it lists the open cases. `status=closed` lists the closed cases, and `status=all` lists both. You can filter by `leg`: `budget_exhausted`, `orphan_response`, `invalid_outbound` or `credential_operation`.

        No operation closes a `budget_exhausted` case.
      operationId: listOperatorCases
      parameters:
        - description: "Filter by leg: budget_exhausted | orphan_response | invalid_outbound | credential_operation. An unknown value returns 422 SRC-0002 — a typo and an empty backlog are different answers. Absent, all four legs are listed."
          explode: false
          in: query
          name: leg
          schema:
            description: "Filter by leg: budget_exhausted | orphan_response | invalid_outbound | credential_operation. An unknown value returns 422 SRC-0002 — a typo and an empty backlog are different answers. Absent, all four legs are listed."
            examples:
              - orphan_response
            type: string
        - description: "Which part of the backlog to list: open | closed | all. Absent means open. closed returns the cases that have left the queue, with resolvedAt and resolvedBy; it never contains a budget_exhausted case. An unknown value returns 422 SRC-0002."
          explode: false
          in: query
          name: status
          schema:
            description: "Which part of the backlog to list: open | closed | all. Absent means open. closed returns the cases that have left the queue, with resolvedAt and resolvedBy; it never contains a budget_exhausted case. An unknown value returns 422 SRC-0002."
            examples:
              - closed
            type: string
        - description: Opaque pagination cursor from a previous page. A cursor this service did not issue returns 400 SRC-0001.
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque pagination cursor from a previous page. A cursor this service did not issue returns 400 SRC-0001.
            type: string
        - description: Page size (1..200).
          explode: false
          in: query
          name: limit
          schema:
            default: 50
            description: Page size (1..200).
            examples:
              - 50
            format: int64
            maximum: 200
            minimum: 1
            type: integer
        - description: Optional correlation id (UUID) propagated through logs/traces.
          in: header
          name: X-Request-ID
          schema:
            description: Optional correlation id (UUID) propagated through logs/traces.
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OperatorCaseListBody"
          description: OK
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Bad Request
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Forbidden
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Internal Server Error
      security:
        - m2m:
            - src:operator:read
      summary: List operator cases
      tags:
        - operator
      x-mint:
        href: /pt/reference/rails/src/list-operator-cases
  /v1/src/operator/cases/{leg}/{caseId}:
    get:
      description: |-
        Returns one operator case, open or closed. A case id is unique only within its leg, so the path names both.

        An unknown or malformed case id returns `404` with code `SRC-0301`. An unknown leg returns `422` with code `SRC-0002`.
      operationId: getOperatorCase
      parameters:
        - description: "Which backlog the case belongs to: budget_exhausted | orphan_response | invalid_outbound | credential_operation. An unknown value returns 422 SRC-0002."
          in: path
          name: leg
          required: true
          schema:
            description: "Which backlog the case belongs to: budget_exhausted | orphan_response | invalid_outbound | credential_operation. An unknown value returns 422 SRC-0002."
            examples:
              - orphan_response
            type: string
        - description: "The case identifier. An identifier that is unknown or malformed returns 404 SRC-0301."
          in: path
          name: caseId
          required: true
          schema:
            description: "The case identifier. An identifier that is unknown or malformed returns 404 SRC-0301."
            examples:
              - 8f14e45f-ceea-467a-9a36-dedd4bea2543
            type: string
        - description: Optional correlation id (UUID) propagated through logs/traces.
          in: header
          name: X-Request-ID
          schema:
            description: Optional correlation id (UUID) propagated through logs/traces.
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OperatorCaseBody"
          description: OK
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Forbidden
        "404":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Not Found
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Internal Server Error
      security:
        - m2m:
            - src:operator:read
      summary: Retrieve an operator case
      tags:
        - operator
      x-mint:
        href: /pt/reference/rails/src/retrieve-an-operator-case
  /v1/src/operator/credential-operations/{caseId}/closure:
    post:
      description: |-
        Closes an open `credential_operation` operator case. The request carries a `reason`. Closing records the closure on the case and appends an `operator_case_closure` record to the evidence trail. It does not change the credential operation.

        A case that is not open returns `404` with code `SRC-0301`.
      operationId: closeCredentialOperationCase
      parameters:
        - description: The open operator case to close, on the leg this operation addresses.
          in: path
          name: caseId
          required: true
          schema:
            description: The open operator case to close, on the leg this operation addresses.
            format: uuid
            type: string
        - description: Optional correlation id (UUID) propagated through logs/traces.
          in: header
          name: X-Request-ID
          schema:
            description: Optional correlation id (UUID) propagated through logs/traces.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CloseOperatorCaseRequestBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OperatorCaseClosedBody"
          description: OK
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Bad Request
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Forbidden
        "404":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Not Found
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Internal Server Error
        "503":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Service Unavailable
      security:
        - m2m:
            - src:operator:close
      summary: Close a credential-operation case
      tags:
        - operator
      x-mint:
        href: /pt/reference/rails/src/close-a-credential-operation-case
  /v1/src/operator/invalid-dispatches/{caseId}/closure:
    post:
      description: |-
        Acknowledges an open `invalid_outbound` operator case. Lerian SRC opens this case when it refuses to send a message that does not conform to BACEN's specification, and the consultation fails with code `SRC-OUTBOUND-INVALID`. Acknowledging the case repairs nothing and sends nothing. To consult again, create a new consultation.

        The request carries a `reason`. Closing appends an `operator_case_closure` record to the evidence trail. A case that is not open returns `404` with code `SRC-0301`.
      operationId: closeInvalidDispatchCase
      parameters:
        - description: The open operator case to close, on the leg this operation addresses.
          in: path
          name: caseId
          required: true
          schema:
            description: The open operator case to close, on the leg this operation addresses.
            format: uuid
            type: string
        - description: Optional correlation id (UUID) propagated through logs/traces.
          in: header
          name: X-Request-ID
          schema:
            description: Optional correlation id (UUID) propagated through logs/traces.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CloseOperatorCaseRequestBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OperatorCaseClosedBody"
          description: OK
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Bad Request
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Forbidden
        "404":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Not Found
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Internal Server Error
        "503":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Service Unavailable
      security:
        - m2m:
            - src:operator:close
      summary: Acknowledge an invalid-dispatch case
      tags:
        - operator
      x-mint:
        href: /pt/reference/rails/src/acknowledge-an-invalid-dispatch-case
  /v1/src/operator/orphan-responses/{caseId}/closure:
    post:
      description: |-
        Closes an open `orphan_response` operator case: an inbound message that matched no operation of this deployment. The request carries a `reason`. Closing records the closure on the case and appends an `operator_case_closure` record to the evidence trail.

        A case that is not open returns `404` with code `SRC-0301`.
      operationId: closeOrphanResponseCase
      parameters:
        - description: The open operator case to close, on the leg this operation addresses.
          in: path
          name: caseId
          required: true
          schema:
            description: The open operator case to close, on the leg this operation addresses.
            format: uuid
            type: string
        - description: Optional correlation id (UUID) propagated through logs/traces.
          in: header
          name: X-Request-ID
          schema:
            description: Optional correlation id (UUID) propagated through logs/traces.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CloseOperatorCaseRequestBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OperatorCaseClosedBody"
          description: OK
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Bad Request
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Forbidden
        "404":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Not Found
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Internal Server Error
        "503":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
          description: Service Unavailable
      security:
        - m2m:
            - src:operator:close
      summary: Close an orphan-response case
      tags:
        - operator
      x-mint:
        href: /pt/reference/rails/src/close-an-orphan-response-case
security:
  - m2m: []
servers:
  - url: https://api.example.com
    description: Replace the example host with your deployment's address.
tags:
  - description: Asynchronous restriction consultations (accept → pending → completed/failed).
    name: consultation
  - description: Client-decision records (exceptional proceed, refusal explanation) — single-purpose, write-once.
    name: decision
  - description: Regulatory evidence trail — search, reconstruction, chained correction.
    name: evidence
  - description: Aggregated numeric view per institution.
    name: dashboard
  - description: Status of the institution's regulatory credential.
    name: credential
  - description: Operator cases — the backlog `openOperatorCases` counts, and the act that closes one.
    name: operator
