Ir al contenido

API de inventario

List the stock levels

GET
/v1/ec/stock-levels

What each establishment you reach holds of each product that tracks its stock (tracks_stock), one level per product and establishment, by product. product_id keeps one product's levels and establishment_id one establishment's. A product never counted at an establishment has no level there: it holds nothing.

Authorization

apiKey
headerAuthorizationBearer <token>

Your API key, which acts for the one business it was created for: fb_live_… keys work at api.fiscalbase.io and issue in live, and fb_sandbox_… keys work at api-sandbox.fiscalbase.io and issue in sandbox, on the simulated SRI. A key sent to the other host is refused with api_key_wrong_host, which names its host.

Query Parameters

limit?integer

How many per page, from 1 to 100.

Range1 <= value <= 100
Default20
cursor?string

The next_cursor or prev_cursor of a previous response. Without a cursor, the first page.

Lengthlength <= 200
created_at[gte]?string

Only what was created at or after this moment, ISO 8601 with its offset.

Formatdate-time
created_at[lte]?string

Only what was created at or before this moment, ISO 8601 with its offset.

Formatdate-time
updated_at[gte]?string

Only what last changed at or after this moment, ISO 8601 with its offset: poll with the time of your last read to get what changed since.

Formatdate-time
updated_at[lte]?string

Only what last changed at or before this moment, ISO 8601 with its offset.

Formatdate-time
product_id?string
Formatuuid
establishment_id?string

The establishment (GET /v1/ec/establishments).

Formatuuid

Response Body

A page of levels

application/json
  1. response
object*"list"
Value in"list"
data*array<>
next_cursor*|

The next page (older); null if there are no more.

prev_cursor*|

The previous page (newer); null on the first.

Example Request
curl -X GET 'https://api-sandbox.fiscalbase.io/v1/ec/stock-levels'
Example Response
{
  "object": "list",
  "data": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "object": "stock_level",
      "product_id": "0d012afa-f885-4e65-aeca-37e27701e2d1",
      "establishment_id": "79c2ed6a-4f04-4a25-97dc-40ebc08eda04",
      "on_hand": "string",
      "reorder_point": "string",
      "status": "in_stock",
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ],
  "next_cursor": "string",
  "prev_cursor": "string"
}

List the stock's movements

GET
/v1/ec/stock-movements

Every change of stock at the establishments you reach, newest first: what each document, held sale and adjustment moved, with what the establishment held after it. With product_id, that product's kardex. Read it by cursor to keep a system of your own in step: there is no event per movement.

Authorization

apiKey
headerAuthorizationBearer <token>

Your API key, which acts for the one business it was created for: fb_live_… keys work at api.fiscalbase.io and issue in live, and fb_sandbox_… keys work at api-sandbox.fiscalbase.io and issue in sandbox, on the simulated SRI. A key sent to the other host is refused with api_key_wrong_host, which names its host.

Query Parameters

limit?integer

How many per page, from 1 to 100.

Range1 <= value <= 100
Default20
cursor?string

The next_cursor or prev_cursor of a previous response. Without a cursor, the first page.

Lengthlength <= 200
created_at[gte]?string

Only what was created at or after this moment, ISO 8601 with its offset.

Formatdate-time
created_at[lte]?string

Only what was created at or before this moment, ISO 8601 with its offset.

Formatdate-time
updated_at[gte]?string

Only what last changed at or after this moment, ISO 8601 with its offset: poll with the time of your last read to get what changed since.

Formatdate-time
updated_at[lte]?string

Only what last changed at or before this moment, ISO 8601 with its offset.

Formatdate-time
product_id?string
Formatuuid
establishment_id?string

The establishment (GET /v1/ec/establishments).

Formatuuid
kind?string
Value in"opening""sale""sale_correction""sale_reversal""return""return_reversal""adjustment"
source_id?string

Only what one document, held sale or adjustment moved.

Formatuuid

Response Body

A page of movements

application/json
  1. response
object*"list"
Value in"list"
data*array<>
next_cursor*|

The next page (older); null if there are no more.

prev_cursor*|

The previous page (newer); null on the first.

