openapi: 3.1.0
info:
  title: e-Próspera API
  version: 1.0.0
  description: |-
    Public API for Próspera's resident registry, legal-entity
    incorporation, OAuth identity, and agent-delegated workflows.

    This document is generated from the runtime zod schemas of each
    route handler. Update the schema, regenerate, and the docs follow.
  contact:
    url: https://docs.eprospera.com/
servers:
  - url: https://portal.eprospera.com
    description: Production
tags:
  - name: Verification
  - name: Legal entities
  - name: Legal-entity applications
  - name: Partner residency applications
  - name: Authenticated person
  - name: Consented legal entities
  - name: Referrals
  - name: Visitor passes
  - name: OAuth 2.0 / OpenID Connect
  - name: Deprecated aliases
components:
  securitySchemes:
    standardApiKey:
      type: http
      scheme: bearer
      bearerFormat: sk-...
      description: "Personal standard API key. Send it as `Authorization: Bearer sk-...` and never delegate it."
    agentKey:
      type: http
      scheme: bearer
      bearerFormat: ak-...
      description: Scope-checked Agent Key. See https://docs.eprospera.com/agent-keys.
    partnerKey:
      type: http
      scheme: bearer
      bearerFormat: pk-...
      description: Partner Key for one approved Partner Integration. Keys are lifecycle- and scope-checked, and cross-integration resources are hidden.
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://portal.eprospera.com/api/oauth/authorize
          tokenUrl: https://portal.eprospera.com/api/oauth/token
          refreshUrl: https://portal.eprospera.com/api/oauth/token
          scopes:
            openid: OpenID Connect authentication.
            profile: Read name and profile picture claims.
            email: Read email claims.
            offline_access: Issue a refresh token.
            eprospera:person.details.read: Read personal details.
            eprospera:person.residency.read: Read residency status.
            eprospera:person.id_verification.read: Read ID-verification artifacts.
            eprospera:entity.read: Read legal-entity details for consented entities.
            eprospera:entity.documents.read: Read legal-entity documents for consented entities.
            eprospera:person.tax.read: Read the authenticated person’s tax data.
            eprospera:entity.tax.read: Read tax data for consented entities.
            eprospera:person.tax.vat.write: Identify your taxpayer record and prepare and submit quarterly VAT filings.
            eprospera:entity.tax.vat.write: Identify selected entities and prepare and submit their quarterly VAT filings.
            eprospera:person.documents.read: Read the authenticated person’s documents, including the signed Agreement of Coexistence.
    oauthClient:
      type: http
      scheme: basic
      description: OAuth client credentials using HTTP Basic. The OAuth endpoints also accept client credentials in the form body where documented.
  schemas:
    ErrorEnvelope:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
          description: Stable service error code when provided.
        error_description:
          type: string
        details:
          type: array
          items: {}
      required:
        - error
      description: Common error envelope. `error` is always present on a non-2xx response; `code`, `error_description`, and `details` are optional.
    VerifyRpnResponse:
      type: object
      properties:
        result:
          type: string
          enum:
            - found_legal_entity
            - found_natural_person
            - not_found
        active:
          type: boolean
          description: Whether the resident has an active residency.
      required:
        - result
        - active
    VerifyRpnRequest:
      type: object
      properties:
        rpn:
          type: string
          pattern: ^[89]\d{13}$
          example: "80000000000012"
      required:
        - rpn
    SearchLegalEntitiesResponse:
      type: object
      properties:
        results:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                format: uuid
              name:
                type: string
              extension:
                type: string
              residentPermitNumber:
                type:
                  - string
                  - "null"
                pattern: ^[89]\d{13}$
                description: 14-digit Resident Permit Number.
            required:
              - id
              - name
              - extension
              - residentPermitNumber
      required:
        - results
    SearchLegalEntitiesRequest:
      type: object
      properties:
        query:
          type: string
          minLength: 1
          maxLength: 100
      required:
        - query
    LegalEntityDetails:
      allOf:
        - $ref: "#/components/schemas/LegalEntity"
        - type: object
          properties:
            jurisdictionOfFormation:
              type: string
            status:
              type: string
              enum:
                - active
                - inactive
                - dissolved
              description: Dissolved when the dissolution date has passed; otherwise active when residency is current, or inactive. This is not a certificate of good standing.
            residencyStatus:
              type: string
              enum:
                - active
                - inactive
            residency:
              type:
                - object
                - "null"
              properties:
                type:
                  type: string
                effectiveDate:
                  type: string
                  format: date-time
                terminationDate:
                  type:
                    - string
                    - "null"
                  format: date-time
              required:
                - type
                - effectiveDate
                - terminationDate
            registeredAddress:
              allOf:
                - $ref: "#/components/schemas/Address"
                - description: Current registered agent office address; distinct from principalOfficeAddress.
            registeredAgent:
              type:
                - object
                - "null"
              properties:
                providerId:
                  type: string
                name:
                  type:
                    - string
                    - "null"
                attn:
                  type:
                    - string
                    - "null"
                website:
                  type:
                    - string
                    - "null"
                residentPermitNumber:
                  type:
                    - string
                    - "null"
                  pattern: ^[89]\d{13}$
                  description: 14-digit Resident Permit Number.
                effectiveDate:
                  type: string
                  format: date-time
                terminationDate:
                  type:
                    - string
                    - "null"
                  format: date-time
                officeAddress:
                  $ref: "#/components/schemas/Address"
                mailingAddress:
                  $ref: "#/components/schemas/Address"
              required:
                - providerId
                - name
                - attn
                - website
                - residentPermitNumber
                - effectiveDate
                - terminationDate
                - officeAddress
                - mailingAddress
          required:
            - jurisdictionOfFormation
            - status
            - residencyStatus
            - residency
            - registeredAddress
            - registeredAgent
    Address:
      type:
        - object
        - "null"
      properties:
        line1:
          type: string
        line2:
          type:
            - string
            - "null"
        city:
          type: string
        state:
          type:
            - string
            - "null"
        postalCode:
          type: string
        country:
          type: string
      required:
        - line1
        - city
        - postalCode
        - country
    LegalEntity:
      type: object
      properties:
        id:
          type: string
          format: uuid
        optionId:
          type: string
        type:
          type: string
        name:
          type: string
        extension:
          type: string
        nameStartsWithExtension:
          type: boolean
        formationDate:
          type:
            - string
            - "null"
          description: Formation date as YYYY-MM-DD.
        registrationDate:
          type:
            - string
            - "null"
          format: date-time
        dissolutionDate:
          type:
            - string
            - "null"
          format: date-time
        residentPermitNumber:
          type:
            - string
            - "null"
          pattern: ^[89]\d{13}$
          description: 14-digit Resident Permit Number.
        principalOfficeAddress:
          $ref: "#/components/schemas/Address"
        createdAt:
          type: string
          format: date-time
      required:
        - id
        - optionId
        - type
        - name
        - extension
        - nameStartsWithExtension
        - residentPermitNumber
    Document:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        slug:
          type:
            - string
            - "null"
        version:
          type:
            - string
            - "null"
        fileUrl:
          type:
            - string
            - "null"
          format: uri
        createdAt:
          type: string
          format: date-time
      required:
        - id
        - name
        - fileUrl
    AmendmentFiling:
      type: object
      properties:
        id:
          type: string
          format: uuid
        legalEntityId:
          type: string
          format: uuid
        statusId:
          type: string
          enum:
            - Draft
            - Pending Payment
            - Pending Review
            - Approved
            - Rejected
          description: "Draft: editable; may be signed before invoice preparation. Pending Payment: signed and invoiced. Pending Review: paid and submitted. Approved: changes applied to the registry. Rejected: declined with a reason."
        proposedChanges:
          type: object
          properties:
            name:
              type:
                - string
                - "null"
            extension:
              type:
                - string
                - "null"
            nameStartsWithExtension:
              type:
                - boolean
                - "null"
            principalOfficeAddress:
              anyOf:
                - $ref: "#/components/schemas/Address"
                - type: "null"
          required:
            - name
            - extension
            - nameStartsWithExtension
            - principalOfficeAddress
        signed:
          type: boolean
        signedAt:
          type:
            - string
            - "null"
          format: date-time
        invoice:
          $ref: "#/components/schemas/FilingInvoice"
        submittedAt:
          type:
            - string
            - "null"
          format: date-time
        approvedAt:
          type:
            - string
            - "null"
          format: date-time
        rejectedAt:
          type:
            - string
            - "null"
          format: date-time
        rejectedReason:
          type:
            - string
            - "null"
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        nextSteps:
          $ref: "#/components/schemas/AmendmentNextSteps"
      required:
        - id
        - legalEntityId
        - statusId
        - proposedChanges
        - signed
        - signedAt
        - invoice
        - submittedAt
        - approvedAt
        - rejectedAt
        - rejectedReason
        - createdAt
        - updatedAt
        - nextSteps
    FilingInvoice:
      type:
        - object
        - "null"
      properties:
        id:
          type: string
          format: uuid
        statusId:
          type: string
          description: Invoice status, for example `open` or `paid`.
      required:
        - id
        - statusId
    AmendmentNextSteps:
      type: object
      properties:
        changesRequired:
          type: boolean
          description: True while the open filing has no proposed changes.
        signatureUrl:
          type:
            - string
            - "null"
          format: uri
          description: Portal page where an active representative signs the amendment. Null once signed or after submission. Signing requires a portal login; the API never accepts signature images.
        paymentRequired:
          type: boolean
          description: True for an open Draft or Pending Payment filing whose invoice is not paid. False on terminal states is not independent proof of settlement.
        reviewDispatchPending:
          type: boolean
          description: The submission is saved and its review event is awaiting delivery. Safe to retry submit; background recovery also retries.
        submitReady:
          type: boolean
          description: True when the filing is signed and paid but not yet submitted. Voucher payments submit automatically.
      required:
        - changesRequired
        - signatureUrl
        - paymentRequired
        - reviewDispatchPending
        - submitReady
    AmendmentFilingResponse:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/AmendmentFiling"
        nextSteps:
          $ref: "#/components/schemas/AmendmentNextSteps"
      required:
        - data
        - nextSteps
    AmendmentChangesRequest:
      type: object
      properties:
        updatedName:
          type:
            - string
            - "null"
          minLength: 1
          maxLength: 200
        updatedExtension:
          type:
            - string
            - "null"
          minLength: 1
          maxLength: 50
        updatedNameStartsWithExtension:
          type:
            - boolean
            - "null"
        updatedAddress:
          type:
            - object
            - "null"
          properties:
            line1:
              type: string
              minLength: 1
              maxLength: 200
            line2:
              type:
                - string
                - "null"
              maxLength: 200
            city:
              type: string
              minLength: 1
              maxLength: 100
            state:
              type:
                - string
                - "null"
              maxLength: 100
            postalCode:
              type: string
              minLength: 1
              maxLength: 20
            country:
              type: string
              minLength: 1
              maxLength: 100
          required:
            - line1
            - city
            - postalCode
            - country
      additionalProperties: false
      description: At least one non-null change is required. POST replaces the proposed changes; omitted fields are cleared.
    AmendmentPatchRequest:
      type: object
      properties:
        updatedName:
          type:
            - string
            - "null"
          minLength: 1
          maxLength: 200
        updatedExtension:
          type:
            - string
            - "null"
          minLength: 1
          maxLength: 50
        updatedNameStartsWithExtension:
          type:
            - boolean
            - "null"
        updatedAddress:
          type:
            - object
            - "null"
          properties:
            line1:
              type: string
              minLength: 1
              maxLength: 200
            line2:
              type:
                - string
                - "null"
              maxLength: 200
            city:
              type: string
              minLength: 1
              maxLength: 100
            state:
              type:
                - string
                - "null"
              maxLength: 100
            postalCode:
              type: string
              minLength: 1
              maxLength: 20
            country:
              type: string
              minLength: 1
              maxLength: 100
          required:
            - line1
            - city
            - postalCode
            - country
      additionalProperties: false
      description: PATCH preserves omitted fields; explicit null clears a proposed change. Any revision invalidates the previous signature.
    AmendmentPaymentResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          $ref: "#/components/schemas/AmendmentFiling"
      required:
        - success
        - data
    VoucherPaymentRequest:
      type: object
      properties:
        voucherCode:
          type: string
          minLength: 1
      required:
        - voucherCode
    CertificateRequestListResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/CertificateRequest"
        eligibility:
          $ref: "#/components/schemas/CertificateEligibility"
      required:
        - data
        - eligibility
    CertificateRequest:
      type: object
      properties:
        id:
          type: string
          format: uuid
        legalEntityId:
          type: string
          format: uuid
        type:
          type: string
          enum:
            - certificate_of_good_standing
        statusId:
          type: string
          enum:
            - Draft
            - Pending Payment
            - Pending Review
            - Approved
            - Issued
            - Rejected
            - Cancelled
          description: "Pending Payment: awaiting payment or asynchronous payment processing; check invoice status before paying again. Pending Review: awaiting registrar review, including contested or unresolved tax compliance. Approved: PDF generation in progress. Issued: certificate available at `documentUrl`. Issued, Rejected, and Cancelled are terminal: stop polling on each. Rejected and Cancelled do not yield a certificate."
        contested:
          type: boolean
        taxContestNote:
          type:
            - string
            - "null"
        taxPaymentProofUrl:
          type:
            - string
            - "null"
          format: uri
        contestedAt:
          type:
            - string
            - "null"
          format: date-time
        rejectionReason:
          type:
            - string
            - "null"
        reviewedAt:
          type:
            - string
            - "null"
          format: date-time
        issuedAt:
          type:
            - string
            - "null"
          format: date-time
        documentId:
          type:
            - string
            - "null"
          format: uuid
        documentUrl:
          type:
            - string
            - "null"
          format: uri
        invoice:
          $ref: "#/components/schemas/FilingInvoice"
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        nextSteps:
          $ref: "#/components/schemas/CertificateRequestNextSteps"
      required:
        - id
        - legalEntityId
        - type
        - statusId
        - contested
        - taxContestNote
        - taxPaymentProofUrl
        - contestedAt
        - rejectionReason
        - reviewedAt
        - issuedAt
        - documentId
        - documentUrl
        - invoice
        - createdAt
        - updatedAt
        - nextSteps
    CertificateRequestNextSteps:
      type: object
      properties:
        paymentRequired:
          type: boolean
        awaitingReview:
          type: boolean
        issued:
          type: boolean
      required:
        - paymentRequired
        - awaitingReview
        - issued
    CertificateEligibility:
      type: object
      properties:
        eligible:
          type: boolean
        reason:
          type:
            - string
            - "null"
          enum:
            - not_eligible_entity_type
            - not_in_good_standing
            - null
        taxCompliant:
          type:
            - boolean
            - "null"
          description: False when the entity has overdue tax filings; a contest is then required to request the certificate. Null when eligibility failed or tax compliance could not be determined; do not treat null as clear.
      required:
        - eligible
        - reason
        - taxCompliant
    CertificateRequestResponse:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/CertificateRequest"
        nextSteps:
          $ref: "#/components/schemas/CertificateRequestNextSteps"
      required:
        - data
        - nextSteps
    CertificateRequestBody:
      type: object
      properties:
        contest:
          type: object
          properties:
            note:
              type: string
              minLength: 1
              maxLength: 2000
            proofUrl:
              type: string
              maxLength: 2048
              format: uri
              description: URL of a proof-of-payment document on the approved e-Próspera portal upload host. Arbitrary external URLs are rejected; this release has no public certificate-proof upload API.
          required:
            - note
            - proofUrl
          description: Required only when `eligibility.taxCompliant` is false and the requester disputes the overdue flag.
    CertificatePaymentResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          $ref: "#/components/schemas/CertificateRequest"
        message:
          type: string
      required:
        - success
        - data
        - message
    LegalEntityApplication:
      type: object
      properties:
        id:
          type: string
          format: uuid
        statusId:
          type: string
          enum:
            - Draft
            - Pending Review
            - Approved
            - Rejected
        applicationData: {}
        applicationVersion:
          type: string
        submittedAt:
          type:
            - string
            - "null"
          format: date-time
        createdAt:
          type: string
          format: date-time
        approvedAt:
          type:
            - string
            - "null"
          format: date-time
        rejectedAt:
          type:
            - string
            - "null"
          format: date-time
        legalEntityId:
          type:
            - string
            - "null"
          format: uuid
      required:
        - id
        - statusId
        - applicationVersion
        - submittedAt
        - createdAt
        - approvedAt
        - rejectedAt
        - legalEntityId
    CreateLegalEntityApplicationResponse:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/LegalEntityApplication"
        nextSteps:
          type: object
          properties:
            signature:
              type:
                - string
                - "null"
              format: uri
          required:
            - signature
      required:
        - data
        - nextSteps
    CreateLegalEntityApplicationRequest:
      type: object
      properties:
        applicationData:
          type: object
          properties:
            residencyType:
              type: string
              enum:
                - e-Resident
                - Resident
            entityType:
              type: string
              enum:
                - llc
            name:
              type: string
              minLength: 1
              maxLength: 200
            extension:
              type: string
              enum:
                - LLC
                - L.L.C.
                - Limited Liability Company
                - S. de R.L.
                - SRL
                - Limited Company
                - L.C.
                - LC
                - Limited Liability Co.
                - Limited Co.
                - Ltd. Co.
            principalOffice:
              $ref: "#/components/schemas/Address"
            contactEmail:
              type: string
              format: email
            registeredAgentProvider:
              type:
                - string
                - "null"
              enum:
                - prospera_employment_solutions
            registeredAgentDetails:
              type:
                - object
                - "null"
              properties:
                attn:
                  type: string
                residentPermitNumber:
                  type: string
                  pattern: ^[89]\d{13}$
                  description: 14-digit Resident Permit Number.
                officeAddress:
                  $ref: "#/components/schemas/Address"
                mailingAddress:
                  $ref: "#/components/schemas/Address"
              required:
                - attn
                - residentPermitNumber
                - officeAddress
                - mailingAddress
            analytics:
              type: object
              additionalProperties:
                type: string
          required:
            - residencyType
            - entityType
            - name
            - extension
            - principalOffice
            - contactEmail
            - registeredAgentProvider
            - registeredAgentDetails
        referralCode:
          type: string
        redirectUrl:
          type: string
          format: uri
      required:
        - applicationData
    PaymentResponse:
      type: object
      properties:
        data:
          type: object
          additionalProperties: {}
        success:
          type: boolean
        message:
          type: string
      additionalProperties: {}
    CheckoutResponse:
      type: object
      properties:
        data:
          type:
            - object
            - "null"
          additionalProperties: {}
        invoiceId:
          type: string
          format: uuid
      required:
        - data
        - invoiceId
    CheckoutRequest:
      type: object
      properties:
        paymentProvider:
          type: string
        paymentMethod:
          type: object
          additionalProperties: {}
        email:
          type:
            - string
            - "null"
          format: email
        redirectUrl:
          type: string
          format: uri
      required:
        - redirectUrl
    PartnerResidencyApplication:
      type: object
      properties:
        id:
          type: string
          format: uuid
        version:
          type: integer
          exclusiveMinimum: 0
        statusId:
          type: string
          enum:
            - Draft
            - Pending Review
            - Approved
            - Rejected
        applicationVersion:
          type: string
        submittedAt:
          type:
            - string
            - "null"
          format: date-time
        createdAt:
          type: string
          format: date-time
        approvedAt:
          type:
            - string
            - "null"
          format: date-time
        rejectedAt:
          type:
            - string
            - "null"
          format: date-time
        residentPermitNumber:
          type:
            - string
            - "null"
          pattern: ^[89]\d{13}$
          description: 14-digit Resident Permit Number.
        referralCode:
          type:
            - string
            - "null"
        applicationData:
          type: object
          properties:
            residencyType:
              type:
                - string
                - "null"
              enum:
                - limited_e_resident
                - e_resident
                - resident_annual
                - null
            aoc:
              type: object
              properties:
                aocId:
                  type:
                    - string
                    - "null"
                signed:
                  type: boolean
                signedByName:
                  type:
                    - string
                    - "null"
                signedAt:
                  type:
                    - string
                    - "null"
                  format: date-time
                agentAuthorized:
                  type: boolean
              required:
                - aocId
                - signed
                - signedByName
                - signedAt
                - agentAuthorized
            personalDetails:
              type:
                - object
                - "null"
              properties:
                givenName:
                  type: string
                surname:
                  type: string
                email:
                  type: string
                  format: email
                dateOfBirth:
                  type: string
                sex:
                  type: string
                countryOfBirth:
                  type:
                    - string
                    - "null"
                  minLength: 2
                  maxLength: 2
                citizenships:
                  type: array
                  items:
                    type: string
                    minLength: 2
                    maxLength: 2
                alternateNamesAttestation:
                  type: boolean
                alternateNames:
                  type:
                    - string
                    - "null"
                criminalBackgroundAttestation:
                  type: boolean
                proofOfAddressUploadId:
                  type:
                    - string
                    - "null"
                  format: uuid
                address:
                  type: object
                  properties:
                    line1:
                      type:
                        - string
                        - "null"
                    line2:
                      type:
                        - string
                        - "null"
                    city:
                      type:
                        - string
                        - "null"
                    state:
                      type:
                        - string
                        - "null"
                    postalCode:
                      type:
                        - string
                        - "null"
                    country:
                      type:
                        - string
                        - "null"
                      minLength: 2
                      maxLength: 2
                  required:
                    - line1
                    - line2
                    - city
                    - state
                    - postalCode
                    - country
                phoneNumber:
                  type:
                    - string
                    - "null"
              required:
                - givenName
                - surname
                - email
                - dateOfBirth
                - sex
                - countryOfBirth
                - citizenships
                - alternateNamesAttestation
                - alternateNames
                - criminalBackgroundAttestation
                - proofOfAddressUploadId
                - address
                - phoneNumber
            information:
              type: object
              properties:
                residencyReason:
                  type:
                    - string
                    - "null"
                referralSource:
                  type:
                    - string
                    - "null"
              required:
                - residencyReason
                - referralSource
          required:
            - residencyType
            - aoc
            - personalDetails
            - information
        applicantPortalAccess:
          type: object
          properties:
            email:
              type:
                - string
                - "null"
              format: email
            hasLoggedIn:
              type: boolean
            lastLogin:
              type:
                - string
                - "null"
              format: date-time
            claimLinkSent:
              type: boolean
            claimLinkSentAt:
              type:
                - string
                - "null"
              format: date-time
          required:
            - email
            - hasLoggedIn
            - lastLogin
            - claimLinkSent
            - claimLinkSentAt
        nextSteps:
          type: object
          properties:
            agreementUrl:
              type:
                - string
                - "null"
              format: uri
            proofOfAddressRequired:
              type: boolean
            paymentRequired:
              type: boolean
            verificationRequired:
              type: boolean
            verificationInstructions:
              type:
                - string
                - "null"
            submitReady:
              type: boolean
          required:
            - agreementUrl
            - proofOfAddressRequired
            - paymentRequired
            - verificationRequired
            - verificationInstructions
            - submitReady
      required:
        - id
        - version
        - statusId
        - applicationVersion
        - submittedAt
        - createdAt
        - approvedAt
        - rejectedAt
        - residentPermitNumber
        - referralCode
        - applicationData
        - applicantPortalAccess
        - nextSteps
    CreatePartnerResidencyApplicationRequest:
      type: object
      properties:
        applicationData:
          type: object
          properties:
            residencyType:
              type: string
              enum:
                - limited_e_resident
                - e_resident
                - resident_annual
            personalDetails:
              type: object
              properties:
                givenName:
                  type: string
                  minLength: 1
                  maxLength: 100
                  pattern: "^\\p{L}(?:[\\p{L}\\p{M}]|\\u200c|\\u200d)*(?:(?: +|['\\u2019\\u02bc\\u00b7-]|\\. ?)\\p{L}(?:[\\p{L}\\p{M}]|\\u200c|\\u200d)*)*\\.?$"
                surname:
                  type: string
                  minLength: 1
                  maxLength: 100
                  pattern: "^\\p{L}(?:[\\p{L}\\p{M}]|\\u200c|\\u200d)*(?:(?: +|['\\u2019\\u02bc\\u00b7-]|\\. ?)\\p{L}(?:[\\p{L}\\p{M}]|\\u200c|\\u200d)*)*\\.?$"
                email:
                  type: string
                  format: email
                dateOfBirth:
                  type: string
                  pattern: ^\d{4}-\d{2}-\d{2}$
                sex:
                  type: string
                  enum:
                    - male
                    - female
                countryOfBirth:
                  type: string
                  pattern: ^[A-Z]{2}$
                citizenships:
                  type: array
                  items:
                    type: string
                    pattern: ^[A-Z]{2}$
                  minItems: 1
                alternateNamesAttestation:
                  type: boolean
                alternateNames:
                  type:
                    - string
                    - "null"
                criminalBackgroundAttestation:
                  type: boolean
                proofOfAddressUploadId:
                  type: string
                  format: uuid
                proofOfAddressSwornStatement:
                  type: object
                  properties:
                    agreed:
                      type: boolean
                      enum:
                        - true
                    signature:
                      type: string
                      description: Canonical base64 PNG signature, at most 512 KiB and 4 million pixels. The complete image must decode and embed in a PDF.
                    locale:
                      type: string
                      enum:
                        - en
                        - es
                  required:
                    - agreed
                    - signature
                address:
                  allOf:
                    - $ref: "#/components/schemas/Address"
                    - type: object
                      properties:
                        country:
                          type: string
                          pattern: ^[A-Z]{2}$
                phoneNumber:
                  type: string
                  pattern: ^\+[1-9]\d{7,14}$
              required:
                - givenName
                - surname
                - email
                - dateOfBirth
                - sex
                - countryOfBirth
                - citizenships
                - alternateNamesAttestation
                - criminalBackgroundAttestation
                - address
                - phoneNumber
            information:
              type: object
              properties:
                residencyReason:
                  type:
                    - string
                    - "null"
                referralSource:
                  type:
                    - string
                    - "null"
          required:
            - residencyType
            - personalDetails
        referralCode:
          type: string
          minLength: 1
        redirectUrl:
          type: string
          format: uri
      required:
        - applicationData
    UpdatePartnerResidencyApplicationRequest:
      type: object
      properties:
        expectedVersion:
          type: integer
          exclusiveMinimum: 0
        applicationData:
          type: object
          properties:
            residencyType:
              type: string
              enum:
                - limited_e_resident
                - e_resident
                - resident_annual
            personalDetails:
              type: object
              properties:
                givenName:
                  type: string
                  minLength: 1
                  maxLength: 100
                  pattern: "^\\p{L}(?:[\\p{L}\\p{M}]|\\u200c|\\u200d)*(?:(?: +|['\\u2019\\u02bc\\u00b7-]|\\. ?)\\p{L}(?:[\\p{L}\\p{M}]|\\u200c|\\u200d)*)*\\.?$"
                surname:
                  type: string
                  minLength: 1
                  maxLength: 100
                  pattern: "^\\p{L}(?:[\\p{L}\\p{M}]|\\u200c|\\u200d)*(?:(?: +|['\\u2019\\u02bc\\u00b7-]|\\. ?)\\p{L}(?:[\\p{L}\\p{M}]|\\u200c|\\u200d)*)*\\.?$"
                email:
                  type: string
                  format: email
                dateOfBirth:
                  type: string
                  pattern: ^\d{4}-\d{2}-\d{2}$
                sex:
                  type: string
                  enum:
                    - male
                    - female
                countryOfBirth:
                  type: string
                  pattern: ^[A-Z]{2}$
                citizenships:
                  type: array
                  items:
                    type: string
                    pattern: ^[A-Z]{2}$
                  minItems: 1
                alternateNamesAttestation:
                  type: boolean
                alternateNames:
                  type:
                    - string
                    - "null"
                criminalBackgroundAttestation:
                  type: boolean
                proofOfAddressUploadId:
                  type: string
                  format: uuid
                proofOfAddressSwornStatement:
                  type: object
                  properties:
                    agreed:
                      type: boolean
                      enum:
                        - true
                    signature:
                      type: string
                      description: Canonical base64 PNG signature, at most 512 KiB and 4 million pixels. The complete image must decode and embed in a PDF.
                    locale:
                      type: string
                      enum:
                        - en
                        - es
                  required:
                    - agreed
                    - signature
                address:
                  allOf:
                    - $ref: "#/components/schemas/Address"
                    - type: object
                      properties:
                        country:
                          type: string
                          pattern: ^[A-Z]{2}$
                phoneNumber:
                  type: string
                  pattern: ^\+[1-9]\d{7,14}$
              required:
                - givenName
                - surname
                - email
                - dateOfBirth
                - sex
                - countryOfBirth
                - citizenships
                - alternateNamesAttestation
                - criminalBackgroundAttestation
                - address
                - phoneNumber
            information:
              type: object
              properties:
                residencyReason:
                  type:
                    - string
                    - "null"
                referralSource:
                  type:
                    - string
                    - "null"
          required:
            - residencyType
            - personalDetails
        referralCode:
          type: string
          minLength: 1
        redirectUrl:
          type: string
          format: uri
      required:
        - expectedVersion
        - applicationData
    PartnerApplicationDocumentsResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/PartnerApplicationDocument"
          description: Visible signed agreement and policy documents generated for the applicant once the residency exists. Admin-only and hidden records are excluded. Empty before approval.
        agreementOfCoexistence:
          $ref: "#/components/schemas/PartnerAgreementOfCoexistence"
        residencyEffectiveDate:
          type:
            - string
            - "null"
          format: date-time
      required:
        - data
        - agreementOfCoexistence
        - residencyEffectiveDate
    PartnerApplicationDocument:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        slug:
          type:
            - string
            - "null"
        version:
          type:
            - string
            - "null"
        fileUrl:
          type: string
          format: uri
        createdAt:
          type: string
          format: date-time
      required:
        - id
        - name
        - slug
        - version
        - fileUrl
        - createdAt
    PartnerAgreementOfCoexistence:
      type:
        - object
        - "null"
      properties:
        aocId:
          type: string
          format: uuid
        slug:
          type:
            - string
            - "null"
        version:
          type: string
        residencyType:
          type: string
        templatePdfUrl:
          type:
            - string
            - "null"
          format: uri
          description: Unsigned template PDF for the accepted agreement version.
        accepted:
          type: boolean
          description: False when a later legally relevant change invalidated the acceptance.
        acceptedAt:
          type: string
          format: date-time
        signerName:
          type: string
        invalidatedAt:
          type:
            - string
            - "null"
          format: date-time
      required:
        - aocId
        - slug
        - version
        - residencyType
        - templatePdfUrl
        - accepted
        - acceptedAt
        - signerName
        - invalidatedAt
    PartnerCheckoutRequest:
      type: object
      properties:
        paymentProvider:
          type: string
          enum:
            - stripe
            - stripe-crypto
            - blink
            - blink-onchain
            - solana-pay-ptc
        paymentMethod:
          type: object
          additionalProperties: {}
        email:
          type:
            - string
            - "null"
          format: email
        redirectUrl:
          type: string
          format: uri
      required:
        - redirectUrl
    PartnerVoucherRequest:
      type: object
      properties:
        voucherCode:
          type: string
          minLength: 1
      required:
        - voucherCode
    PartnerEmbedSessionResponse:
      type: object
      properties:
        sessionId:
          type: string
          format: uuid
        embedUrl:
          type: string
          format: uri
        tokenExpiresAt:
          type: string
          format: date-time
        flowExpiresAt:
          type: string
          format: date-time
      required:
        - sessionId
        - embedUrl
        - tokenExpiresAt
        - flowExpiresAt
    PartnerEmbedSessionRequest:
      type: object
      properties:
        parentOrigin:
          type: string
          format: uri
        codeChallenge:
          type: string
          pattern: ^[A-Za-z0-9_-]{43}$
        codeChallengeMethod:
          type: string
          enum:
            - S256
        locale:
          type: string
          enum:
            - en
            - es
          default: en
      required:
        - parentOrigin
        - codeChallenge
        - codeChallengeMethod
      additionalProperties: false
    NaturalPerson:
      type:
        - object
        - "null"
      properties:
        givenName:
          type: string
        surname:
          type: string
        name:
          type: string
        residentPermitNumber:
          type:
            - string
            - "null"
          pattern: ^[89]\d{13}$
          description: 14-digit Resident Permit Number.
        countryOfBirth:
          type:
            - string
            - "null"
        citizenships:
          type: array
          items:
            type: string
        dateOfBirth:
          type:
            - string
            - "null"
          format: date-time
        sex:
          type:
            - string
            - "null"
          enum:
            - M
            - F
            - null
        address:
          type:
            - object
            - "null"
          properties:
            country:
              type: string
            line1:
              type: string
            line2:
              type:
                - string
                - "null"
            city:
              type: string
            state:
              type:
                - string
                - "null"
            postalCode:
              type: string
          required:
            - country
            - line1
            - line2
            - city
            - state
            - postalCode
        phoneNumber:
          type:
            - string
            - "null"
      required:
        - givenName
        - surname
        - name
        - residentPermitNumber
        - countryOfBirth
        - citizenships
        - dateOfBirth
        - sex
        - address
        - phoneNumber
    IdVerification:
      type: object
      properties:
        id:
          type:
            - string
            - "null"
          format: uuid
        type:
          type:
            - string
            - "null"
          enum:
            - veriff
        documentType:
          type:
            - string
            - "null"
          enum:
            - passport
            - national_id
            - drivers_license
            - residence_permit
            - visa
            - other
            - null
        date:
          type:
            - string
            - "null"
          format: date-time
        status:
          type:
            - string
            - "null"
          enum:
            - approved
        documents:
          type: object
          properties:
            documentFront:
              type:
                - string
                - "null"
              format: uri
            documentBack:
              type:
                - string
                - "null"
              format: uri
            face:
              type:
                - string
                - "null"
              format: uri
          required:
            - documentFront
            - documentBack
            - face
      required:
        - id
        - type
        - documentType
        - date
        - status
        - documents
    Residency:
      type: object
      properties:
        wasEverResident:
          type: boolean
        activeResidency:
          type:
            - object
            - "null"
          properties:
            effectiveDate:
              type: string
              format: date-time
            terminationDate:
              type:
                - string
                - "null"
              format: date-time
            residencyType:
              type: string
              enum:
                - Limited e-Resident
                - e-Resident
                - Resident
            version:
              type: string
          required:
            - effectiveDate
            - terminationDate
            - residencyType
            - version
      required:
        - wasEverResident
        - activeResidency
    PersonDocumentsResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/PersonDocument"
        agreementOfCoexistence:
          $ref: "#/components/schemas/PersonAgreementOfCoexistence"
      required:
        - data
        - agreementOfCoexistence
    PersonDocument:
      allOf:
        - $ref: "#/components/schemas/Document"
        - type: object
          properties: {}
          required:
            - createdAt
    PersonAgreementOfCoexistence:
      type:
        - object
        - "null"
      properties:
        aocId:
          type: string
          format: uuid
        slug:
          type:
            - string
            - "null"
        version:
          type: string
        residencyType:
          type: string
        effectiveDate:
          type: string
          format: date-time
        terminationDate:
          type:
            - string
            - "null"
          format: date-time
        templatePdfUrl:
          type:
            - string
            - "null"
          format: uri
          description: Unsigned template PDF for this agreement version.
        signedDocumentId:
          type:
            - string
            - "null"
          format: uuid
        signedDocumentUrl:
          type:
            - string
            - "null"
          format: uri
          description: Signed Agreement of Coexistence for the active residency. Null until that residency has a canonically identified signed document; historical or unassociated legacy agreements are not substituted.
      required:
        - aocId
        - slug
        - version
        - residencyType
        - effectiveDate
        - terminationDate
        - templatePdfUrl
        - signedDocumentId
        - signedDocumentUrl
    TaxSubject:
      type: object
      properties:
        type:
          type: string
          enum:
            - natural_person
            - legal_entity
        id:
          type: string
          format: uuid
        name:
          type: string
        residentPermitNumber:
          type:
            - string
            - "null"
          pattern: ^[89]\d{13}$
          description: 14-digit Resident Permit Number.
      required:
        - type
        - id
        - name
        - residentPermitNumber
    TaxFiling:
      type: object
      properties:
        id:
          type: string
          format: uuid
        subject:
          $ref: "#/components/schemas/TaxSubject"
        type:
          type: string
          enum:
            - income
            - vat
        period:
          type: object
          properties:
            year:
              type: integer
            quarter:
              type:
                - integer
                - "null"
              minimum: 1
              maximum: 4
          required:
            - year
            - quarter
        submittedAt:
          type: string
          format: date-time
        amended:
          type: boolean
        currency:
          type: string
          enum:
            - usd
            - btc
        accountingMethod:
          type:
            - string
            - "null"
        reported:
          type: object
          properties:
            grossIncome:
              type:
                - string
                - "null"
            taxCredit:
              type:
                - string
                - "null"
            taxWithheld:
              type:
                - string
                - "null"
          required:
            - grossIncome
            - taxCredit
            - taxWithheld
        usdEquivalent:
          type:
            - object
            - "null"
          properties:
            grossIncome:
              type:
                - string
                - "null"
            taxCredit:
              type:
                - string
                - "null"
            taxWithheld:
              type:
                - string
                - "null"
          required:
            - grossIncome
            - taxCredit
            - taxWithheld
        taxLiability:
          type:
            - string
            - "null"
        exchangeRate:
          type:
            - object
            - "null"
          properties:
            btcUsdRate:
              type:
                - string
                - "null"
            capturedAt:
              type:
                - string
                - "null"
              format: date-time
            source:
              type:
                - string
                - "null"
          required:
            - btcUsdRate
            - capturedAt
            - source
        invoice:
          type:
            - object
            - "null"
          properties:
            id:
              type: string
              format: uuid
            status:
              type: string
          required:
            - id
            - status
        availableDocuments:
          type: array
          items:
            type: string
            enum:
              - assessment
              - return
      required:
        - id
        - subject
        - type
        - period
        - submittedAt
        - amended
        - currency
        - accountingMethod
        - reported
        - usdEquivalent
        - taxLiability
        - exchangeRate
        - invoice
        - availableDocuments
    ReferralListResponse:
      type: object
      properties:
        code:
          type: string
        naturalPersons:
          type: array
          items:
            type: object
            properties:
              fullName:
                type:
                  - string
                  - "null"
              referredAt:
                type: string
                format: date-time
            required:
              - fullName
              - referredAt
        legalEntities:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              rpn:
                type: string
                pattern: ^[89]\d{13}$
                description: 14-digit Resident Permit Number.
              referredAt:
                type:
                  - string
                  - "null"
                format: date-time
            required:
              - name
              - rpn
              - referredAt
      required:
        - code
        - naturalPersons
        - legalEntities
    CreateVisitorPassResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          type: object
          properties:
            ok:
              type: boolean
              enum:
                - true
          required:
            - ok
      required:
        - success
        - data
    CreateVisitorPassRequest:
      type: object
      properties:
        firstName:
          type: string
          minLength: 1
        lastName:
          type: string
          minLength: 1
        dateOfBirth:
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}$
        email:
          type: string
          maxLength: 320
          format: email
        signature:
          type: string
          minLength: 1
        consentToBackgroundCheck:
          type: boolean
        referralSource:
          type: string
          minLength: 1
        turnstileToken:
          type: string
          minLength: 1
          maxLength: 2048
          description: Single-use Cloudflare Turnstile token for action visitor-pass from an approved hostname. Expires after five minutes.
      required:
        - firstName
        - lastName
        - dateOfBirth
        - email
        - signature
        - consentToBackgroundCheck
        - referralSource
        - turnstileToken
    VatFiling:
      type: object
      properties:
        id:
          type: string
          format: uuid
        subject:
          type: object
          properties:
            type:
              type: string
              enum:
                - natural_person
                - legal_entity
            id:
              type: string
              format: uuid
            name:
              type: string
            residentPermitNumber:
              type:
                - string
                - "null"
              pattern: ^[89]\d{13}$
              description: 14-digit Resident Permit Number.
          required:
            - type
            - id
            - name
            - residentPermitNumber
        period:
          type: object
          properties:
            year:
              type: integer
            quarter:
              type: integer
              minimum: 1
              maximum: 4
          required:
            - year
            - quarter
        status:
          type: string
          enum:
            - draft
            - submitted
        revision:
          type: string
          pattern: ^[a-f0-9]{64}$
        currency:
          type: string
          enum:
            - usd
        accountingMethod:
          type:
            - string
            - "null"
        reported:
          type: object
          properties:
            grossIncome:
              type:
                - string
                - "null"
            taxCredit:
              type:
                - string
                - "null"
            taxWithheld:
              type:
                - string
                - "null"
          required:
            - grossIncome
            - taxCredit
            - taxWithheld
        taxLiability:
          type:
            - string
            - "null"
        readyToSubmit:
          type: boolean
          description: Figures and payment are ready; permissions, period eligibility, and declaration are rechecked on submission.
        creditReviewRequired:
          type: boolean
        creditReviewStatus:
          type:
            - string
            - "null"
        paymentRequired:
          type: boolean
        invoice:
          type:
            - object
            - "null"
          properties:
            id:
              type: string
              format: uuid
            status:
              type: string
          required:
            - id
            - status
        submittedAt:
          type:
            - string
            - "null"
          format: date-time
        links:
          type: object
          properties:
            portal:
              type: string
            assessment:
              type:
                - string
                - "null"
          required:
            - portal
            - assessment
      required:
        - id
        - subject
        - period
        - status
        - revision
        - currency
        - accountingMethod
        - reported
        - taxLiability
        - readyToSubmit
        - creditReviewRequired
        - creditReviewStatus
        - paymentRequired
        - invoice
        - submittedAt
        - links
    OpenidConfiguration:
      type: object
      properties:
        issuer:
          type: string
          format: uri
        authorization_endpoint:
          type: string
          format: uri
        device_authorization_endpoint:
          type: string
          format: uri
        token_endpoint:
          type: string
          format: uri
        userinfo_endpoint:
          type: string
          format: uri
        jwks_uri:
          type: string
          format: uri
        registration_endpoint:
          type: string
          format: uri
        revocation_endpoint:
          type: string
          format: uri
        introspection_endpoint:
          type: string
          format: uri
        scopes_supported:
          type: array
          items:
            type: string
        response_types_supported:
          type: array
          items:
            type: string
        grant_types_supported:
          type: array
          items:
            type: string
        subject_types_supported:
          type: array
          items:
            type: string
        id_token_signing_alg_values_supported:
          type: array
          items:
            type: string
        token_endpoint_auth_methods_supported:
          type: array
          items:
            type: string
        claims_supported:
          type: array
          items:
            type: string
        code_challenge_methods_supported:
          type: array
          items:
            type: string
        service_documentation:
          type: string
          format: uri
      required:
        - issuer
        - authorization_endpoint
        - device_authorization_endpoint
        - token_endpoint
        - userinfo_endpoint
        - jwks_uri
        - revocation_endpoint
        - introspection_endpoint
        - scopes_supported
        - response_types_supported
        - grant_types_supported
        - subject_types_supported
        - id_token_signing_alg_values_supported
        - token_endpoint_auth_methods_supported
        - claims_supported
        - code_challenge_methods_supported
        - service_documentation
      additionalProperties: {}
    JsonWebKeySet:
      type: object
      properties:
        keys:
          type: array
          items:
            type: object
            properties:
              kty:
                type: string
              use:
                type: string
              kid:
                type: string
              alg:
                type: string
              n:
                type: string
              e:
                type: string
            required:
              - kty
              - kid
            additionalProperties: {}
      required:
        - keys
    OAuthDeviceAuthorizationResponse:
      type: object
      properties:
        device_code:
          type: string
        user_code:
          type: string
        verification_uri:
          type: string
          format: uri
        verification_uri_complete:
          type: string
          format: uri
        expires_in:
          type: integer
          exclusiveMinimum: 0
        interval:
          type: integer
          exclusiveMinimum: 0
      required:
        - device_code
        - user_code
        - verification_uri
        - verification_uri_complete
        - expires_in
        - interval
    OAuthTokenResponse:
      type: object
      properties:
        access_token:
          type: string
        token_type:
          type: string
          enum:
            - Bearer
        expires_in:
          type: integer
          exclusiveMinimum: 0
        refresh_token:
          type: string
        id_token:
          type: string
        scope:
          type: string
      required:
        - access_token
        - token_type
        - expires_in
    OAuthTokenRequest:
      oneOf:
        - type: object
          properties:
            grant_type:
              type: string
              enum:
                - authorization_code
            code:
              type: string
            redirect_uri:
              type: string
              format: uri
            code_verifier:
              type: string
            client_id:
              type: string
              description: Required with client_secret_post; omit when using HTTP Basic.
            client_secret:
              type: string
              description: Required with client_secret_post; omit when using HTTP Basic.
          required:
            - grant_type
            - code
            - redirect_uri
        - type: object
          properties:
            grant_type:
              type: string
              enum:
                - refresh_token
            refresh_token:
              type: string
            scope:
              type: string
            client_id:
              type: string
              description: Required with client_secret_post; omit when using HTTP Basic.
            client_secret:
              type: string
              description: Required with client_secret_post; omit when using HTTP Basic.
          required:
            - grant_type
            - refresh_token
        - type: object
          properties:
            grant_type:
              type: string
              enum:
                - urn:ietf:params:oauth:grant-type:device_code
            device_code:
              type: string
            client_id:
              type: string
              description: Public client identifier; no client secret is sent.
          required:
            - grant_type
            - device_code
            - client_id
    OAuthUserinfo:
      type: object
      properties:
        sub:
          type: string
        name:
          type: string
        given_name:
          type: string
        family_name:
          type: string
        picture:
          type: string
          format: uri
        email:
          type: string
          format: email
        email_verified:
          type: boolean
      required:
        - sub
      additionalProperties: {}
    OAuthIntrospectionResponse:
      type: object
      properties:
        active:
          type: boolean
        scope:
          type: string
        client_id:
          type: string
        username:
          type: string
        token_type:
          type: string
        exp:
          type: integer
        iat:
          type: integer
        sub:
          type: string
        aud:
          anyOf:
            - type: string
            - type: array
              items:
                type: string
        iss:
          type: string
      required:
        - active
      additionalProperties: {}
    LegacyCouponPaymentRequest:
      type: object
      properties:
        couponCode:
          type: string
          minLength: 1
      required:
        - couponCode
  parameters: {}
