> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arcuserp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Un-apply one application of a vendor credit

> Takes ONE application of a vendor credit back: the credit is open again by the amount and the bill owes it again. By what the application is attached to: a bill (with no entry of its own, the draw is restored; with its own entry, that entry is reversed by a new entry dated today or `effective_date`); a payment that drew the credit with its own entry (name the bill whose share the credit paid in `bill_id`; the payment keeps its cash and its share of that bill falls by the credit). Requires `purchasing:write` scope plus the per-user `accounting.post` permission. Refused 400 `missing_entity_id`, `invalid_vendor_credit_id`, `missing_application_id`, `missing_reason`, `invalid_bill_id`, `invalid_effective_date` or `missing_bill_id` (a payment's application names no bill); 404 `vendor_credit_not_found` or `vendor_credit_application_not_found`; 409 `vendor_credit_application_deposit_anchored` (void that deposit to restore the credit), `vendor_credit_application_inside_payment` (an application inside a payment with no entry of its own: reverse that payment), `vendor_credit_application_is_history` (the payment was voided), `vendor_credit_bill_unapply_bill_not_live`, `vendor_credit_application_changed`, `credit_restore_conflict` (a voided credit), `vendor_credit_unapply_credit_expired` (the credit has expired, by its status or a passed expiry date: an expired credit cannot be applied again, so the application stays; `expires_on` names the day), `vendor_credit_bill_unapply_entry_not_the_draw`, `vendor_credit_bill_unapply_vendor_mismatch`, `vendor_credit_bill_unapply_not_conserved`, `vendor_credit_payment_unapply_*` (the payment's state, its bank match or its share); 422 `vendor_credit_bill_unapply_period_closed` or `vendor_credit_payment_unapply_period_closed`.



## OpenAPI

