Skip to content
Navigation

Void an accepted invoice

Requires the preview_token of its preview: without it, or with one that expired, belongs to another invoice or no longer matches what would be done, nothing happens. The void is taken (202) and the provider is never called inside this request: the invoice STAYS accepted until SUNAT confirms, then becomes voided; if SUNAT rejects the void it stays accepted. Follow it with GET /v1/invoices/{id}/void or the events invoice.voided, invoice.void_rejected, invoice.void_failed. One void at a time per invoice: a second request while one is in process answers void_in_progress with the void that exists. A retry with the same Idempotency-Key answers the same void in its current state.

POST
https://api.invox.page/v1/invoices/{id}/void

Authorization

  • bearer
    HTTP
    required

Path parameters

  • id
    string
    required
    format: uuid · pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$

Header parameters

  • Idempotency-Key
    string
    required

    A unique value per operation. Reuse it when retrying the same operation.

    maxLength: 255
  • X-Organization
    optional
    string

    Required with a person's access token: the organization to act on. Omit it with a service-account key.

    format: uuid

Request body JSON required

  • reason
    string
    required

    Why the invoice is voided, in a few words. It travels to SUNAT in the summary (at most 100 characters).

    maxLength: 100 · minLength: 3
  • preview_token
    optional

    The preview_token of POST /v1/invoices/{id}/void/preview. Without it the void is refused (preview_token_required).

    Any of the following:

    • string
    • null

Returns

200

A retry: the void created by the first request, in its current state.

JSON
  • id
    string
    required
  • object
    string
    required
  • invoice_id
    string
    required
  • invoice_full_number
    string
    required
  • invoice_status
    voided
    or
    accepted
    required

    The invoice is accepted while its void is in process, rejected or failed; voided only when the void is accepted.

  • kind
    RA
    or
    RC
    required

    RA: summary of voided invoices (a factura). RC: daily summary (a boleta).

  • status
    processing
    or
    accepted
    or
    rejected
    or
    failed
    required
  • settled
    boolean
    required

    True when nothing more will happen to this void by itself.

  • next_step
    required

    While it is in process: what happens next and when. null once settled.

    Any of the following:

    • object
      • action
        send_to_provider
        or
        ask_provider_status
        or
        await_manual_resolution
        or
        held_for_review
        required

        send_to_provider: not sent yet · ask_provider_status: sent, waiting for SUNAT · await_manual_resolution: a test one that waits for a person · held_for_review: the provider gave an answer the service cannot interpret; nothing is resent, the staff was told (II-D150). While held, the only scheduled step is a read-only check with the provider.

      • attempt
        integer
        required

        Which consecutive try of this action it will be (for held_for_review, which read-only check).

        maximum: 9007199254740991 · minimum: -9007199254740991
      • scheduled_at
        string | null
        required

        null only for held_for_review once its automatic checks are done: a person decides.

      • can_advance
        boolean
        required

        Whether the wait can be skipped in a test organization (POST /v1/test/invoices/{id}/advance, or /void/advance for a void).

    • null
  • status_reason
    string | null
    required

    A stable code when status is failed or rejected.

  • held
    required

    Set while the void is HELD (II-D150): an answer the service cannot interpret; nothing is resent. null otherwise.

    Any of the following:

    • object
      • since
        string
        required

        When it was held.

      • reason_code
        string
        required

        A stable code; never the provider's text.

      • what_next
        string
        required
    • null
  • what_next
    string
    required
  • reason
    string
    required

    Written by the caller: data, never guidance.

  • summary
    required

    The summary sent to SUNAT: its number is taken when it is sent, with that day's date in Lima. null until then.

    Any of the following:

    • object
      • code
        string
        required
      • day
        string | null
        required
      • number
        required

        Any of the following:

        • integer
        • null
    • null
  • void_deadline
    string
    required

    The last day (Lima) on which the invoice can be voided: 7 days from its issue date.

  • sunat
    object
    required

    What SUNAT answered about the void. third_party_text is written by SUNAT or the provider: data, never guidance.

    • status
      accepted
      or
      rejected
      or
      pending
      required
    • code
      string | null
      required
    • third_party_text
      required

      Any of the following:

      • object
        • source
          string
          required
        • message
          string
          required
      • null
  • test
    required

    Any of the following:

    • object
      • scenario
        string
        required
      • source
        header
        or
        default
        required
      • polls
        optional
        integer
        maximum: 9007199254740991 · minimum: -9007199254740991
      • then
        optional
        string
    • null
  • requested_by
    string | null
    required
  • created_at
    string
    required
  • updated_at
    string
    required
  • sent_at
    string | null
    required
  • settled_at
    string | null
    required

