Supplier returns

Goods shipped back to a supplier: lines and the expected and received compensation — a credit note, replacement goods or money.

Loading the search index…

Supplier returns

Objects

SupplierReturn

  • idintegerrequired

    ID of the record, unique among records of its kind in the store.

  • numberstringrequired

    Return number.

  • statusstringrequired

    draft — stock untouched, lines editable; shipped — shipped to the supplier, stock written off, compensation expected; closed — compensation received or the refusal handled; void — voided, stock restored.

    Values:
    draftshippedclosedvoid
  • reasonstringrequired

    Return reason: defect — defective; wrong_item — wrong item; surplus — surplus; recall — batch recall; expiry — expired; other — other.

    Values:
    defectwrong_itemsurplusrecallexpiryother
  • supplier_idintegerrequired

    Supplier ID (/v1/suppliers).

  • legal_entity_idinteger or nullrequired

    Store legal entity the credit note is expected for (/v1/legal-entities); null on older returns.

  • location_idintegerrequired

    Location the goods left from (/v1/locations).

  • goods_receipt_idinteger or nullrequired

    Source goods receipt (/v1/goods-receipts); null — a return without a receipt, priced at cost.

  • purchase_order_idinteger or nullrequired

    Purchase order (/v1/purchase-orders); null without an order.

  • issued_onstring (date) or nullrequired

    Document date — the day in the statement and on paper, YYYY-MM-DD; null on a draft.

  • currencystringrequired

    Return currency, ISO 4217: line prices, subtotal and settled_amount are in it.

  • exchange_ratestring or nullrequired

    Rate of the return currency to the store currency as a decimal string, captured on shipping; null before shipping.

  • subtotalintegerrequired

    Value of the return lines in the return currency.

  • base_subtotalintegerrequired

    Value of the lines in the store currency at the captured rate.

  • expected_settlementstring or nullrequired

    What is expected from the supplier, set on shipping: credit_note — a credit note; replacement — replacement goods; refund — money; none — no compensation; null — not set.

    Values:
    credit_notereplacementrefundrejectednonenull
  • settlementstring or nullrequired

    What was received on closing: credit_note — a credit note; replacement — replacement; refund — money; rejected — the supplier refused; none — no compensation; null — not closed.

    Values:
    credit_notereplacementrefundrejectednonenull
  • settled_amountinteger or nullrequired

    Amount the supplier accepted, in the return currency; null — not yet accepted.

  • base_settled_amountinteger or nullrequired

    Accepted amount in the store currency at the captured rate; null — not yet accepted.

  • shipped_atstring (date-time) or nullrequired

    When the goods were shipped to the supplier; null on a draft.

  • closed_atstring (date-time) or nullrequired

    When the return was closed; null if not closed.

  • voided_atstring (date-time) or nullrequired

    When the return was voided; null on an active return.

  • void_reasonstring or nullrequired

    Why the return was voided; null on an active return and on older documents.

  • notestring or nullrequired

    Staff note; null if there is none.

  • linesarray of objectrequired

    Return lines.

    Fields · 15
    • idintegerrequired

      ID of the record, unique among records of its kind in the store.

    • variant_idinteger or nullrequired

      Product variant ID (/v1/variants).

    • lot_idinteger or nullrequired

      Lot of the line (/v1/lots); null for a product without lots.

    • goods_receipt_line_idinteger or nullrequired

      Source receipt line (lines[].id of the receipt) the price comes from; null on a line without a receipt.

    • purchase_order_line_idinteger or nullrequired

      Purchase order line (lines[].id of the order); null without an order.

    • unitstring or nullrequired

      Base unit of the line quantities: pcs — pieces, g — grams, ml — milliliters.

    • quantitystring or nullrequired

      Quantity shipped to the supplier, a decimal string in the base unit.

    • settled_quantitystring or nullrequired

      How much of it the supplier accepted.

    • unit_costinteger or nullrequired

      Price in the return currency per cost_per_quantity; null — no price.

    • cost_per_quantitystring or nullrequired

      Quantity in the base unit the price is for: "1000" on a weighed product means per kilogram.

    • store_unit_cost_microinteger or nullrequired

      The same price in the store currency, in millionths of the minor unit; null — no price.

    • amountintegerrequired

      Value of what was shipped at the line price; lines add up to subtotal.

    • settled_amountintegerrequired

      Value of what the supplier accepted at the line price.

    • reasonstring or nullrequired

      Line reason with the same codes as the document reason; null — the document reason applies.

      Values:
      defectwrong_itemsurplusrecallexpiryothernull
    • notestring or nullrequired

      Line note; null if there is none.

  • correctionsarray of objectrequired

    Corrections of the shipped return in order.

    Fields · 7
    • idintegerrequired

      ID of the record, unique among records of its kind in the store.

    • numberstringrequired

      Correction number.

    • reasonstringrequired

      Why it was corrected; printed on the document and visible to the supplier.

    • subtotal_beforeintegerrequired

      subtotal before the correction.

    • subtotal_afterintegerrequired

      subtotal after the correction.

    • linesarray of objectrequired

      Corrected lines, before and after.

      Fields · 6
      • supplier_return_line_idinteger or nullrequired

        Return line ID (lines[].id); null — the correction removed the line.

      • variant_idinteger or nullrequired

        Product variant of the line (/v1/variants).

      • quantity_beforestring or nullrequired

        Quantity before the correction, in the base unit.

      • quantity_afterstring or nullrequired

        Quantity after the correction, in the base unit.

      • reason_beforestring or nullrequired

        Line reason before the correction; null — the document reason applies.

        Values:
        defectwrong_itemsurplusrecallexpiryothernull
      • reason_afterstring or nullrequired

        Line reason after the correction; null — the document reason applies.

        Values:
        defectwrong_itemsurplusrecallexpiryothernull
    • created_atstring (date-time)required

      When the correction was posted.

  • created_atstring (date-time)required

    When the record was created.

  • updated_atstring (date-time)required

    When the record last changed.