Example Request
curl -X GET 'https://api-sandbox.fiscalbase.io/v1/ec/stock-movements'
Example Response
{
  "object": "list",
  "data": [
    {
      "object": "stock_movement",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "product_id": "0d012afa-f885-4e65-aeca-37e27701e2d1",
      "description": "string",
      "establishment_id": "79c2ed6a-4f04-4a25-97dc-40ebc08eda04",
      "kind": "opening",
      "reason": "shrinkage",
      "quantity": "string",
      "balance_after": "string",
      "occurred_on": "2019-08-24",
      "source": {
        "type": "document",
        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
        "document_type": "invoice",
        "number": "string"
      },
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ],
  "next_cursor": "string",
  "prev_cursor": "string"
}

Adjust the stock

POST
/v1/ec/stock-adjustments

Moves stock at an establishment for a reason, product by product: shrinkage, expired, damaged, a return from a consumidor final without a credit note. Each line's quantity is signed. One movement per product, with the level, at once. A mistake is corrected with another adjustment: movements are never edited. Requires an Idempotency-Key: a retry without one would move the stock again.

Authorization

apiKey
headerAuthorizationBearer <token>

Your API key, which acts for the one business it was created for: fb_live_… keys work at api.fiscalbase.io and issue in live, and fb_sandbox_… keys work at api-sandbox.fiscalbase.io and issue in sandbox, on the simulated SRI. A key sent to the other host is refused with api_key_wrong_host, which names its host.

Header Parameters

idempotency-key*string

Required. Without it a retry could move the stock again. A retry with the same key and body answers the first answer instead; the same key with another body is 409 idempotency_key_reused.

Length1 <= length <= 255

Request Body

application/json
  1. body
establishment_id*string

The establishment (GET /v1/ec/establishments).

Formatuuid
reason*string

Why: shrinkage, expired, damaged, theft, internal_use (used by the business), found, correction, return_without_credit_note (a consumidor final's return, which no credit note can carry), production (made here) or other. Writing off shrinkage is not the sworn declaration the SRI asks to deduct it.

Value in"shrinkage""expired""damaged""theft""internal_use""found""correction""return_without_credit_note""production""other"
note?string
Length1 <= length <= 500
lines*array<>
Items1 <= items <= 200

Response Body

Adjusted

application/json
  1. response
object*"stock_adjustment"
Value in"stock_adjustment"
id*string
Formatuuid
establishment_id*string

The establishment (GET /v1/ec/establishments).

Formatuuid
kind*string
Value in"opening""adjustment"
reason*|
Value in"shrinkage""expired""damaged""theft""internal_use""found""correction""return_without_credit_note""production""other"null
note*string|null
movements*array<>

The movement it wrote for each product whose quantity changed. A count that matches the shelf writes none.

created_at*string
Formatdate-time
Example Request
curl -X POST 'https://api-sandbox.fiscalbase.io/v1/ec/stock-adjustments' \
  -H 'idempotency-key: string' \
  -H 'Content-Type: application/json' \
  -d '{
  "establishment_id": "01a21860-66e9-7451-af97-7ca8c7c9efbf",
  "reason": "found",
  "lines": [
    {
      "product_id": "01a21860-6762-74e8-b8e9-7029c45a7c45",
      "quantity": "5"
    }
  ]
}'
Example Response
{
  "object": "stock_adjustment",
  "id": "01a21860-6772-7f8b-b295-6f70272f0210",
  "establishment_id": "01a21860-66e9-7451-af97-7ca8c7c9efbf",
  "kind": "adjustment",
  "reason": "found",
  "note": null,
  "movements": [
    {
      "product_id": "01a21860-6762-74e8-b8e9-7029c45a7c45",
      "quantity": "5",
      "balance_after": "5"
    }
  ],
  "created_at": "2026-11-26T15:01:40.847Z"
}
PATCH
/v1/ec/stock-levels/{product_id}/{establishment_id}

Only reorder_point: a quantity changes through movements (a sale, an adjustment, a count), never by setting it. A product with no level at the establishment yet gets one, holding nothing. Answers the level as GET /v1/ec/stock-levels lists it.

Authorization

apiKey
headerAuthorizationBearer <token>

Your API key, which acts for the one business it was created for: fb_live_… keys work at api.fiscalbase.io and issue in live, and fb_sandbox_… keys work at api-sandbox.fiscalbase.io and issue in sandbox, on the simulated SRI. A key sent to the other host is refused with api_key_wrong_host, which names its host.

Path Parameters

product_id*string
Formatuuid
establishment_id*string

The establishment (GET /v1/ec/establishments).

Formatuuid

Request Body

application/json
  1. body
reorder_point*|

At or under this the product is to be reordered at this establishment, and stock_level.fell_low is sent as it crosses it; null: never.

Response Body

The level, with its reorder point

application/json
  1. response
id*string
Formatuuid
object*"stock_level"
Value in"stock_level"
product_id*string
Formatuuid
establishment_id*string

The establishment (GET /v1/ec/establishments).

Formatuuid
on_hand*string

What the establishment holds, the sum of its movements. Negative after a sale the business let through without stock (warn), until an adjustment or a count settles it.

reorder_point*|

At or under this the product is to be reordered at this establishment; null: never.

status*string

negative below zero, out at zero, low at or under reorder_point, in_stock otherwise.

Value in"in_stock""low""out""negative"
created_at*string
Formatdate-time
updated_at*string
Formatdate-time
Example Request
curl -X PATCH 'https://api-sandbox.fiscalbase.io/v1/ec/stock-levels/497f6eca-6276-4993-bfeb-53cbbbba6f08/497f6eca-6276-4993-bfeb-53cbbbba6f08' \
  -H 'Content-Type: application/json' \
  -d '{
  "reorder_point": "4"
}'
Example Response
{
  "id": "01a21860-8556-7a59-b5c6-ebb575b91818",
  "object": "stock_level",
  "product_id": "01a21860-8531-7f83-ae5e-e3f35ed4fbd9",
  "establishment_id": "01a21860-84e7-7ea5-acad-c1a34b085f81",
  "on_hand": "10",
  "reorder_point": "4",
  "status": "in_stock",
  "created_at": "2026-11-26T15:01:48.497Z",
  "updated_at": "2026-11-26T15:01:52.668Z"
}