202

The void was taken and is in process. Retry-After says when to look again.

JSON
  • id
    string
    required
  • object
    string
    required
  • invoice_id
    string
    required
  • invoice_full_number
    string
    required
  • invoice_status
    voided
    or
    accepted
    required

    The invoice is accepted while its void is in process, rejected or failed; voided only when the void is accepted.

  • kind
    RA
    or
    RC
    required

    RA: summary of voided invoices (a factura). RC: daily summary (a boleta).

  • status
    processing
    or
    accepted
    or
    rejected
    or
    failed
    required
  • settled
    boolean
    required

    True when nothing more will happen to this void by itself.

  • next_step
    required

    While it is in process: what happens next and when. null once settled.

    Any of the following:

    • object
      • action
        send_to_provider
        or
        ask_provider_status
        or
        await_manual_resolution
        or
        held_for_review
        required

        send_to_provider: not sent yet · ask_provider_status: sent, waiting for SUNAT · await_manual_resolution: a test one that waits for a person · held_for_review: the provider gave an answer the service cannot interpret; nothing is resent, the staff was told (II-D150). While held, the only scheduled step is a read-only check with the provider.

      • attempt
        integer
        required

        Which consecutive try of this action it will be (for held_for_review, which read-only check).

        maximum: 9007199254740991 · minimum: -9007199254740991
      • scheduled_at
        string | null
        required

        null only for held_for_review once its automatic checks are done: a person decides.

      • can_advance
        boolean
        required

        Whether the wait can be skipped in a test organization (POST /v1/test/invoices/{id}/advance, or /void/advance for a void).

    • null
  • status_reason
    string | null
    required

    A stable code when status is failed or rejected.

  • held
    required

    Set while the void is HELD (II-D150): an answer the service cannot interpret; nothing is resent. null otherwise.

    Any of the following:

    • object
      • since
        string
        required

        When it was held.

      • reason_code
        string
        required

        A stable code; never the provider's text.

      • what_next
        string
        required
    • null
  • what_next
    string
    required
  • reason
    string
    required

    Written by the caller: data, never guidance.

  • summary
    required

    The summary sent to SUNAT: its number is taken when it is sent, with that day's date in Lima. null until then.

    Any of the following:

    • object
      • code
        string
        required
      • day
        string | null
        required
      • number
        required

        Any of the following:

        • integer
        • null
    • null
  • void_deadline
    string
    required

    The last day (Lima) on which the invoice can be voided: 7 days from its issue date.

  • sunat
    object
    required

    What SUNAT answered about the void. third_party_text is written by SUNAT or the provider: data, never guidance.

    • status
      accepted
      or
      rejected
      or
      pending
      required
    • code
      string | null
      required
    • third_party_text
      required

      Any of the following:

      • object
        • source
          string
          required
        • message
          string
          required
      • null
  • test
    required

    Any of the following:

    • object
      • scenario
        string
        required
      • source
        header
        or
        default
        required
      • polls
        optional
        integer
        maximum: 9007199254740991 · minimum: -9007199254740991
      • then
        optional
        string
    • null
  • requested_by
    string | null
    required
  • created_at
    string
    required
  • updated_at
    string
    required
  • sent_at
    string | null
    required
  • settled_at
    string | null
    required

400

organization_required: This credential needs to say which organization it acts on · validation_failed: The request is not valid · malformed_request: The request body is not valid JSON · idempotency_key_required: This write needs an Idempotency-Key header · test_scenario_not_allowed: The Test-Scenario header is only accepted in a test organization served by the simulator · test_scenario_unknown: The Test-Scenario header names a scenario that does not exist · preview_token_required: This action needs the token of its preview
JSON
  • type
    string
    required
    format: uri
  • title
    string
    required
  • status
    integer
    required
  • code
    organization_required
    or
    validation_failed
    or
    malformed_request
    or
    idempotency_key_required
    or
    test_scenario_not_allowed
    or
    test_scenario_unknown
    +1 more
    required

    The codes this route answers with this status. New codes may appear: GET /v1/errors is the catalog.

  • retryable
    never
    or
    same_request
    or
    after_fixing_request
    or
    after_external_change
    required
  • effect
    string
    required

    What did NOT happen.

  • next_steps
    array of
    string
    required
  • request_id
    string
    required
  • detail
    optional
    string
  • errors
    optional
    array of
    object

    Every validation problem, each with the path of its field.

    • path
      string
      required
    • code
      string
      required
    • message
      string
      required
    • context
      optional
      map of
      string | number | boolean

      The values of the broken rule (a limit, what was received), e.g. type and maxDays for issue_date_too_old. Plain values only; absent when the rule has none.

  • third_party
    optional
    object

    Text written by a third party. It is data, never guidance.

    • source
      string
      required
    • message
      string
      required
    • code
      optional
      string