paths:
  /api/v1/verify_rpn:
    post:
      operationId: verifyRpn
      tags:
        - Verification
      summary: Verify whether an RPN exists and is active
      description: |-
        Look up a Resident Permit Number and report whether it belongs to a
        legal entity, a natural person, or is unknown — and whether the
        resident currently has an active residency.

        Rate-limited to 5,000 requests per 24 hours and 50 per minute, per
        API key. Exceeding either bound returns `429`.

        Accepts standard API keys (`sk-`) and Agent Keys (`ak-`) holding the
        `agent:verify_rpn` scope.
      security:
        - standardApiKey: []
        - agentKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/VerifyRpnRequest"
      responses:
        "200":
          description: Lookup result.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VerifyRpnResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-verify-rpn
      x-sidebar-title: Verify RPN
  /api/v1/registries/legal_entities/search:
    post:
      operationId: searchLegalEntities
      tags:
        - Legal entities
      summary: Search the legal-entity registry
      description: |-
        Performs a case-insensitive name search and partial RPN match. Accepts standard and appropriately scoped Agent Keys.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchLegalEntitiesRequest"
      responses:
        "200":
          description: Matching legal entities.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchLegalEntitiesResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-search-entities
      x-sidebar-title: Search registry
  /api/v1/registries/legal_entities/name_availability:
    post:
      operationId: checkLegalEntityNameAvailability
      tags:
        - Legal entities
      summary: Check legal-entity name availability
      description: |-
        Checks for an existing registered name using the same case-insensitive exact-name and entity-option rule as incorporation. Send the name without its legal extension and an optionId (for example llc). Accepts a Standard Key or an Agent Key with agent:registry.search. This read-only check does not reserve a name or guarantee approval; drafts are not reservations, and the check is repeated during incorporation.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 200
                optionId:
                  type: string
                  enum:
                    - llc
                    - for_profit_corp
                    - statutory_trust
                    - foreign_entity_registration
                    - non_profit_corp
              required:
                - name
                - optionId
              additionalProperties: false
      responses:
        "200":
          description: Preliminary name availability; reserved is always false.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      name:
                        type: string
                      optionId:
                        type: string
                        enum:
                          - llc
                          - for_profit_corp
                          - statutory_trust
                          - foreign_entity_registration
                          - non_profit_corp
                      available:
                        type: boolean
                      reserved:
                        type: boolean
                        enum:
                          - false
                    required:
                      - name
                      - optionId
                      - available
                      - reserved
                required:
                  - data
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-legal-entity-name-availability
      x-sidebar-title: Check name availability
  /api/v1/legal_entities/{id}:
    get:
      operationId: getLegalEntity
      tags:
        - Legal entities
      summary: Get a legal entity
      description: |-
        Returns entity identifiers, registration and residency status, jurisdiction, principal office, and the current registered agent with office and mailing addresses. Requires current representation; Agent Keys are additionally restricted to entities created through the Agent API. The UUID id and 14-digit residentPermitNumber are distinct identifiers; no separate registration number is issued by this endpoint.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      responses:
        "200":
          description: Legal-entity record.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/LegalEntityDetails"
                required:
                  - data
                description: Successful response.
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: get-legal-entities-id
      x-sidebar-title: Get by ID
  /api/v1/legal_entities/{id}/documents:
    get:
      operationId: getLegalEntityDocuments
      tags:
        - Legal entities
      summary: List documents for a legal entity
      description: Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      responses:
        "200":
          description: Documents for the legal entity.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/Document"
                required:
                  - data
                description: Successful response.
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: get-legal-entities-id-documents
      x-sidebar-title: Get documents
  /api/v1/legal_entities/{id}/amendments:
    get:
      operationId: listLegalEntityAmendments
      tags:
        - Entity filings
      summary: List amendment filings for a legal entity
      description: |-
        Returns every amendment filing (name and principal office changes) for the entity, newest first. Standard keys act on every entity the key owner actively represents. Agent Keys are limited to entities incorporated through the API and need active representation and the listed `agent:entity.filing.*` scope. Agent writes also require an active Manifestation of Will. OAuth tokens and Partner Keys cannot call these filing endpoints. See https://docs.eprospera.com/entity-filings for signing, payment, and recovery. Agent scope: `agent:entity.filing.read`.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      responses:
        "200":
          description: Amendment filings for the entity.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/AmendmentFiling"
                required:
                  - data
                description: Successful response.
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: get-legal-entities-id-amendments
      x-sidebar-title: List amendments
    post:
      operationId: createLegalEntityAmendment
      tags:
        - Entity filings
      summary: Create an amendment filing
      description: |-
        Creates the entity's open amendment draft, or reuses the existing Draft, and replaces all proposals; omitted fields are cleared. The response includes `nextSteps.signatureUrl`: an active representative must sign the amendment in the portal before it can be paid. Returns 409 with code invalid_principal_office when a PES customer proposes an address other than the PES office. Returns 409 while another amendment is pending review or a signed filing is awaiting payment. Standard keys act on every entity the key owner actively represents. Agent Keys are limited to entities incorporated through the API and need active representation and the listed `agent:entity.filing.*` scope. Agent writes also require an active Manifestation of Will. OAuth tokens and Partner Keys cannot call these filing endpoints. See https://docs.eprospera.com/entity-filings for signing, payment, and recovery. Agent scope: `agent:entity.filing.create`.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AmendmentChangesRequest"
      responses:
        "200":
          description: Amendment draft with next steps.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AmendmentFilingResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-legal-entities-id-amendments
      x-sidebar-title: Create amendment
  /api/v1/legal_entities/{id}/amendments/{filingId}:
    get:
      operationId: getLegalEntityAmendment
      tags:
        - Entity filings
      summary: Get an amendment filing
      description: |-
        Poll this endpoint after submission; terminal states are `Approved` and `Rejected`. Approved amendments add a Certificate of Amendment to the entity documents. Standard keys act on every entity the key owner actively represents. Agent Keys are limited to entities incorporated through the API and need active representation and the listed `agent:entity.filing.*` scope. Agent writes also require an active Manifestation of Will. OAuth tokens and Partner Keys cannot call these filing endpoints. See https://docs.eprospera.com/entity-filings for signing, payment, and recovery. Agent scope: `agent:entity.filing.read`.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
        - schema:
            type: string
            format: uuid
            example: 0f1b4a2c-9d4e-4f7a-8c6b-2e3d5a7f9b1c
          required: true
          name: filingId
          in: path
      responses:
        "200":
          description: Amendment filing.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/AmendmentFiling"
                required:
                  - data
                description: Successful response.
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: get-legal-entities-id-amendments-filing-id
      x-sidebar-title: Get amendment
    patch:
      operationId: updateLegalEntityAmendment
      tags:
        - Entity filings
      summary: Update proposed changes on a Draft amendment
      description: |-
        Only `Draft` filings can be changed. Omitted fields are preserved; null clears a proposal. A revision invalidates the previous signature. PES customers must retain the PES office address; other address proposals return 409 with code invalid_principal_office. Invoiced and submitted filings are read-only. Standard keys act on every entity the key owner actively represents. Agent Keys are limited to entities incorporated through the API and need active representation and the listed `agent:entity.filing.*` scope. Agent writes also require an active Manifestation of Will. OAuth tokens and Partner Keys cannot call these filing endpoints. See https://docs.eprospera.com/entity-filings for signing, payment, and recovery. Agent scope: `agent:entity.filing.create`.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
        - schema:
            type: string
            format: uuid
            example: 0f1b4a2c-9d4e-4f7a-8c6b-2e3d5a7f9b1c
          required: true
          name: filingId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AmendmentPatchRequest"
      responses:
        "200":
          description: Updated amendment draft.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AmendmentFilingResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: patch-legal-entities-id-amendments-filing-id
      x-sidebar-title: Update amendment
  /api/v1/legal_entities/{id}/amendments/{filingId}/pay/voucher:
    post:
      operationId: payLegalEntityAmendmentWithVoucher
      tags:
        - Entity filings
      summary: Pay an amendment filing with a voucher
      description: |-
        The filing must be signed first (see `nextSteps.signatureUrl`). Creates the filing invoice when needed, applies the voucher, and submits the amendment for review when the voucher covers the full amount. Invoice preparation happens before voucher validation, so an invalid voucher can leave a locked Pending Payment filing with an unpaid invoice. Read state before retrying after errors/timeouts. Standard keys act on every entity the key owner actively represents. Agent Keys are limited to entities incorporated through the API and need active representation and the listed `agent:entity.filing.*` scope. Agent writes also require an active Manifestation of Will. OAuth tokens and Partner Keys cannot call these filing endpoints. See https://docs.eprospera.com/entity-filings for signing, payment, and recovery. Agent scope: `agent:entity.filing.pay`.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
        - schema:
            type: string
            format: uuid
            example: 0f1b4a2c-9d4e-4f7a-8c6b-2e3d5a7f9b1c
          required: true
          name: filingId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/VoucherPaymentRequest"
      responses:
        "200":
          description: Voucher applied and amendment submitted.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AmendmentPaymentResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "503":
          description: Submission saved, but review dispatch is pending. Retry submit or poll the filing; do not create another filing.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                    enum:
                      - submission_not_queued
                  filingId:
                    type: string
                    format: uuid
                  invoiceId:
                    type: string
                    format: uuid
                required:
                  - error
                  - code
      x-docs-slug: post-legal-entities-id-amendments-filing-id-pay-voucher
      x-sidebar-title: Pay amendment with voucher
  /api/v1/legal_entities/{id}/amendments/{filingId}/submit:
    post:
      operationId: submitLegalEntityAmendment
      tags:
        - Entity filings
      summary: Submit a paid amendment filing for review
      description: |-
        Use when the invoice was paid outside the voucher endpoint, for example by card in the portal. For the first submission, require `nextSteps.submitReady === true`: a signed, paid, unsubmitted filing in `Pending Payment`. Repeating a submission returns its current state; a pending dispatch is retried without changing the original submission time. Standard keys act on every entity the key owner actively represents. Agent Keys are limited to entities incorporated through the API and need active representation and the listed `agent:entity.filing.*` scope. Agent writes also require an active Manifestation of Will. OAuth tokens and Partner Keys cannot call these filing endpoints. See https://docs.eprospera.com/entity-filings for signing, payment, and recovery. Agent scope: `agent:entity.filing.pay`.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
        - schema:
            type: string
            format: uuid
            example: 0f1b4a2c-9d4e-4f7a-8c6b-2e3d5a7f9b1c
          required: true
          name: filingId
          in: path
      responses:
        "200":
          description: Amendment submitted for review.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AmendmentPaymentResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "402":
          description: Invoice must be paid before submission.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                    enum:
                      - invoice_not_paid
                required:
                  - error
                  - code
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "503":
          description: Submission saved, but review dispatch is pending. Retry submit or poll the filing; do not create another filing.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                    enum:
                      - submission_not_queued
                  filingId:
                    type: string
                    format: uuid
                  invoiceId:
                    type: string
                    format: uuid
                required:
                  - error
                  - code
      x-docs-slug: post-legal-entities-id-amendments-filing-id-submit
      x-sidebar-title: Submit amendment
  /api/v1/legal_entities/{id}/certificate_requests:
    get:
      operationId: listLegalEntityCertificateRequests
      tags:
        - Entity filings
      summary: List Certificate of Good Standing requests
      description: |-
        Returns the entity's certificate requests, newest first, plus current eligibility. Only LLCs and for-profit corporations with an active residency and no dissolution are eligible. Standard keys act on every entity the key owner actively represents. Agent Keys are limited to entities incorporated through the API and need active representation and the listed `agent:entity.filing.*` scope. Agent writes also require an active Manifestation of Will. OAuth tokens and Partner Keys cannot call these filing endpoints. See https://docs.eprospera.com/entity-filings for signing, payment, and recovery. Agent scope: `agent:entity.filing.read`.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      responses:
        "200":
          description: Certificate requests and eligibility.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CertificateRequestListResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: get-legal-entities-id-certificate-requests
      x-sidebar-title: List certificate requests
    post:
      operationId: createLegalEntityCertificateRequest
      tags:
        - Entity filings
      summary: Request a Certificate of Good Standing
      description: |-
        Creates a request and its invoice, or returns the entity's existing open or issued request. Reuse after review or issuance does not re-check current tax eligibility. Pay the invoice with a voucher, or in the portal, to have the certificate issued. Tax-current entities are issued automatically after payment; contested requests go to admin review. Returns 409 with code `certificate.tax_overdue` when overdue taxes block the request and no contest was supplied. Standard keys act on every entity the key owner actively represents. Agent Keys are limited to entities incorporated through the API and need active representation and the listed `agent:entity.filing.*` scope. Agent writes also require an active Manifestation of Will. OAuth tokens and Partner Keys cannot call these filing endpoints. See https://docs.eprospera.com/entity-filings for signing, payment, and recovery. Agent scope: `agent:entity.filing.create`.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CertificateRequestBody"
      responses:
        "200":
          description: Certificate request with next steps.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CertificateRequestResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-legal-entities-id-certificate-requests
      x-sidebar-title: Request good standing certificate
  /api/v1/legal_entities/{id}/certificate_requests/{requestId}:
    get:
      operationId: getLegalEntityCertificateRequest
      tags:
        - Entity filings
      summary: Get a Certificate of Good Standing request
      description: |-
        Poll until `statusId` is `Issued`, `Rejected`, or `Cancelled`, then stop. Only `Issued` provides the certificate PDF at `documentUrl`, also listed in the entity documents. For `Rejected`, show `rejectionReason`; cancellation or rejection is terminal and must not trigger automatic repayment. Standard keys act on every entity the key owner actively represents. Agent Keys are limited to entities incorporated through the API and need active representation and the listed `agent:entity.filing.*` scope. Agent writes also require an active Manifestation of Will. OAuth tokens and Partner Keys cannot call these filing endpoints. See https://docs.eprospera.com/entity-filings for signing, payment, and recovery. Agent scope: `agent:entity.filing.read`.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
        - schema:
            type: string
            format: uuid
            example: 6c2f8e1a-3b7d-4c9e-a5f1-8d2b4e6c0a3f
          required: true
          name: requestId
          in: path
      responses:
        "200":
          description: Certificate request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/CertificateRequest"
                required:
                  - data
                description: Successful response.
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: get-legal-entities-id-certificate-requests-request-id
      x-sidebar-title: Get certificate request
  /api/v1/legal_entities/{id}/certificate_requests/{requestId}/pay/voucher:
    post:
      operationId: payLegalEntityCertificateRequestWithVoucher
      tags:
        - Entity filings
      summary: Pay a Certificate of Good Standing request with a voucher
      description: |-
        Applies the voucher to the request invoice. Entity eligibility and tax compliance are rechecked before payment, including existing invoices. Overdue filings require a saved dispute note and proof; unknown compliance blocks payment. Failures return 400 without redeeming the voucher. Issuance runs asynchronously after payment. Poll until `statusId` is `Issued`, `Rejected`, or `Cancelled`, then stop. A certificate `documentUrl` is available only for `Issued`; rejected or cancelled requests must not trigger automatic repayment. Standard keys act on every entity the key owner actively represents. Agent Keys are limited to entities incorporated through the API and need active representation and the listed `agent:entity.filing.*` scope. Agent writes also require an active Manifestation of Will. OAuth tokens and Partner Keys cannot call these filing endpoints. See https://docs.eprospera.com/entity-filings for signing, payment, and recovery. Agent scope: `agent:entity.filing.pay`.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
        - schema:
            type: string
            format: uuid
            example: 6c2f8e1a-3b7d-4c9e-a5f1-8d2b4e6c0a3f
          required: true
          name: requestId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/VoucherPaymentRequest"
      responses:
        "200":
          description: Voucher applied.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CertificatePaymentResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-legal-entities-id-certificate-requests-request-id-pay-voucher
      x-sidebar-title: Pay certificate with voucher
  /api/v1/legal_entity_applications:
    get:
      operationId: listLegalEntityApplications
      tags:
        - Legal-entity applications
      summary: List legal-entity applications
      description: Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      responses:
        "200":
          description: Applications visible to the caller.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/LegalEntityApplication"
                required:
                  - data
                description: Successful response.
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: get-legal-entity-applications
      x-sidebar-title: List
    post:
      operationId: createLegalEntityApplication
      tags:
        - Legal-entity applications
      summary: Create a legal-entity application
      description: |-
        For PES registered-agent customers, the principal office is set to the PES registered office from the provider record, including when PES is selected by permit number.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateLegalEntityApplicationRequest"
      responses:
        "200":
          description: Created application and next steps.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateLegalEntityApplicationResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-legal-entity-applications
      x-sidebar-title: Create
  /api/v1/legal_entity_applications/{id}:
    get:
      operationId: getLegalEntityApplication
      tags:
        - Legal-entity applications
      summary: Get a legal-entity application
      description: Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      responses:
        "200":
          description: Application record.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/LegalEntityApplication"
                required:
                  - data
                description: Successful response.
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: get-legal-entity-applications-id
      x-sidebar-title: Get
  /api/v1/legal_entity_applications/{id}/pay/voucher:
    post:
      operationId: payLegalEntityApplicationWithVoucher
      tags:
        - Legal-entity applications
      summary: Pay a legal-entity application with a voucher
      description: Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
        - agentKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/VoucherPaymentRequest"
      responses:
        "200":
          description: Voucher applied.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaymentResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-legal-entity-applications-id-pay-voucher
      x-sidebar-title: Pay with voucher
  /api/v1/legal_entity_applications/{id}/checkout_session:
    post:
      operationId: createLegalEntityApplicationCheckout
      tags:
        - Legal-entity applications
      summary: Create a hosted checkout session
      description: |-
        Returns 409 with code payment_in_progress while an existing payment is being checked. Poll the application payment state before requesting another checkout.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CheckoutRequest"
      responses:
        "200":
          description: Checkout session.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CheckoutResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: "An existing payment is in progress; code: payment_in_progress."
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                    enum:
                      - payment_in_progress
                required:
                  - error
                  - code
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-legal-entity-applications-id-checkout-session
      x-sidebar-title: Hosted checkout
  /api/v1/partner/residency_applications:
    get:
      operationId: listPartnerResidencyApplications
      tags:
        - Partner residency applications
      summary: List partner residency applications
      security:
        - partnerKey: []
      parameters:
        - schema:
            type: integer
            minimum: 1
            maximum: 100
            example: 50
          required: false
          name: limit
          in: query
        - schema:
            type: string
            format: uuid
          required: false
          name: cursor
          in: query
      responses:
        "200":
          description: Applications owned by this Partner Integration.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/PartnerResidencyApplication"
                  pagination:
                    type: object
                    properties:
                      limit:
                        type: integer
                        minimum: 1
                        maximum: 100
                      nextCursor:
                        type:
                          - string
                          - "null"
                        format: uuid
                    required:
                      - limit
                      - nextCursor
                required:
                  - data
                  - pagination
        "400":
          description: "`Invalid pagination parameters`: `limit` must be 1-100 and `cursor` a UUID."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Partner Key lacks the required partner scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Partner API rate limit exceeded.
          headers:
            Retry-After:
              required: true
              description: Seconds until the partner client should retry.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: get-residency-applications
      x-sidebar-title: List applications
    post:
      operationId: createPartnerResidencyApplication
      tags:
        - Partner residency applications
      summary: Create a partner residency application
      description: Creates a Draft owned by your integration and, for an applicant without an existing eProspera password, emails a single-use 24-hour account-claim link. Requires `Idempotency-Key`.
      security:
        - partnerKey: []
      parameters:
        - schema:
            type: string
            minLength: 8
            maxLength: 128
            pattern: ^[A-Za-z0-9_.~-]+$
            description: "8-128 URL-safe characters. Retained for 24 hours per integration and route. An identical retry replays the stored response with `Idempotency-Replayed: true`; a different body under the same key returns 409."
          required: true
          description: "8-128 URL-safe characters. Retained for 24 hours per integration and route. An identical retry replays the stored response with `Idempotency-Replayed: true`; a different body under the same key returns 409."
          name: Idempotency-Key
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreatePartnerResidencyApplicationRequest"
      responses:
        "200":
          description: Application created.
          headers:
            Idempotency-Replayed:
              required: false
              description: Present with value `true` when this response was replayed from an earlier identical request.
              schema:
                type: string
                enum:
                  - "true"
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/PartnerResidencyApplication"
                required:
                  - data
                description: Successful response.
        "400":
          description: Invalid JSON or request body (`details` lists Zod issues), `redirectUrl` origin not approved for this integration, unknown ISO 3166-1 alpha-2 country code, missing or malformed `Idempotency-Key`, unknown referral code, or self-referral.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Partner Key lacks the required partner scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: "The applicant already has equivalent or higher residency rights, another application is in progress, or residency eligibility changed. Active residents may only upgrade; contact support for other changes. Renewals use billing, not a new application. Payment and voucher eligibility conflicts use code: residency_purchase_ineligible. `Idempotency-Key` reused with a different body or still processing, applicant identity requires manual account linking, or the applicant is already attributed to another referral code."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Partner API rate limit exceeded.
          headers:
            Retry-After:
              required: true
              description: Seconds until the partner client should retry.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-residency-applications
      x-sidebar-title: Create application
  /api/v1/partner/residency_applications/{id}:
    get:
      operationId: getPartnerResidencyApplication
      tags:
        - Partner residency applications
      summary: Get a partner residency application
      security:
        - partnerKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      responses:
        "200":
          description: Application record.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/PartnerResidencyApplication"
                required:
                  - data
                description: Successful response.
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Partner Key lacks the required partner scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Partner API rate limit exceeded.
          headers:
            Retry-After:
              required: true
              description: Seconds until the partner client should retry.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: get-residency-applications-id
      x-sidebar-title: Get application
    patch:
      operationId: updatePartnerResidencyApplication
      tags:
        - Partner residency applications
      summary: Update a draft partner residency application
      description: Replaces the application data of a Draft. Requires the latest `version` as `expectedVersion`. Any change to `applicationData` invalidates the current agreement acceptance and returns a fresh `nextSteps.agreementUrl`. Once the invoice is paid, `residencyType` and the applicant email are locked. Changing the applicant email sends a new claim email to the new address.
      security:
        - partnerKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdatePartnerResidencyApplicationRequest"
      responses:
        "200":
          description: Updated application.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/PartnerResidencyApplication"
                required:
                  - data
                description: Successful response.
        "400":
          description: Invalid JSON or request body, application not in Draft, `redirectUrl` origin not approved, unknown country code, residency type or applicant email changed after payment, or a referral-code error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Partner Key lacks the required partner scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Application not found or owned by another integration, or `proofOfAddressUploadId` does not belong to this application.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: "The applicant already has equivalent or higher residency rights, another application is in progress, or residency eligibility changed. Active residents may only upgrade; contact support for other changes. Renewals use billing, not a new application. Payment and voucher eligibility conflicts use code: residency_purchase_ineligible. Stale `expectedVersion`; the body carries `currentVersion`. Also returned for applicant identity or referral-code conflicts."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Partner API rate limit exceeded.
          headers:
            Retry-After:
              required: true
              description: Seconds until the partner client should retry.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: patch-residency-applications-id
      x-sidebar-title: Update application
  /api/v1/partner/residency_applications/{id}/documents:
    get:
      operationId: getPartnerResidencyApplicationDocuments
      tags:
        - Partner residency applications
      summary: Get agreement documents for a partner residency application
      description: Returns the Agreement of Coexistence the applicant accepted for this application, including the template PDF for that version, and, once the residency exists, its signed agreement and the applicant’s policy documents. Signed agreements must match this application’s residency ID; agreements for other residencies, identity-verification artifacts, and tax documents are never returned. Requires `partner:person.application.read`.
      security:
        - partnerKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      responses:
        "200":
          description: Agreement documents for the application.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PartnerApplicationDocumentsResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Partner Key lacks the required partner scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Partner API rate limit exceeded.
          headers:
            Retry-After:
              required: true
              description: Seconds until the partner client should retry.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: get-residency-applications-id-documents
      x-sidebar-title: Get agreement documents
  /api/v1/uploads/proof_of_address:
    post:
      operationId: uploadProofOfAddress
      tags:
        - Partner residency applications
      summary: Upload proof of address
      description: Multipart upload of a PDF, JPEG, or PNG up to 4.5 MB for a Draft owned by your integration. The declared MIME type must match the file bytes. The response carries an opaque `id` to attach through PATCH as `proofOfAddressUploadId`; no URL is returned.
      security:
        - partnerKey: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                applicationId:
                  type: string
                  format: uuid
                file:
                  type: string
                  format: binary
              required:
                - applicationId
                - file
      responses:
        "200":
          description: Upload metadata.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      applicationId:
                        type: string
                        format: uuid
                      contentType:
                        type: string
                      size:
                        type: integer
                        minimum: 0
                    required:
                      - id
                      - applicationId
                      - contentType
                      - size
                required:
                  - data
                description: Successful response.
        "400":
          description: "`applicationId is required`, `No file provided`, `Unsupported file type. Only PDF, JPEG, and PNG files are allowed.`, or `File size exceeds 4.5MB limit`."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Partner Key lacks the required partner scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "413":
          description: Request body exceeds the 4.5 MB upload limit.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Partner API rate limit exceeded.
          headers:
            Retry-After:
              required: true
              description: Seconds until the partner client should retry.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-uploads-proof-of-address
      x-sidebar-title: Upload proof of address
  /api/v1/uploads/proof_of_address/{id}:
    get:
      operationId: downloadProofOfAddress
      tags:
        - Partner residency applications
      summary: Download proof of address
      security:
        - partnerKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      responses:
        "200":
          description: Proof-of-address file returned through an authenticated endpoint.
          headers:
            Content-Disposition:
              description: Always `inline` with a generated filename.
              schema:
                type: string
            Cache-Control:
              description: Always `private, no-store`.
              schema:
                type: string
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Partner Key lacks the required partner scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Partner API rate limit exceeded.
          headers:
            Retry-After:
              required: true
              description: Seconds until the partner client should retry.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: get-uploads-proof-of-address-id
      x-sidebar-title: Download proof of address
  /api/v1/partner/residency_applications/{id}/checkout_session:
    post:
      operationId: createPartnerResidencyApplicationCheckout
      tags:
        - Partner residency applications
      summary: Create a partner hosted-checkout session
      description: "Creates a hosted checkout for the application invoice. Send exactly one of `paymentProvider` or `paymentMethod`. `redirectUrl` must use an approved redirect origin; Stripe returns the payer to `redirectUrl?success=true` on success and to `redirectUrl` on cancel. The response is `{ data: { url }, invoiceId }`. Payment is confirmed asynchronously: poll the application until `nextSteps.paymentRequired` is false. Requires `Idempotency-Key`."
      security:
        - partnerKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
        - schema:
            type: string
            minLength: 8
            maxLength: 128
            pattern: ^[A-Za-z0-9_.~-]+$
            description: "8-128 URL-safe characters. Retained for 24 hours per integration and route. An identical retry replays the stored response with `Idempotency-Replayed: true`; a different body under the same key returns 409."
          required: true
          description: "8-128 URL-safe characters. Retained for 24 hours per integration and route. An identical retry replays the stored response with `Idempotency-Replayed: true`; a different body under the same key returns 409."
          name: Idempotency-Key
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PartnerCheckoutRequest"
      responses:
        "200":
          description: Checkout session.
          headers:
            Idempotency-Replayed:
              required: false
              description: Present with value `true` when this response was replayed from an earlier identical request.
              schema:
                type: string
                enum:
                  - "true"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CheckoutResponse"
        "400":
          description: Invalid request body, `redirectUrl` origin not approved, application not in Draft, `Please provide proof of address before continuing.`, `Residency application invoice is already paid`, `Residency application invoice is not open for payment`, or missing `Idempotency-Key`.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Partner Key lacks the required partner scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: "The applicant already has equivalent or higher residency rights, another application is in progress, or residency eligibility changed. Active residents may only upgrade; contact support for other changes. Renewals use billing, not a new application. Payment and voucher eligibility conflicts use code: residency_purchase_ineligible. `Idempotency-Key` reused with a different body or still processing, or `code: payment_in_progress` when an existing payment is being checked. Poll the application before retrying; do not create a competing payment."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Partner API rate limit exceeded.
          headers:
            Retry-After:
              required: true
              description: Seconds until the partner client should retry.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "503":
          description: "`Blink checkout is temporarily unavailable` with `code: blink_checkout_disabled` and `Retry-After: 120`."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-residency-applications-id-checkout-session
      x-sidebar-title: Hosted checkout
  /api/v1/partner/residency_applications/{id}/pay/voucher:
    post:
      operationId: payPartnerResidencyApplicationWithVoucher
      tags:
        - Partner residency applications
      summary: Pay a partner application with a voucher
      description: "Applies a voucher that must cover the full invoice. Returns the updated application with `nextSteps.paymentRequired` false. Voucher errors carry a machine-readable `code`: `voucher_not_found`, `voucher_expired`, `voucher_already_redeemed`, `voucher_not_applicable`, `voucher_not_full_coverage`, `invoice_not_found`. Requires `Idempotency-Key`."
      security:
        - partnerKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
        - schema:
            type: string
            minLength: 8
            maxLength: 128
            pattern: ^[A-Za-z0-9_.~-]+$
            description: "8-128 URL-safe characters. Retained for 24 hours per integration and route. An identical retry replays the stored response with `Idempotency-Replayed: true`; a different body under the same key returns 409."
          required: true
          description: "8-128 URL-safe characters. Retained for 24 hours per integration and route. An identical retry replays the stored response with `Idempotency-Replayed: true`; a different body under the same key returns 409."
          name: Idempotency-Key
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PartnerVoucherRequest"
      responses:
        "200":
          description: Voucher applied; the application is returned.
          headers:
            Idempotency-Replayed:
              required: false
              description: Present with value `true` when this response was replayed from an earlier identical request.
              schema:
                type: string
                enum:
                  - "true"
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/PartnerResidencyApplication"
                required:
                  - data
                description: Successful response.
        "400":
          description: Invalid request body, application not in Draft, proof of address missing, missing `Idempotency-Key`, or a voucher error (`voucher_not_found`, `voucher_expired`, `voucher_not_applicable`, `voucher_not_full_coverage`).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Partner Key lacks the required partner scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Application not found or owned by another integration, or `invoice_not_found`.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: "The applicant already has equivalent or higher residency rights, another application is in progress, or residency eligibility changed. Active residents may only upgrade; contact support for other changes. Renewals use billing, not a new application. Payment and voucher eligibility conflicts use code: residency_purchase_ineligible. `voucher_already_redeemed`, or `Idempotency-Key` reused with a different body."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Partner API rate limit exceeded.
          headers:
            Retry-After:
              required: true
              description: Seconds until the partner client should retry.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-residency-applications-id-pay-voucher
      x-sidebar-title: Pay with voucher
  /api/v1/partner/residency_applications/{id}/embed_sessions:
    post:
      operationId: createPartnerResidencyApplicationEmbedSession
      tags:
        - Partner residency applications
      summary: Create a secure agreement and KYC embed session
      description: "Requires `partner:person.embed_session.create`. The application must be partner-owned, complete except for agreement/KYC, and paid. The one-time URL is bound to the parent-held PKCE verifier and may only be framed by the selected allow-listed origin. Issuance is not idempotent: retrying this operation creates a replacement link and revokes any previously active embed session for the application."
      security:
        - partnerKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PartnerEmbedSessionRequest"
      responses:
        "201":
          description: Single-use embed session created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/PartnerEmbedSessionResponse"
                required:
                  - data
                description: Successful response.
        "400":
          description: Invalid request body, `parentOrigin is invalid.`, or `parentOrigin is not allowed for this integration.`
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: "`Insufficient permissions` (missing `partner:person.embed_session.create`) or `Partner integration is not active.`"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: The application is not ready for embed issuance, or its state changed concurrently.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Partner API rate limit exceeded.
          headers:
            Retry-After:
              required: true
              description: Seconds until the partner client should retry.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "503":
          description: Partner embed sessions are disabled in this environment.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-residency-applications-id-embed-sessions
      x-sidebar-title: Create embed session
  /api/v1/partner/residency_applications/{id}/submit:
    post:
      operationId: submitPartnerResidencyApplication
      tags:
        - Partner residency applications
      summary: Submit a partner residency application
      description: Moves a Draft to `Pending Review`. Requires current agreement acceptance, proof of address, a paid invoice, and approved identity verification. Given name and surname must each contain 1–100 characters after trimming, beginning with a letter and containing only Unicode letters, combining marks, joiners, spaces, hyphens, apostrophes, middle dots or periods. Email addresses and numbers are invalid names. Obvious placeholder names require manual review. No request body; not idempotent.
      security:
        - partnerKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      responses:
        "200":
          description: Submitted application.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/PartnerResidencyApplication"
                required:
                  - data
                description: Successful response.
        "400":
          description: "`Residency application is not in draft status`, `Please accept the current Agreement of Coexistence before continuing.`, `Please provide proof of address before continuing.`, an unpaid-invoice message, `Please complete identity verification before continuing.`, or a missing/invalid required-field message (including given name and surname)."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Partner Key lacks the required partner scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: The applicant already has equivalent or higher residency rights, another application is in progress, or residency eligibility changed. Active residents may only upgrade; contact support for other changes. Renewals use billing, not a new application.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Partner API rate limit exceeded.
          headers:
            Retry-After:
              required: true
              description: Seconds until the partner client should retry.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-residency-applications-id-submit
      x-sidebar-title: Submit application
  /api/v1/me/natural-person:
    get:
      operationId: getNaturalPerson
      tags:
        - Authenticated person
      summary: Get the authenticated natural person
      description: Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - eprospera:person.details.read
        - agentKey: []
      responses:
        "200":
          description: Natural-person details.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NaturalPerson"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-get-natural-person
      x-sidebar-title: Natural person
  /api/v1/me/natural-person/id-verification:
    get:
      operationId: getNaturalPersonIdVerification
      tags:
        - Authenticated person
      summary: Get ID-verification artifacts
      description: Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - eprospera:person.id_verification.read
        - agentKey: []
      responses:
        "200":
          description: ID-verification details and signed artifact URLs.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IdVerification"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-get-id-verification
      x-sidebar-title: ID verification
  /api/v1/me/natural-person/residency:
    get:
      operationId: getNaturalPersonResidency
      tags:
        - Authenticated person
      summary: Get natural-person residency status
      description: Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - eprospera:person.residency.read
        - agentKey: []
      responses:
        "200":
          description: Residency status.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Residency"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-get-natural-person-residency
      x-sidebar-title: Residency
  /api/v1/me/natural-person/documents:
    get:
      operationId: getNaturalPersonDocuments
      tags:
        - Authenticated person
      summary: List the authenticated person’s documents
      description: |-
        Returns the documents the portal shows the signed-in person: the signed Agreement of Coexistence, accepted policies, and other generated documents, excluding admin-only or hidden records. `agreementOfCoexistence` describes the agreement behind the active residency. Agent scope: `agent:person.documents.read`.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - eprospera:person.documents.read
        - agentKey: []
      responses:
        "200":
          description: Personal documents and the active Agreement of Coexistence.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PersonDocumentsResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-get-natural-person-documents
      x-sidebar-title: Documents
  /api/v1/me/legal-entities:
    get:
      operationId: listConsentedLegalEntities
      tags:
        - Consented legal entities
      summary: List consented legal entities
      description: Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - eprospera:entity.read
      responses:
        "200":
          description: Consented entities.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/LegalEntity"
                required:
                  - data
                description: Successful response.
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-get-legal-entities
      x-sidebar-title: Legal entities
  /api/v1/me/legal-entities/{id}:
    get:
      operationId: getConsentedLegalEntity
      tags:
        - Consented legal entities
      summary: Get a consented legal entity
      description: Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - eprospera:entity.read
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      responses:
        "200":
          description: Consented legal entity.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/LegalEntityDetails"
                required:
                  - data
                description: Successful response.
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-get-legal-entities-id
      x-sidebar-title: Legal entity by ID
  /api/v1/me/legal-entities/{id}/documents:
    get:
      operationId: getConsentedLegalEntityDocuments
      tags:
        - Consented legal entities
      summary: List documents for a consented legal entity
      description: Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - eprospera:entity.documents.read
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      responses:
        "200":
          description: Documents for the entity.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/Document"
                required:
                  - data
                description: Successful response.
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-get-legal-entities-id-documents
      x-sidebar-title: Legal entity documents
  /api/v1/me/tax/summary:
    get:
      operationId: getTaxSummary
      tags:
        - Taxes
      summary: Get tax obligations and lump-sum election status
      description: |-
        Personal VAT obligations honor staff-recorded ongoing applicability. Period-specific reviewed decisions and active manual filing requirements take precedence. Changes to filing applicability do not remove submitted filings or payment balances.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - eprospera:person.tax.read
        - oauth2:
            - eprospera:entity.tax.read
      parameters:
        - schema:
            anyOf:
              - type: string
                enum:
                  - personal
              - type: string
                format: uuid
          required: false
          name: subject
          in: query
      responses:
        "200":
          description: Authorized tax subjects and obligations.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      subjects:
                        type: array
                        items:
                          type: object
                          properties:
                            subject:
                              $ref: "#/components/schemas/TaxSubject"
                            obligations:
                              type: array
                              items:
                                type: object
                                properties:
                                  type:
                                    type: string
                                    enum:
                                      - income
                                      - vat
                                  period:
                                    type: object
                                    properties:
                                      year:
                                        type: integer
                                      quarter:
                                        type:
                                          - integer
                                          - "null"
                                        minimum: 1
                                        maximum: 4
                                    required:
                                      - year
                                      - quarter
                                  dueDate:
                                    type: string
                                    format: date-time
                                  status:
                                    type: string
                                    enum:
                                      - open
                                      - overdue
                                  filingId:
                                    type:
                                      - string
                                      - "null"
                                    format: uuid
                                required:
                                  - type
                                  - period
                                  - dueDate
                                  - status
                                  - filingId
                            lumpSumElections:
                              type: array
                              items:
                                type: object
                                properties:
                                  id:
                                    type: string
                                    format: uuid
                                  taxYear:
                                    type:
                                      - integer
                                      - "null"
                                  effectiveDate:
                                    type: string
                                    format: date-time
                                  terminationDate:
                                    type:
                                      - string
                                      - "null"
                                    format: date-time
                                  status:
                                    type: string
                                    enum:
                                      - active
                                      - expired
                                required:
                                  - id
                                  - taxYear
                                  - effectiveDate
                                  - terminationDate
                                  - status
                          required:
                            - subject
                            - obligations
                            - lumpSumElections
                    required:
                      - subjects
                required:
                  - data
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-get-tax-summary
      x-sidebar-title: Tax status
  /api/v1/me/tax/filings:
    get:
      operationId: listTaxFilings
      tags:
        - Taxes
      summary: List submitted tax filings
      description: Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - eprospera:person.tax.read
        - oauth2:
            - eprospera:entity.tax.read
      parameters:
        - schema:
            anyOf:
              - type: string
                enum:
                  - personal
              - type: string
                format: uuid
          required: false
          name: subject
          in: query
        - schema:
            type: string
            enum:
              - income
              - vat
          required: false
          name: type
          in: query
        - schema:
            type: integer
            minimum: 2020
            maximum: 9999
          required: false
          name: year
          in: query
        - schema:
            type: integer
            minimum: 1
            maximum: 100
          required: false
          name: limit
          in: query
        - schema:
            type: string
          required: false
          name: cursor
          in: query
      responses:
        "200":
          description: Cursor-paginated submitted tax filings.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/TaxFiling"
                  meta:
                    type: object
                    properties:
                      nextCursor:
                        type:
                          - string
                          - "null"
                    required:
                      - nextCursor
                required:
                  - data
                  - meta
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-list-tax-filings
      x-sidebar-title: List tax filings
  /api/v1/me/tax/filings/{filingId}:
    get:
      operationId: getTaxFiling
      tags:
        - Taxes
      summary: Get a submitted tax filing
      description: Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - eprospera:person.tax.read
        - oauth2:
            - eprospera:entity.tax.read
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: filingId
          in: path
      responses:
        "200":
          description: Submitted tax filing.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/TaxFiling"
                required:
                  - data
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-get-tax-filing
      x-sidebar-title: Get tax filing
  /api/v1/me/tax/filings/{filingId}/documents/{document}:
    get:
      operationId: downloadTaxDocument
      tags:
        - Taxes
      summary: Download a tax assessment or filed income return
      description: |-
        For a submitted individual income return, downloads the saved Form 1 PDF when available; otherwise renders it from the filed amounts and original submission date. Returns 400 when incomplete or conflicting historical filing data requires review. Hidden or admin-only saved returns are unavailable to residents and return 404.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - eprospera:person.tax.read
        - oauth2:
            - eprospera:entity.tax.read
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: filingId
          in: path
        - schema:
            type: string
            enum:
              - assessment
              - return
          required: true
          name: document
          in: path
        - schema:
            type: integer
            minimum: 1
            maximum: 5
          required: false
          name: history_years
          in: query
      responses:
        "200":
          description: PDF tax document.
          content:
            application/pdf:
              schema:
                type: string
                format: binary
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-download-tax-document
      x-sidebar-title: Download tax document
  /api/v1/referral-codes/{code}/referrals:
    get:
      operationId: listReferralCodeReferrals
      tags:
        - Referrals
      summary: List referrals for a referral code
      description: Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - standardApiKey: []
      parameters:
        - schema:
            type: string
            example: CATALYST2026
          required: true
          name: code
          in: path
      responses:
        "200":
          description: Paginated referrals.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReferralListResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: get-referral-codes-code-referrals
      x-sidebar-title: List referrals
  /api/v1/visitor_pass_applications:
    post:
      operationId: createVisitorPassApplication
      tags:
        - Visitor passes
      summary: Create a public Visitor Pass application
      description: This endpoint does not require an API key, but every request requires a fresh Cloudflare Turnstile token (turnstileToken) for action visitor-pass from an approved hostname. The server verifies it before any account creation, application processing, or email. Missing, invalid, expired, replayed, wrong-action, or wrong-hostname tokens return 400; verification outages or missing configuration return 503. The applicant must provide consent and a signature as a canonical base64 PNG data URL (data:image/png;base64,...), with at most 512 KiB of image data and 4 million pixels. The image must fully decode and be embeddable in the agreement PDF. Invalid signatures return 400 before an account or application is created.
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateVisitorPassRequest"
      responses:
        "200":
          description: Visitor Pass application accepted.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateVisitorPassResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "503":
          description: Human verification is temporarily unavailable. No application was processed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
      x-docs-slug: post-visitor-pass-applications
      x-sidebar-title: Create visitor pass
  /api/v1/me/tax/vat/context:
    get:
      operationId: getVatContext
      tags:
        - Quarterly VAT
      summary: Identify VAT taxpayers and open quarters
      description: |-
        Returns registered taxpayer identity (name, UUID, RPN), candidate open quarters, and the declaration text. Personal and entity scopes authorize only their respective subjects. Entities also require current representation and token-specific consent. Eligibility is rechecked on writes. No identity-document images are returned.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - eprospera:person.tax.vat.write
        - oauth2:
            - eprospera:entity.tax.vat.write
      parameters:
        - schema:
            anyOf:
              - type: string
                enum:
                  - personal
              - type: string
                format: uuid
          required: false
          name: subject
          in: query
      responses:
        "200":
          description: Authorized taxpayers and filing context.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      subjects:
                        type: array
                        items:
                          type: object
                          properties:
                            subject:
                              type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - natural_person
                                    - legal_entity
                                id:
                                  type: string
                                  format: uuid
                                name:
                                  type: string
                                residentPermitNumber:
                                  type:
                                    - string
                                    - "null"
                                  pattern: ^[89]\d{13}$
                                  description: 14-digit Resident Permit Number.
                              required:
                                - type
                                - id
                                - name
                                - residentPermitNumber
                            periods:
                              type: array
                              items:
                                type: object
                                properties:
                                  type:
                                    type: string
                                    enum:
                                      - vat
                                  period:
                                    type: object
                                    properties:
                                      year:
                                        type: integer
                                      quarter:
                                        type: integer
                                        minimum: 1
                                        maximum: 4
                                    required:
                                      - year
                                      - quarter
                                  dueDate:
                                    type: string
                                    format: date-time
                                  status:
                                    type: string
                                    enum:
                                      - open
                                      - overdue
                                  filingId:
                                    type:
                                      - string
                                      - "null"
                                    format: uuid
                                required:
                                  - type
                                  - period
                                  - dueDate
                                  - status
                                  - filingId
                          required:
                            - subject
                            - periods
                      supportedCurrencies:
                        type: array
                        items:
                          type: string
                          enum:
                            - usd
                      declaration:
                        type: object
                        properties:
                          version:
                            type: string
                            enum:
                              - vat-v1
                          text:
                            type: string
                        required:
                          - version
                          - text
                    required:
                      - subjects
                      - supportedCurrencies
                      - declaration
                required:
                  - data
        "400":
          description: Invalid request, incomplete figures, or payment not satisfied.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "401":
          description: Missing, expired, or revoked authorization.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "403":
          description: VAT write scope is missing or no longer allowed for this OAuth client.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "404":
          description: Taxpayer or filing not accessible through this authorization.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "409":
          description: Period unavailable, multiple drafts, unsupported filing, missing RPN, or concurrent change. Refresh before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "412":
          description: Stale revision or unmet tax-credit approval. Read the filing, review current figures, and resolve any required credit review before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "429":
          description: "Rate limit exceeded: 60 requests per minute per client and user."
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "500":
          description: Internal server error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
      x-docs-slug: oauth-get-vat-context
      x-sidebar-title: VAT identity and quarters
  /api/v1/me/tax/vat/filings:
    post:
      operationId: createVatDraft
      tags:
        - Quarterly VAT
      summary: Create or resume a quarterly VAT draft
      description: |-
        Use personal for the caller or a consented legal-entity UUID. Taxpayer+quarter is the retry key: returns an existing original draft without replacing figures. Already-filed quarters, multiple drafts, and BTC/amendment drafts return 409. USD originals only. A registered RPN and eligible quarter are required.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - eprospera:person.tax.vat.write
        - oauth2:
            - eprospera:entity.tax.vat.write
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                subject:
                  anyOf:
                    - type: string
                      enum:
                        - personal
                    - type: string
                      format: uuid
                year:
                  type: integer
                  minimum: 2020
                  maximum: 2100
                quarter:
                  type: integer
                  minimum: 1
                  maximum: 4
              required:
                - subject
                - year
                - quarter
              additionalProperties: false
      responses:
        "200":
          description: Existing draft resumed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/VatFiling"
                required:
                  - data
        "201":
          description: Draft created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/VatFiling"
                required:
                  - data
        "400":
          description: Invalid request, incomplete figures, or payment not satisfied.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "401":
          description: Missing, expired, or revoked authorization.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "403":
          description: VAT write scope is missing or no longer allowed for this OAuth client.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "404":
          description: Taxpayer or filing not accessible through this authorization.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "409":
          description: Period unavailable, multiple drafts, unsupported filing, missing RPN, or concurrent change. Refresh before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "412":
          description: Stale revision or unmet tax-credit approval. Read the filing, review current figures, and resolve any required credit review before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "429":
          description: "Rate limit exceeded: 60 requests per minute per client and user."
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "500":
          description: Internal server error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
      x-docs-slug: oauth-create-vat-draft
      x-sidebar-title: Create VAT draft
  /api/v1/me/tax/vat/filings/{filingId}:
    get:
      operationId: getVatFiling
      tags:
        - Quarterly VAT
      summary: Read a VAT draft or submission receipt
      description: |-
        Returns reported figures, server-calculated USD liability, current revision, payment readiness, and submittedAt as the submission receipt. The assessment link requires the matching tax read scope. Relative links use the current portal/API origin.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - eprospera:person.tax.vat.write
        - oauth2:
            - eprospera:entity.tax.vat.write
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: filingId
          in: path
      responses:
        "200":
          description: VAT draft or submitted filing.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/VatFiling"
                required:
                  - data
        "400":
          description: Invalid request, incomplete figures, or payment not satisfied.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "401":
          description: Missing, expired, or revoked authorization.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "403":
          description: VAT write scope is missing or no longer allowed for this OAuth client.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "404":
          description: Taxpayer or filing not accessible through this authorization.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "409":
          description: Period unavailable, multiple drafts, unsupported filing, missing RPN, or concurrent change. Refresh before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "412":
          description: Stale revision or unmet tax-credit approval. Read the filing, review current figures, and resolve any required credit review before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "429":
          description: "Rate limit exceeded: 60 requests per minute per client and user."
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "500":
          description: Internal server error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
      x-docs-slug: oauth-get-vat-filing
      x-sidebar-title: Read VAT filing
    put:
      operationId: updateVatDraft
      tags:
        - Quarterly VAT
      summary: Save and calculate VAT figures
      description: |-
        Replace all reported figures using decimal strings and the latest revision. Stale revisions return 412. Submitted filings and processed invoices cannot be edited; an unprocessed invoice is voided before recalculation. A successful write returns a new revision. After a timeout, read the filing before retrying.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - eprospera:person.tax.vat.write
        - oauth2:
            - eprospera:entity.tax.vat.write
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: filingId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                revision:
                  type: string
                  pattern: ^[a-f0-9]{64}$
                currency:
                  type: string
                  enum:
                    - usd
                accountingMethod:
                  type: string
                  enum:
                    - cash
                    - accrual
                grossIncome:
                  type: string
                  pattern: ^(0|[1-9]\d{0,11})(\.\d{1,2})?$
                  description: Non-negative USD decimal string with at most 12 integer digits and 2 decimal places.
                taxCredit:
                  type: string
                  pattern: ^(0|[1-9]\d{0,11})(\.\d{1,2})?$
                  description: Non-negative USD decimal string with at most 12 integer digits and 2 decimal places.
                taxWithheld:
                  type: string
                  pattern: ^(0|[1-9]\d{0,11})(\.\d{1,2})?$
                  description: Non-negative USD decimal string with at most 12 integer digits and 2 decimal places.
              required:
                - revision
                - currency
                - accountingMethod
                - grossIncome
                - taxCredit
                - taxWithheld
              additionalProperties: false
      responses:
        "200":
          description: Saved draft and calculated liability.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/VatFiling"
                required:
                  - data
        "400":
          description: Invalid request, incomplete figures, or payment not satisfied.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "401":
          description: Missing, expired, or revoked authorization.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "403":
          description: VAT write scope is missing or no longer allowed for this OAuth client.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "404":
          description: Taxpayer or filing not accessible through this authorization.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "409":
          description: Period unavailable, multiple drafts, unsupported filing, missing RPN, or concurrent change. Refresh before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "412":
          description: Stale revision or unmet tax-credit approval. Read the filing, review current figures, and resolve any required credit review before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "429":
          description: "Rate limit exceeded: 60 requests per minute per client and user."
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "500":
          description: Internal server error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
      x-docs-slug: oauth-update-vat-draft
      x-sidebar-title: Save VAT figures
  /api/v1/me/tax/vat/filings/{filingId}/submit:
    post:
      operationId: submitVatDraft
      tags:
        - Quarterly VAT
      summary: Submit a reviewed quarterly VAT filing
      description: |-
        Requires the latest revision and explicit acceptance of the declaration from VAT context. Preserves server-side ownership, period, tax-credit and authoritative settlement checks. Zero-liability filings need no invoice; positive liability requires existing payment evidence. Use links.portal for payment. Repeating a successful submission with the same revision returns the existing receipt. No charges are initiated by this endpoint.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - eprospera:person.tax.vat.write
        - oauth2:
            - eprospera:entity.tax.vat.write
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: filingId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                revision:
                  type: string
                  pattern: ^[a-f0-9]{64}$
                declaration:
                  type: object
                  properties:
                    version:
                      type: string
                      enum:
                        - vat-v1
                    accepted:
                      type: boolean
                      enum:
                        - true
                  required:
                    - version
                    - accepted
                  additionalProperties: false
              required:
                - revision
                - declaration
              additionalProperties: false
      responses:
        "200":
          description: Submitted filing or previously submitted receipt.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/VatFiling"
                required:
                  - data
        "400":
          description: Invalid request, incomplete figures, or payment not satisfied.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "401":
          description: Missing, expired, or revoked authorization.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "403":
          description: VAT write scope is missing or no longer allowed for this OAuth client.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "404":
          description: Taxpayer or filing not accessible through this authorization.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "409":
          description: Period unavailable, multiple drafts, unsupported filing, missing RPN, or concurrent change. Refresh before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "412":
          description: Stale revision or unmet tax-credit approval. Read the filing, review current figures, and resolve any required credit review before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "429":
          description: "Rate limit exceeded: 60 requests per minute per client and user."
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
        "500":
          description: Internal server error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - error
      x-docs-slug: oauth-submit-vat-draft
      x-sidebar-title: Submit VAT filing
  /.well-known/openid-configuration:
    get:
      operationId: getOpenidConfiguration
      tags:
        - OAuth 2.0 / OpenID Connect
      summary: Get OpenID Provider metadata
      security: []
      responses:
        "200":
          description: OpenID Provider metadata.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OpenidConfiguration"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-openid-configuration
      x-sidebar-title: OpenID configuration
  /api/oauth/.well-known/jwks.json:
    get:
      operationId: getOauthJwks
      tags:
        - OAuth 2.0 / OpenID Connect
      summary: Get OAuth signing keys
      security: []
      responses:
        "200":
          description: JSON Web Key Set.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/JsonWebKeySet"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-jwks
      x-sidebar-title: JWKS
  /api/oauth/authorize:
    get:
      operationId: oauthAuthorize
      tags:
        - OAuth 2.0 / OpenID Connect
      summary: Start the OAuth authorization-code flow
      security: []
      parameters:
        - schema:
            type: string
            enum:
              - code
          required: true
          name: response_type
          in: query
        - schema:
            type: string
          required: true
          name: client_id
          in: query
        - schema:
            type: string
            format: uri
          required: true
          name: redirect_uri
          in: query
        - schema:
            type: string
          required: true
          name: scope
          in: query
        - schema:
            type: string
          required: true
          name: state
          in: query
        - schema:
            type: string
          required: false
          name: code_challenge
          in: query
        - schema:
            type: string
            enum:
              - S256
          required: false
          name: code_challenge_method
          in: query
        - schema:
            type: string
          required: false
          name: nonce
          in: query
        - schema:
            type: string
            enum:
              - query
              - fragment
              - form_post
          required: false
          name: response_mode
          in: query
        - schema:
            type: string
          required: false
          name: prompt
          in: query
        - schema:
            type: integer
            minimum: 0
          required: false
          name: max_age
          in: query
        - schema:
            type: string
          required: false
          name: login_hint
          in: query
      responses:
        "200":
          description: HTML auto-submit response for response_mode=form_post.
          content:
            text/html:
              schema:
                type: string
        "303":
          description: Redirect to the exact registered client redirect URI.
          headers:
            Location:
              required: true
              description: The exact registered client redirect URI.
              schema:
                type: string
                format: uri
        "307":
          description: Internal redirect to portal login or consent.
          headers:
            Location:
              required: true
              description: The portal login or consent URL.
              schema:
                type: string
                format: uri
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-authorize
      x-sidebar-title: Authorize
  /api/oauth/device_authorization:
    post:
      operationId: oauthDeviceAuthorization
      tags:
        - OAuth 2.0 / OpenID Connect
      summary: Start an OAuth device authorization
      security: []
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                client_id:
                  type: string
                scope:
                  type: string
              required:
                - client_id
                - scope
      responses:
        "200":
          description: Device and user codes for browser authorization.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OAuthDeviceAuthorizationResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-device-authorization
      x-sidebar-title: Device authorization
  /api/oauth/token:
    post:
      operationId: oauthToken
      tags:
        - OAuth 2.0 / OpenID Connect
      summary: Exchange an authorization code, device code, or refresh token
      description: |-
        Use HTTP Basic client authentication when possible. client_secret_post remains supported for compatibility. Public device clients send client_id without a secret. Repeated parameters and multiple client authentication methods are rejected.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauthClient: []
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: "#/components/schemas/OAuthTokenRequest"
      responses:
        "200":
          description: OAuth tokens.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OAuthTokenResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-token
      x-sidebar-title: Token
  /api/oauth/userinfo:
    get:
      operationId: oauthUserinfo
      tags:
        - OAuth 2.0 / OpenID Connect
      summary: Get OpenID Connect user claims
      description: Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - openid
      responses:
        "200":
          description: Claims authorized by the access token.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OAuthUserinfo"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          headers:
            WWW-Authenticate:
              required: true
              description: Bearer challenge identifying a missing, expired, revoked, or otherwise invalid access token.
              schema:
                type: string
                example: Bearer error="invalid_token"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          headers:
            WWW-Authenticate:
              required: true
              description: Bearer challenge identifying the scope required to call UserInfo.
              schema:
                type: string
                example: Bearer error="insufficient_scope", scope="openid"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-userinfo
      x-sidebar-title: Userinfo
    post:
      operationId: oauthUserinfoPost
      tags:
        - OAuth 2.0 / OpenID Connect
      summary: Get OpenID Connect user claims
      description: |-
        POST variant of the OpenID Connect UserInfo endpoint.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauth2:
            - openid
      responses:
        "200":
          description: Claims authorized by the access token.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OAuthUserinfo"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          headers:
            WWW-Authenticate:
              required: true
              description: Bearer challenge identifying a missing, expired, revoked, or otherwise invalid access token.
              schema:
                type: string
                example: Bearer error="invalid_token"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          headers:
            WWW-Authenticate:
              required: true
              description: Bearer challenge identifying the scope required to call UserInfo.
              schema:
                type: string
                example: Bearer error="insufficient_scope", scope="openid"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-userinfo-post
      x-sidebar-title: Userinfo (POST)
  /api/oauth/revoke:
    post:
      operationId: oauthRevoke
      tags:
        - OAuth 2.0 / OpenID Connect
      summary: Revoke an OAuth token
      description: Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauthClient: []
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                token:
                  type: string
                token_type_hint:
                  type: string
                client_id:
                  type: string
                  description: Required with client_secret_post; omit when using HTTP Basic.
                client_secret:
                  type: string
                  description: Required with client_secret_post; omit when using HTTP Basic.
              required:
                - token
      responses:
        "200":
          description: Token revoked, or already inactive.
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-revoke
      x-sidebar-title: Revoke
  /api/oauth/introspect:
    post:
      operationId: oauthIntrospect
      tags:
        - OAuth 2.0 / OpenID Connect
      summary: Introspect an OAuth token
      description: Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      security:
        - oauthClient: []
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                token:
                  type: string
                token_type_hint:
                  type: string
                client_id:
                  type: string
                  description: Required with client_secret_post; omit when using HTTP Basic.
                client_secret:
                  type: string
                  description: Required with client_secret_post; omit when using HTTP Basic.
              required:
                - token
      responses:
        "200":
          description: Token activity and metadata.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OAuthIntrospectionResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-introspect
      x-sidebar-title: Introspect
  /api/v1/legal_entity_applications/{id}/pay/coupon:
    post:
      operationId: payLegalEntityApplicationWithCoupon
      tags:
        - Deprecated aliases
      summary: Deprecated legal-entity coupon-payment alias
      description: |-
        Use `/api/v1/legal_entity_applications/{id}/pay/voucher` with `voucherCode` instead.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      deprecated: true
      security:
        - standardApiKey: []
        - agentKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/LegacyCouponPaymentRequest"
      responses:
        "200":
          description: Coupon alias accepted.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaymentResponse"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-legal-entity-applications-id-pay-coupon
      x-sidebar-title: Legal-entity coupon alias
  /api/v1/partner/residency_applications/{id}/pay/coupon:
    post:
      operationId: payPartnerResidencyApplicationWithCoupon
      tags:
        - Deprecated aliases
      summary: Deprecated partner coupon-payment alias
      description: Use `/api/v1/partner/residency_applications/{id}/pay/voucher` with `voucherCode` instead.
      deprecated: true
      security:
        - partnerKey: []
      parameters:
        - schema:
            type: string
            format: uuid
            example: 4e368230-84e3-4cb8-9225-a6d972e425fc
          required: true
          name: id
          in: path
        - schema:
            type: string
            minLength: 8
            maxLength: 128
            pattern: ^[A-Za-z0-9_.~-]+$
            description: "8-128 URL-safe characters. Retained for 24 hours per integration and route. An identical retry replays the stored response with `Idempotency-Replayed: true`; a different body under the same key returns 409."
          required: true
          description: "8-128 URL-safe characters. Retained for 24 hours per integration and route. An identical retry replays the stored response with `Idempotency-Replayed: true`; a different body under the same key returns 409."
          name: Idempotency-Key
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/LegacyCouponPaymentRequest"
      responses:
        "200":
          description: Coupon alias accepted; the application is returned.
          headers:
            Idempotency-Replayed:
              required: false
              description: Present with value `true` when this response was replayed from an earlier identical request.
              schema:
                type: string
                enum:
                  - "true"
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: "#/components/schemas/PartnerResidencyApplication"
                required:
                  - data
                description: Successful response.
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Partner Key lacks the required partner scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Partner API rate limit exceeded.
          headers:
            Retry-After:
              required: true
              description: Seconds until the partner client should retry.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: post-residency-applications-id-pay-coupon
      x-sidebar-title: Partner coupon alias
  /api/v1/me/natural-person/id_verification:
    get:
      operationId: getNaturalPersonIdVerificationLegacy
      tags:
        - Deprecated aliases
      summary: Deprecated ID-verification underscore alias
      description: |-
        Use `/api/v1/me/natural-person/id-verification` instead.

        Account deactivation revokes personal API keys, including Agent Keys, and OAuth authorizations. Account reactivation requires new API keys, including new Agent Keys, and consent; previously issued credentials remain invalid.
      deprecated: true
      security:
        - oauth2:
            - eprospera:person.id_verification.read
        - agentKey: []
      responses:
        "200":
          description: ID-verification details and signed artifact URLs.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IdVerification"
        "400":
          description: Validation error or precondition failure.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "401":
          description: Missing or invalid credential.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "403":
          description: Credential lacks the required scope (Agent Key) or insufficient OAuth scope.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "404":
          description: Resource does not exist or is invisible to the caller. The two are intentionally indistinguishable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "409":
          description: Conflicting state (e.g. legal-entity name already taken).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "429":
          description: Rate limit exceeded. No `Retry-After` header is currently emitted; back off exponentially.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-get-id-verification-legacy
      x-sidebar-title: ID verification underscore alias
  /api/oauth/.well-known/openid-configuration:
    get:
      operationId: getOpenidConfigurationLegacy
      tags:
        - Deprecated aliases
      summary: Deprecated OpenID-configuration alias
      description: Use `/.well-known/openid-configuration` instead.
      deprecated: true
      security: []
      responses:
        "200":
          description: OpenID Provider metadata.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OpenidConfiguration"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-openid-configuration-legacy
      x-sidebar-title: OpenID configuration alias
  /.well-known/jwks.json:
    get:
      operationId: getOauthJwksLegacy
      tags:
        - Deprecated aliases
      summary: Deprecated root JWKS alias
      description: Use `/api/oauth/.well-known/jwks.json` instead.
      deprecated: true
      security: []
      responses:
        "200":
          description: JSON Web Key Set.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/JsonWebKeySet"
        "500":
          description: Server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
      x-docs-slug: oauth-jwks-legacy
      x-sidebar-title: JWKS root alias
webhooks: {}