Count an establishment's stock

POST
/v1/ec/stock-counts

What the shelf holds now, product by product, for a system that keeps its own stock: each product's level at the establishment becomes its count, the movement being the difference, and a product counted starts tracking its stock. Inventory starts here: documents imported from before never rebuild it. Requires an Idempotency-Key.

Authorization

apiKey
headerAuthorizationBearer <token>

Your API key, which acts for the one business it was created for: fb_live_… keys work at api.fiscalbase.io and issue in live, and fb_sandbox_… keys work at api-sandbox.fiscalbase.io and issue in sandbox, on the simulated SRI. A key sent to the other host is refused with api_key_wrong_host, which names its host.

Header Parameters

idempotency-key*string

Required. Without it a retry could move the stock again. A retry with the same key and body answers the first answer instead; the same key with another body is 409 idempotency_key_reused.

Length1 <= length <= 255

Request Body

application/json
  1. body
establishment_id*string

The establishment (GET /v1/ec/establishments).

Formatuuid
lines*array<>
Items1 <= items <= 200

Response Body

Counted

application/json
  1. response
object*"stock_adjustment"
Value in"stock_adjustment"
id*string
Formatuuid
establishment_id*string

The establishment (GET /v1/ec/establishments).

Formatuuid
kind*string
Value in"opening""adjustment"
reason*|
Value in"shrinkage""expired""damaged""theft""internal_use""found""correction""return_without_credit_note""production""other"null
note*string|null
movements*array<>

The movement it wrote for each product whose quantity changed. A count that matches the shelf writes none.

created_at*string
Formatdate-time
Example Request
curl -X POST 'https://api-sandbox.fiscalbase.io/v1/ec/stock-counts' \
  -H 'idempotency-key: string' \
  -H 'Content-Type: application/json' \
  -d '{
  "establishment_id": "01a21860-84e7-7ea5-acad-c1a34b085f81",
  "lines": [
    {
      "product_id": "01a21860-8531-7f83-ae5e-e3f35ed4fbd9",
      "quantity": "10"
    }
  ]
}'
Example Response
{
  "object": "stock_adjustment",
  "id": "01a21860-8554-7d5f-8ef8-d55e404ee4e2",
  "establishment_id": "01a21860-84e7-7ea5-acad-c1a34b085f81",
  "kind": "opening",
  "reason": null,
  "note": null,
  "movements": [
    {
      "product_id": "01a21860-8531-7f83-ae5e-e3f35ed4fbd9",
      "quantity": "10",
      "balance_after": "10"
    }
  ],
  "created_at": "2026-11-26T15:01:48.497Z"
}