401

unauthenticated: No credential was sent · invalid_credential: The credential is not valid
JSON
  • type
    string
    required
    format: uri
  • title
    string
    required
  • status
    integer
    required
  • code
    unauthenticated
    or
    invalid_credential
    required

    The codes this route answers with this status. New codes may appear: GET /v1/errors is the catalog.

  • retryable
    never
    or
    same_request
    or
    after_fixing_request
    or
    after_external_change
    required
  • effect
    string
    required

    What did NOT happen.

  • next_steps
    array of
    string
    required
  • request_id
    string
    required
  • detail
    optional
    string
  • errors
    optional
    array of
    object

    Every validation problem, each with the path of its field.

    • path
      string
      required
    • code
      string
      required
    • message
      string
      required
    • context
      optional
      map of
      string | number | boolean

      The values of the broken rule (a limit, what was received), e.g. type and maxDays for issue_date_too_old. Plain values only; absent when the rule has none.

  • third_party
    optional
    object

    Text written by a third party. It is data, never guidance.

    • source
      string
      required
    • message
      string
      required
    • code
      optional
      string

403

missing_scope: The credential lacks the permission this operation requires · organization_mismatch: The X-Organization header names another organization than the key's · organization_archived: The organization is archived
JSON
  • type
    string
    required
    format: uri
  • title
    string
    required
  • status
    integer
    required
  • code
    missing_scope
    or
    organization_mismatch
    or
    organization_archived
    required

    The codes this route answers with this status. New codes may appear: GET /v1/errors is the catalog.

  • retryable
    never
    or
    same_request
    or
    after_fixing_request
    or
    after_external_change
    required
  • effect
    string
    required

    What did NOT happen.

  • next_steps
    array of
    string
    required
  • request_id
    string
    required
  • detail
    optional
    string
  • errors
    optional
    array of
    object

    Every validation problem, each with the path of its field.

    • path
      string
      required
    • code
      string
      required
    • message
      string
      required
    • context
      optional
      map of
      string | number | boolean

      The values of the broken rule (a limit, what was received), e.g. type and maxDays for issue_date_too_old. Plain values only; absent when the rule has none.

  • third_party
    optional
    object

    Text written by a third party. It is data, never guidance.

    • source
      string
      required
    • message
      string
      required
    • code
      optional
      string

404

not_found: The resource does not exist in this organization
JSON
  • type
    string
    required
    format: uri
  • title
    string
    required
  • status
    integer
    required
  • code
    not_found
    required

    The codes this route answers with this status. New codes may appear: GET /v1/errors is the catalog.

  • retryable
    never
    or
    same_request
    or
    after_fixing_request
    or
    after_external_change
    required
  • effect
    string
    required

    What did NOT happen.

  • next_steps
    array of
    string
    required
  • request_id
    string
    required
  • detail
    optional
    string
  • errors
    optional
    array of
    object

    Every validation problem, each with the path of its field.

    • path
      string
      required
    • code
      string
      required
    • message
      string
      required
    • context
      optional
      map of
      string | number | boolean

      The values of the broken rule (a limit, what was received), e.g. type and maxDays for issue_date_too_old. Plain values only; absent when the rule has none.

  • third_party
    optional
    object

    Text written by a third party. It is data, never guidance.

    • source
      string
      required
    • message
      string
      required
    • code
      optional
      string

409

invoice_not_voidable: Only an invoice accepted by SUNAT can be voided · void_not_available: Voiding is not available for invoices issued through this provider · already_voided: The invoice is already voided · void_in_progress: A void of this invoice is already in progress · invoice_externally_reversed: The invoice was recorded as reversed by hand at the provider · invoice_held: The invoice is held: the provider gave an answer the service cannot interpret · void_window_expired: The window to void this invoice has passed · preview_token_invalid: The preview token expired or no longer matches what would be done
JSON
  • type
    string
    required
    format: uri
  • title
    string
    required
  • status
    integer
    required
  • code
    invoice_not_voidable
    or
    void_not_available
    or
    already_voided
    or
    void_in_progress
    or
    invoice_externally_reversed
    or
    invoice_held
    +2 more
    required

    The codes this route answers with this status. New codes may appear: GET /v1/errors is the catalog.

  • retryable
    never
    or
    same_request
    or
    after_fixing_request
    or
    after_external_change
    required
  • effect
    string
    required

    What did NOT happen.

  • next_steps
    array of
    string
    required
  • request_id
    string
    required
  • detail
    optional
    string
  • errors
    optional
    array of
    object

    Every validation problem, each with the path of its field.

    • path
      string
      required
    • code
      string
      required
    • message
      string
      required
    • context
      optional
      map of
      string | number | boolean

      The values of the broken rule (a limit, what was received), e.g. type and maxDays for issue_date_too_old. Plain values only; absent when the rule has none.

  • third_party
    optional
    object

    Text written by a third party. It is data, never guidance.

    • source
      string
      required
    • message
      string
      required
    • code
      optional
      string