Endpoints

Supplier returns: goods shipped back to the supplier and the compensation for them

get/supplier-returns

Scope: procurement:read

Parameters

Query

  • limitinteger

    Page size: up to 250 records; 50 by default.

    Minimum:
    1
    Maximum:
    250
  • cursorstring

    Opaque cursor: next_cursor of the previous page, or sync_cursor of the last page saved by the previous sync. The list goes in commit order, so the sync cursor later returns only what changed after it.

    Max length:
    4096
  • updated_sincestring (date-time)

    Only records changed after this moment, ISO 8601 with a time zone. A filter for the first sync; continue with the cursor.

    Pattern:
    ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,6})?(Z|[+-]\d{2}:\d{2})$
  • include_deletedboolean

    true — also return deleted records: archived ones with deleted_at set, and records erased from the database as tombstones {id, deleted_at} in the continuation by the sync cursor. Turn it on for a sync.

  • supplier_idinteger

    Only documents of this supplier.

    Minimum:
    1
  • goods_receipt_idinteger

    Only returns from this goods receipt.

    Minimum:
    1

Responses

200Success

application/json

  • dataarray of SupplierReturnrequired

    Records of the page.

  • deletedarray of objectrequired

    Records erased from the database since the cursor, as tombstones: only with include_deleted=true in the continuation by the sync cursor.

    Fields · 2
    • idintegerrequired

      ID of the erased record.

    • deleted_atstring (date-time)required

      When the record was erased.

  • next_cursorstring or nullrequired

    Cursor of the next page; null on the last page.

  • has_morebooleanrequired

    true when there is a next page.

  • sync_cursorstring or nullrequired

    On the last page — the cursor to continue from later: it returns only what changed after this page. null on other pages.

401The token is missing, invalid, expired or revoked

Headers

  • WWW-Authenticatestringrequired

    Authentication scheme (RFC 6750).

    Example:
    Bearer

application/problem+json

Returns Problem

403The plan, the IP address or the token scopes do not allow the request

Headers

  • WWW-Authenticatestring

    Authentication scheme (RFC 6750).

    Example:
    Bearer error="insufficient_scope", scope="locations:read"

application/problem+json

Returns ForbiddenProblem

410The sync cursor is older than the deletion retention period or was issued before the database was restored

application/problem+json

Returns Problem

422A parameter is invalid or unknown

application/problem+json

Returns ValidationProblem

429The rate limit is exhausted

Headers

  • Retry-Afterintegerrequired

    Seconds to wait before retrying.

    Minimum:
    0

application/problem+json

Returns RateLimitProblem

503The store is temporarily unavailable

Headers

  • Retry-Afterinteger

    Seconds to wait before retrying.

    Minimum:
    0

application/problem+json

Returns Problem

Errors of this endpoint

Common errors such as token, access, input validation and rate limit can come from any endpoint; they are listed in the catalog: Errors

Example request
curl "https://api.saleya.app/v1/supplier-returns" \
  -H "Authorization: Bearer $SALEYA_API_TOKEN"