````yaml /openapi.yaml post /vendor-credits/{id}/unapply
openapi: 3.1.0
info:
  title: Arcus ERP Public API
  version: 1.0.0
  description: >
    Arcus ERP public REST API. Designed for external integrations and data
    migration.


    **Authentication.** Bearer token (API key) via the `Authorization` header.

    Format: `Authorization: Bearer ark_live_ent_<code>_<random>` (or
    `ark_test_*` for sandbox).

    API keys are issued per-entity in **Settings > Developers > API Keys**.


    **Entity scoping.** The entity is encoded in the API key prefix; routes are
    flat

    (e.g. `/v1/accounts`, `/v1/orders`, `/v1/products`). A small set of platform
    endpoints

    (migration, reconciliation, events, webhook endpoints, API keys) use the

    `/v1/entities/{entity_id}/...` form -- those are noted in their tags.


    **Key capabilities.**
      - Related-resource hydration via `?expand[]=` (see `x-arcus-expand` on each resource).
      - Cursor-based pagination (`starting_after` / `ending_before` / `limit`).
      - Idempotency via the `Idempotency-Key` header.
      - Webhook events for asynchronous notification.
      - Conditional requests / ETag for cache validation.

    **Changelog.** Entries are dated and name every published contract whose
    MEANING moved, not

    only the ones whose field names changed. The narrative version of the same
    entries, written

    for integrators, is published at https://arcuserp.mintlify.app/changelog.


    **October 2026: an inventory adjustment names its reason, a key never names
    a document's uploader, and the flag

    refusals are documented.** `POST /v1/inventory/adjustments` accepts
    `reason_code` (or `adjustment_reason_id`) on a

    single-item request, at the root of a multi-item request (the reason of
    every item that sends none of its own) and

    on each item. The adjustment posts to the account the entity's adjustment
    reason names for the movement's direction,

    exactly as the adjustment screen posts it, and the answer names the reason
    and the account (`adjustment_reason`,

    `gl_account_source`, `posted_to`). A code that names none of the entity's
    active reasons is refused 422

    `adjustment_reason_not_found` with `param` and the active codes in
    `allowed_codes`, and nothing is written; a

    turned-off reason is refused 422 `adjustment_reason_inactive`; a key cannot
    choose an account other than the

    reason's (403 `adjustment_account_choice_requires_user`, or 422 with `param`
    `gl_account_id` for an account the

    adjustment picker does not offer) and cannot post above a reason's approval
    limit (403

    `adjustment_over_approval_threshold`). Before, `reason_code` was not read:
    such an adjustment, and a multi-item

    item's `adjustment_reason_id`, posted where the free text sent them.
    Deprecated: choosing the account through the

    free-text `reason`, which picks it by matching words in the text (text that
    matches none posts to the entity's

    inventory adjustments account); free text keeps choosing the account as it
    does today, and no removal date is set. A

    single-item adjustment answers 200 and a multi-item adjustment 201, as they
    always have (the page listed only 201).

    A retry with the same `Idempotency-Key` now answers the first request's
    response even when a reason, a product, a

    permission or the posting window changed in between; before, such a retry
    could answer a refusal for an

    adjustment that had already been applied. A refusal the adjustment answers
    (a turned-off reason, a product that

    holds no stock, the key creator's permission, the posting window) is
    likewise the answer of its key: once the

    cause is fixed, send the request with a new key.


    `POST /v1/documents` and `POST /v1/documents/confirm` never record a person
    from the request body: a document an API

    key creates names no uploader, and its activity rows name no user (before, a
    `user_id` or `uploaded_by` in the body

    naming an active member of the entity was recorded as that member).


    Fifteen operations answer 422 `invalid_boolean_field`, with `param` naming
    the field and nothing written, when a

    flag is not a JSON `true` or `false`, and each page now says so, naming the
    flags and the values it refuses:

    `POST /v1/locations`, `PATCH /v1/locations/{id}`, `POST` and `PATCH
    /v1/payment-terms`,

    `PATCH /v1/gl-accounts/{id}`, `PATCH /v1/accounts/{id}`, `POST
    /v1/accounts/{id}/addresses`,

    `PATCH /v1/accounts/{id}/addresses/{addr_id}`, `PATCH
    /v1/accounts/{id}/contacts/{cnt_id}`, `PATCH /v1/kits/{id}`,

    `POST` and `PATCH /v1/pricing-policies`, `POST /v1/products` (a `pricing` or
    `purchase_policies` entry),

    `PATCH /v1/products/{id}` and `POST /v1/products/{id}/pricing`. The text
    "true" or "false" and 1 are refused on

    all fifteen (on `PATCH /v1/gl-accounts/{id}` when the body carries no
    `opening_balance`), and 0 and null on all

    but `POST /v1/accounts/{id}/addresses`, which reads 0 and null as `false`
    and creates the address.

    `PATCH /v1/gl-accounts/{id}` reads its flag only when the body carries no
    `opening_balance`: a body that carries

    one posts the account's opening balance and reads no other field. The
    request bodies of

    `PATCH /v1/locations/{id}` and `POST /v1/payment-terms`, and the `pricing`
    entries of `POST /v1/products` and

    `POST /v1/products/{id}/pricing`, now list those flags as booleans. `POST
    /v1/locations` lists the fields it reads

    (`code` is required, the address is one `address` object, and `type`,
    `description`, `sort_order` and the four

    flags are listed); `POST /v1/payment-terms` reads `days` and
    `discount_percent`, not `days_due` and

    `discount_pct`, and only `name` is required; a listed field the operation
    does not read now says so.


    **October 2026: the return create and update contract says what the API
    does.** On `POST /v1/returns`,

    `original_order_id` is derived from the lines when it is omitted, and every
    line names the sales order line it

    comes back from (`items[].order_item_id`; a line without one is refused 422
    `order_line_required`, and that

    refusal is already live). Deprecated now, and answered on a 201, 400, 404 or
    422 answer with a `Deprecation: true`

    response header and a `Link` to this changelog (plus a `Sunset` header once
    the removal date is set):

    `auto_refund: true` and `refund_payment_id` (no longer honored: a return
    never refunds on its own; issue the

    refund with `POST /v1/returns/{id}/refund`; at the removal release
    `auto_refund: true` is refused 422

    `auto_refund_removed`; `auto_refund: false` asks for nothing and is not a
    deprecated use, and the field has no

    default), and the standalone return, a line that sends `product_id` and no
    `order_item_id` (already refused; its

    description leaves the spec at the removal release). `refund_method` lists
    the values the API accepts (`auto`,

    `cash`, `credit_memo`, `store_credit`); `original` and `check`, listed
    before, are refused 400

    `invalid_refund_method`. A return line's `condition` lists the values a line
    stores (`new`, `used`, `damaged`,

    `defective`); `like_new`, `good` and `fair` were never sent and leave the
    `ReturnItem` schema one release later.

    Each return operation's page now names, under the status it is answered
    with, the refusals with their own `code`

    that a request sending the fields the page documents can meet, read from the
    operation's code at every call

    depth and checked by running it: the operation's own checks (a location or a
    vendor the request names that is

    not this entity's among them), the steps it runs (the order line, the
    replacement order line, the carrier label,

    the card refund, the vendor-return line) and the ledger and stock refusals
    it can meet through the return's

    state or the entity's settings. Not repeated on every page: the refusals
    every operation shares (the API key,

    its scopes, its creator's permissions, its network rules, the rate limit and
    the `Idempotency-Key` header, whose

    two answers that header's description names); the answers the database gives
    a value its column does not take,

    on any field of the path, the query or the body: 400 `invalid_id_format`
    (not a valid id), 400

    `invalid_enum_value` (not a value of the field's type, text where a number
    belongs among them), 422 `value_too_long`

    (a text longer than the field holds), 422 `value_out_of_range` (a number
    larger than the field holds), 400

    `not_null_violation`, 400 `check_violation`, 400 `constraint_violated`, 409
    `fk_violation` and 409

    `uniq_violation` (a value a rule of the database refuses), and 409
    `serialization_failure` or 409 `deadlock` (a

    parallel update; a retry clears it), which a page also names where its own
    fields were measured to draw one; and

    an integrity refusal, which reports that records the operation reads
    disagree with each other and is answered

    with its own `code`. The two read operations now document their 400 answer,
    and the add-lines, exchange, advance

    replacement and vendor return operations the 201 they answer (their pages
    said 200). The receive-and-dispose

    lines, the exchange body and the advance replacement lines now list the
    fields of the contract those operations

    read for a caller (receive-and-dispose also reads
    `items[].serial_number_returned`, which is not yet listed); the

    disposition line lists `vendor_id`, and its `condition` lists the four
    values a return line stores (`like_new`,

    `good` and `fair` are still accepted there on a line that sends no `leaves`,
    where they never block a restock, and

    leave the list one release later; a kit line that sends `leaves` refuses
    them 400 `invalid_enum_value`); a

    documented field an operation does not read now says so.
    `estimated_refund_amount`, `money_suppression` and

    `is_pre_settlement` say what the API already did: the estimate is present
    while neither the lines nor the header

    hold a credit (the schema said "while no line holds a credit"). A bulk
    import with `conflict_mode: replace` on

    returns now answers 409 `return_replace_not_supported` naming the existing
    return and writes nothing

    (`MigrationConflictMode` says so); before, it removed the import record from
    the existing return and created a

    second return for the same goods. The webhook endpoint's event list counts
    152 events in 15 families. The

    correction documents, the refile, the returns of an order, the receive
    order, the unexpected arrival and the

    staff RA PDF stay staff-only for now: they have no api-v1 endpoint in this
    release.


    Returns: override_window now needs override_window_reason when a line is
    outside its return window; returns can

    span several orders of one customer where Settings > Returns allows it. On
    `POST /v1/returns`, `return_location_id`

    names the warehouse the goods come back to (needed when the lines span
    orders shipped from more than one

    warehouse), a return across orders names its `refund_method` (`cash`,
    `credit_memo` or `store_credit`), and a sent

    `original_order_id` must be the order of one of the lines; `POST
    /v1/returns/{id}/items` reads `override_window`

    and `override_window_reason` for a line of an order new to the return. The
    pages name the refusals:

    `original_order_not_among_lines`, `return_location_required`,
    `return_location_not_a_warehouse`,

    `refund_method_required_multi_order`, `multi_order_tax_filing_not_ready`,
    `override_window_reason_required`,

    `approval_required_for_added_lines`, and 404 `location_not_found` for a
    `return_location_id` that is not one of

    the entity's locations.


    **October 2026: credit memos in search, and the cross-resource search
    answers by scope.**

    `GET /v1/search/{object}` accepts `credit_memos`: customer credit memos by
    memo number or customer

    name, the exact memo number first, each result naming the memo's status, its
    customer and its return

    when it has one; it requires the `ar:read` scope in addition to
    `search:read` (a key without it is

    refused with 403 `insufficient_scope`), and its cursor (`starting_after`)
    continues exactly where the

    previous page ended. `GET /v1/search` now returns matches: each of its five
    buckets holds results when

    the key also holds that resource's read scope (`orders:read` for orders and
    invoices, `products:read`

    for products, `accounts:read` for accounts, `inventory:read` for serial
    numbers) and stays empty

    otherwise; until now every bucket was empty for every key.
    `meta.did_you_mean` now carries the search

    term when the results are close matches rather than exact ones. No field is
    renamed.


    **October 2026: the order status values are the ones the API sends.** The
    `Order` schema's

    `order_status`, `payment_status`, `fulfillment_status` and `document_type`
    now list the values

    the order endpoints actually return (`order_status`: draft, open,
    processing, fulfilled,

    cancelled, archived, expired, awaiting_ach_clearance; `payment_status`:
    unpaid, partial,

    processing, paid, refunded, terms, overdue, overpaid, partially_refunded;
    `fulfillment_status`:

    unfulfilled, partial, fulfilled, backordered, awaiting_pickup;
    `document_type` adds

    late_fee_invoice). The values themselves did not change; the schema had
    listed names the API

    never sends (`confirmed`, `partially_paid`, `partially_fulfilled`, `voided`,
    `on_hold`), so a

    client generated from it could reject a real order. On `POST /v1/orders`,
    `order_status` is

    limited to `draft` only for a `sales_order` or `invoice`. The refusals of
    the order, refund,

    settings and deposit endpoints are now listed with their `code` values on
    each response.


    **October 2026: a pair of bank lines in transit at a month end is an open
    item there.** `GET /v1/entities/{entity_id}/reconciliation/account-audit`,
    `answers.books_against_bank`,

    each `month_ends` row: when the two bank lines of a pair matched together to
    one bill payment (a

    wire and its return) fall on either side of that date,
    `bank_unbooked_amount` and

    `bank_unbooked_count` now include the line already in the bank, and
    `gl_uncleared_amount` and

    `gl_uncleared_count` include the payment's bank leg;
    `explained_by_open_items` therefore explains

    that date instead of leaving the part in transit unexplained. No field is
    renamed and no other

    date moves; once both lines are in the bank the pair counts nowhere, as
    every other match.


    **2026-09-22 (planned 2026-09-21), REORDER-BUYER-TRUTH: demand changed what
    it MEANS on three

    published contracts, with no field renamed.** An integrator that pins field
    names sees no

    breakage and different numbers, which is why this entry exists.

      - **Demand now counts build consumption.** `demand_avg_per_day` on the public product, kit
        and inventory-balance objects, and `daily_demand` / `demand_basis` / `net_suggested_qty`
        on `GET /v1/purchasing/reorder-report`, are composed from fulfilled sales lines PLUS
        posted `build_consume` inventory draws: each physical decrement of a product counts
        exactly once. The previous rule adopted an internal-consumption basis only when the sales
        blend was exactly zero, so a product both sold AND consumed into work orders planned as
        if the build draws did not exist. Products drawn into work orders move; on one
        production-shaped dataset five did, the largest from 0.05/day to 14.95/day.
      - **`demand_basis` now carries four values, not two:** `sales`, `sales_and_builds`,
        `builds` and `consumption`. A consumer with a two-branch reader (anything that is not
        `consumption` is `sales`) silently hides the two new ones.
      - **`current_demand_units` on `GET /v1/inventory/balances/:id` moved, by a second rule.**
        It counts committed-but-unshipped CUSTOMER demand, and it now counts a kit component's
        own line rather than its parent kit line, and excludes non-sales documents. On one
        production dataset 269 of 1,043 balance rows changed, 227 of them downward; the largest
        single move was 1,941 to 25, on a product whose open PURCHASE order line had been
        reported as customer demand. Re-baseline anything that alerts or reorders off this field.
      - `run_rate_30/90/180/365` and `blended_daily` on the same balance object move for the
        first reason above.
      - **Added, not changed:** `GET /v1/purchasing/reorder-report` accepts `demand_window` and
        returns the unit, cover-through and reorder-point-provenance fields documented on that
        operation; `order_multiple` is accepted and returned on the product-vendor doors.
      - **Volume note.** The `inventory.low_stock`, `inventory.out_of_stock` and
        `inventory.back_in_stock` webhook events are population-gated on
        `on_hand <= reorder_point`, and reorder points move with the demand above, so
        subscribers should expect a one-time step change in event volume around the release.