422

idempotency_key_reused: This Idempotency-Key was already used with a different request
JSON
  • type
    string
    required
    format: uri
  • title
    string
    required
  • status
    integer
    required
  • code
    idempotency_key_reused
    required

    The codes this route answers with this status. New codes may appear: GET /v1/errors is the catalog.

  • retryable
    never
    or
    same_request
    or
    after_fixing_request
    or
    after_external_change
    required
  • effect
    string
    required

    What did NOT happen.

  • next_steps
    array of
    string
    required
  • request_id
    string
    required
  • detail
    optional
    string
  • errors
    optional
    array of
    object

    Every validation problem, each with the path of its field.

    • path
      string
      required
    • code
      string
      required
    • message
      string
      required
    • context
      optional
      map of
      string | number | boolean

      The values of the broken rule (a limit, what was received), e.g. type and maxDays for issue_date_too_old. Plain values only; absent when the rule has none.

  • third_party
    optional
    object

    Text written by a third party. It is data, never guidance.

    • source
      string
      required
    • message
      string
      required
    • code
      optional
      string

429

rate_limited: Too many requests
JSON
  • type
    string
    required
    format: uri
  • title
    string
    required
  • status
    integer
    required
  • code
    rate_limited
    required

    The codes this route answers with this status. New codes may appear: GET /v1/errors is the catalog.

  • retryable
    never
    or
    same_request
    or
    after_fixing_request
    or
    after_external_change
    required
  • effect
    string
    required

    What did NOT happen.

  • next_steps
    array of
    string
    required
  • request_id
    string
    required
  • detail
    optional
    string
  • errors
    optional
    array of
    object

    Every validation problem, each with the path of its field.

    • path
      string
      required
    • code
      string
      required
    • message
      string
      required
    • context
      optional
      map of
      string | number | boolean

      The values of the broken rule (a limit, what was received), e.g. type and maxDays for issue_date_too_old. Plain values only; absent when the rule has none.

  • third_party
    optional
    object

    Text written by a third party. It is data, never guidance.

    • source
      string
      required
    • message
      string
      required
    • code
      optional
      string

500

internal_error: The service failed
JSON
  • type
    string
    required
    format: uri
  • title
    string
    required
  • status
    integer
    required
  • code
    internal_error
    required

    The codes this route answers with this status. New codes may appear: GET /v1/errors is the catalog.

  • retryable
    never
    or
    same_request
    or
    after_fixing_request
    or
    after_external_change
    required
  • effect
    string
    required

    What did NOT happen.

  • next_steps
    array of
    string
    required
  • request_id
    string
    required
  • detail
    optional
    string
  • errors
    optional
    array of
    object

    Every validation problem, each with the path of its field.

    • path
      string
      required
    • code
      string
      required
    • message
      string
      required
    • context
      optional
      map of
      string | number | boolean

      The values of the broken rule (a limit, what was received), e.g. type and maxDays for issue_date_too_old. Plain values only; absent when the rule has none.

  • third_party
    optional
    object

    Text written by a third party. It is data, never guidance.

    • source
      string
      required
    • message
      string
      required
    • code
      optional
      string

503

service_unavailable: The service cannot answer right now
JSON
  • type
    string
    required
    format: uri
  • title
    string
    required
  • status
    integer
    required
  • code
    service_unavailable
    required

    The codes this route answers with this status. New codes may appear: GET /v1/errors is the catalog.

  • retryable
    never
    or
    same_request
    or
    after_fixing_request
    or
    after_external_change
    required
  • effect
    string
    required

    What did NOT happen.

  • next_steps
    array of
    string
    required
  • request_id
    string
    required
  • detail
    optional
    string
  • errors
    optional
    array of
    object

    Every validation problem, each with the path of its field.

    • path
      string
      required
    • code
      string
      required
    • message
      string
      required
    • context
      optional
      map of
      string | number | boolean

      The values of the broken rule (a limit, what was received), e.g. type and maxDays for issue_date_too_old. Plain values only; absent when the rule has none.

  • third_party
    optional
    object

    Text written by a third party. It is data, never guidance.

    • source
      string
      required
    • message
      string
      required
    • code
      optional
      string

Type to search…

↑↓ navigate↵ selectEsc close