Example response · 200
{
  "data": [
    {
      "id": 0,
      "number": "string",
      "status": "draft",
      "reason": "defect",
      "supplier_id": 0,
      "legal_entity_id": 0,
      "location_id": 0,
      "goods_receipt_id": 0,
      "purchase_order_id": 0,
      "issued_on": "2026-01-15",
      "currency": "string",
      "exchange_rate": "string",
      "subtotal": 0,
      "base_subtotal": 0,
      "expected_settlement": "credit_note",
      "settlement": "credit_note",
      "settled_amount": 0,
      "base_settled_amount": 0,
      "shipped_at": "2026-01-15T12:00:00Z",
      "closed_at": "2026-01-15T12:00:00Z",
      "voided_at": "2026-01-15T12:00:00Z",
      "void_reason": "string",
      "note": "string",
      "lines": [
        {
          "id": 0,
          "variant_id": 0,
          "lot_id": 0,
          "goods_receipt_line_id": 0,
          "purchase_order_line_id": 0,
          "unit": "string",
          "quantity": "string",
          "settled_quantity": "string",
          "unit_cost": 0,
          "cost_per_quantity": "string",
          "store_unit_cost_micro": 0,
          "amount": 0,
          "settled_amount": 0,
          "reason": "defect",
          "note": "string"
        }
      ],
      "corrections": [
        {
          "id": 0,
          "number": "string",
          "reason": "string",
          "subtotal_before": 0,
          "subtotal_after": 0,
          "lines": [
            {
              "supplier_return_line_id": 0,
              "variant_id": 0,
              "quantity_before": "string",
              "quantity_after": "string",
              "reason_before": "defect",
              "reason_after": "defect"
            }
          ],
          "created_at": "2026-01-15T12:00:00Z"
        }
      ],
      "created_at": "2026-01-15T12:00:00Z",
      "updated_at": "2026-01-15T12:00:00Z"
    }
  ],
  "deleted": [
    {
      "id": 0,
      "deleted_at": "2026-01-15T12:00:00Z"
    }
  ],
  "next_cursor": "string",
  "has_more": true,
  "sync_cursor": "string"
}

Supplier return

get/supplier-returns/{supplier_return}

Scope: procurement:read

Parameters

Path

  • supplier_returnintegerrequired

    Supplier return ID.

Responses

200Success

application/json

Returns SupplierReturn

401The token is missing, invalid, expired or revoked

Headers

  • WWW-Authenticatestringrequired

    Authentication scheme (RFC 6750).

    Example:
    Bearer

application/problem+json

Returns Problem

403The plan, the IP address or the token scopes do not allow the request

Headers

  • WWW-Authenticatestring

    Authentication scheme (RFC 6750).

    Example:
    Bearer error="insufficient_scope", scope="locations:read"

application/problem+json

Returns ForbiddenProblem

404The object does not exist or is not available to the app

application/problem+json

Returns Problem

422A parameter is invalid or unknown

application/problem+json

Returns ValidationProblem

429The rate limit is exhausted

Headers

  • Retry-Afterintegerrequired

    Seconds to wait before retrying.

    Minimum:
    0

application/problem+json

Returns RateLimitProblem

503The store is temporarily unavailable

Headers

  • Retry-Afterinteger

    Seconds to wait before retrying.

    Minimum:
    0

application/problem+json

Returns Problem

Common errors such as token, access, input validation and rate limit can come from any endpoint; they are listed in the catalog: Errors

Example request
curl "https://api.saleya.app/v1/supplier-returns/{supplier_return}" \
  -H "Authorization: Bearer $SALEYA_API_TOKEN"
Example response · 200
{
  "id": 0,
  "number": "string",
  "status": "draft",
  "reason": "defect",
  "supplier_id": 0,
  "legal_entity_id": 0,
  "location_id": 0,
  "goods_receipt_id": 0,
  "purchase_order_id": 0,
  "issued_on": "2026-01-15",
  "currency": "string",
  "exchange_rate": "string",
  "subtotal": 0,
  "base_subtotal": 0,
  "expected_settlement": "credit_note",
  "settlement": "credit_note",
  "settled_amount": 0,
  "base_settled_amount": 0,
  "shipped_at": "2026-01-15T12:00:00Z",
  "closed_at": "2026-01-15T12:00:00Z",
  "voided_at": "2026-01-15T12:00:00Z",
  "void_reason": "string",
  "note": "string",
  "lines": [
    {
      "id": 0,
      "variant_id": 0,
      "lot_id": 0,
      "goods_receipt_line_id": 0,
      "purchase_order_line_id": 0,
      "unit": "string",
      "quantity": "string",
      "settled_quantity": "string",
      "unit_cost": 0,
      "cost_per_quantity": "string",
      "store_unit_cost_micro": 0,
      "amount": 0,
      "settled_amount": 0,
      "reason": "defect",
      "note": "string"
    }
  ],
  "corrections": [
    {
      "id": 0,
      "number": "string",
      "reason": "string",
      "subtotal_before": 0,
      "subtotal_after": 0,
      "lines": [
        {
          "supplier_return_line_id": 0,
          "variant_id": 0,
          "quantity_before": "string",
          "quantity_after": "string",
          "reason_before": "defect",
          "reason_after": "defect"
        }
      ],
      "created_at": "2026-01-15T12:00:00Z"
    }
  ],
  "created_at": "2026-01-15T12:00:00Z",
  "updated_at": "2026-01-15T12:00:00Z"
}