servers:
  - url: https://api.arcuserp.com/v1
    description: Arcus ERP API (accepts both live `ark_live_*` and test `ark_test_*` keys)
  - url: https://dev-api.arcuserp.com/v1
    description: >-
      Dev sandbox API (test-only data, accepts `ark_test_*` keys against dev
      RDS)
security: []
paths:
  /vendor-credits/{id}/unapply:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
        description: Vendor credit UUID.
      - name: Idempotency-Key
        in: header
        required: false
        schema:
          type: string
        description: >-
          A key that already un-applied this credit answers that result again
          and writes nothing.
    post:
      tags:
        - Purchasing
      summary: Un-apply one application of a vendor credit
      description: >-
        Takes ONE application of a vendor credit back: the credit is open again
        by the amount and the bill owes it again. By what the application is
        attached to: a bill (with no entry of its own, the draw is restored;
        with its own entry, that entry is reversed by a new entry dated today or
        `effective_date`); a payment that drew the credit with its own entry
        (name the bill whose share the credit paid in `bill_id`; the payment
        keeps its cash and its share of that bill falls by the credit). Requires
        `purchasing:write` scope plus the per-user `accounting.post` permission.
        Refused 400 `missing_entity_id`, `invalid_vendor_credit_id`,
        `missing_application_id`, `missing_reason`, `invalid_bill_id`,
        `invalid_effective_date` or `missing_bill_id` (a payment's application
        names no bill); 404 `vendor_credit_not_found` or
        `vendor_credit_application_not_found`; 409
        `vendor_credit_application_deposit_anchored` (void that deposit to
        restore the credit), `vendor_credit_application_inside_payment` (an
        application inside a payment with no entry of its own: reverse that
        payment), `vendor_credit_application_is_history` (the payment was
        voided), `vendor_credit_bill_unapply_bill_not_live`,
        `vendor_credit_application_changed`, `credit_restore_conflict` (a voided
        credit), `vendor_credit_unapply_credit_expired` (the credit has expired,
        by its status or a passed expiry date: an expired credit cannot be
        applied again, so the application stays; `expires_on` names the day),
        `vendor_credit_bill_unapply_entry_not_the_draw`,
        `vendor_credit_bill_unapply_vendor_mismatch`,
        `vendor_credit_bill_unapply_not_conserved`,
        `vendor_credit_payment_unapply_*` (the payment's state, its bank match
        or its share); 422 `vendor_credit_bill_unapply_period_closed` or
        `vendor_credit_payment_unapply_period_closed`.
      operationId: unapplyVendorCreditV1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - application_id
                - reason
              properties:
                application_id:
                  type: string
                  format: uuid
                  description: >-
                    The application to take back (the credit's
                    `applications[].id`).
                reason:
                  type: string
                  maxLength: 500
                  description: Why; kept on the credit and the bill.
                bill_id:
                  type: string
                  format: uuid
                  description: >-
                    An application inside a payment: the bill whose share the
                    credit paid.
                effective_date:
                  type: string
                  format: date
                  description: >-
                    The day of the reversal entry (an application with its own
                    entry); defaults to today.
      responses:
        '200':
          description: >-
            The application was taken back, or already was under this
            Idempotency-Key (`idempotent_replay`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      credit_id:
                        type: string
                        format: uuid
                      credit_number:
                        type: string
                      application_id:
                        type: string
                        format: uuid
                      anchor:
                        type: string
                        enum:
                          - bill
                          - payment
                      amount:
                        type: number
                      credit_after:
                        type: object
                        properties:
                          remaining_amount:
                            type: number
                          status:
                            type: string
                      bill_after:
                        type: object
                        nullable: true
                      payment_after:
                        type: object
                        nullable: true
                      reversal:
                        type: object
                        nullable: true
                  idempotent_replay:
                    type: boolean
        '400':
          $ref: '#/components/responses/Error'
        '401':
          $ref: '#/components/responses/Error'
        '403':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '409':
          $ref: '#/components/responses/Error'
        '422':
          $ref: '#/components/responses/Error'
        '500':
          $ref: '#/components/responses/Error'
      security:
        - ApiKeyAuth: []
components:
  responses:
    Error:
      description: Error response (400/401/403/404/409/422/429/500)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  schemas:
    ErrorEnvelope:
      type: object
      description: |
        Canonical error response envelope. All API errors use this shape.
      required:
        - error
        - code
      properties:
        error:
          type: string
          description: Machine-readable error key
          example: not_found
        code:
          type: string
          description: Machine-readable error code (often same as error)
          example: not_found
        type:
          type: string
          enum:
            - validation_error
            - permission_error
            - not_found
            - conflict
            - rate_limit
            - internal
            - expand_error
            - not_implemented
          example: not_found
        hint:
          type: string
          description: Human-readable one-sentence explanation (English)
          example: >-
            The requested order does not exist or does not belong to this
            entity.
        param:
          type: string
          description: The parameter that caused the error, if applicable
          example: expand[0]
        required:
          type: string
          description: The scope required (only on insufficient_scope errors)
          example: accounts:read
        request_id:
          type: string
          description: >-
            Unique request ID for support tracing (maps to CloudWatch log
            stream)
          example: req_abc123
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: |
        API key issued per entity via Settings > Developers > API Keys.
        Each key carries scopes (e.g. orders:read, products:write).
        Bearer token format: Authorization: Bearer ark_live_ent_<code>_<random>
        Test keys use ark_test_ent_<code>_<random>. Both are issued per entity
        via Settings > Developers > API Keys.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.