OfficeGest
Stocks/Movements

Create stock movement

Creates a new stock movement (entry, exit or transfer). The required warehouses depend on the movement type base: entry (E) requires warehouse_enter_id, exit (S) requires warehouse_exit_id, transfer (T) requires both. Articles must be of type N (Normal). Lot and serial number requirements are determined by article configuration.

POST
/stocks/movements
AuthorizationBearer <token>

In: header

descriptionstring

Movement description.

movement_type_idstring

Movement type code.

warehouse_enter_id?integer

Entry warehouse identifier. Required when movement type base is E or T.

warehouse_exit_id?integer

Exit warehouse identifier. Required when movement type base is S or T.

linesarray<object>

Movement article lines. At least one line is required.

lines.*.article_idstring

Article code. Article must be of type N (Normal).

lines.*.quantitynumber

Quantity to move. Must be greater than 0.

lines.*.lot?string

Lot code. Required when the article uses lots (delote=T).

lines.*.serial?array<unknown>

Serial numbers. Required when the article uses serial numbers (usanserie=T). Count must equal quantity.

lines.*.cost_center?string

Cost center code. Only applicable when the Accounting module is active.

lines.*.value?number

Unit value override. If omitted, the system calculates the cost price automatically.

Response Body

curl -X POST "https://og-tenant1.test:8003/api/v2/stocks/movements" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Monthly stock entry",
    "movement_type_id": "E",
    "lines": [
      {
        "article_id": "ART001",
        "quantity": 10
      }
    ],
    "lines.*.article_id": "ART001",
    "lines.*.quantity": 10
  }'
{
  "data": {
    "id": "string",
    "description": "string",
    "movement_type": {},
    "warehouse_enter": {},
    "warehouse_exit": {},
    "annulled": true,
    "date": "2019-08-24",
    "register_date": "2019-08-24T14:15:22Z",
    "lines": [
      {
        "id_movement": "string",
        "line": 0,
        "article": "string",
        "designation": "string",
        "warehouse_enter": {},
        "warehouse_exit": {},
        "quantity": 0,
        "unit": "string",
        "price_uni": 0,
        "cost_price_last": 0,
        "cost_price_medium": 0,
        "cost_price": 0,
        "cost_center": "string"
      }
    ]
  }
}
{
  "data": {
    "code": "VALIDATION_FAILED",
    "message": "The given data was invalid.",
    "errors": {
      "email": [
        "The email field is required."
      ]
    }
  },
  "meta": {
    "trace_id": "9f86d081884c7d659a2feaa0c55ad01568f3a1c2b4d5e"
  }
}
{
  "data": {
    "code": "VALIDATION_FAILED",
    "message": "The given data was invalid.",
    "errors": {
      "email": [
        "The email field is required."
      ]
    }
  },
  "meta": {
    "trace_id": "9f86d081884c7d659a2feaa0c55ad01568f3a1c2b4d5e"
  }
}
{
  "data": {
    "code": "VALIDATION_FAILED",
    "message": "The given data was invalid.",
    "errors": {
      "email": [
        "The email field is required."
      ]
    }
  },
  "meta": {
    "trace_id": "9f86d081884c7d659a2feaa0c55ad01568f3a1c2b4d5e"
  }
}
{
  "data": {
    "code": "VALIDATION_FAILED",
    "message": "The given data was invalid.",
    "errors": {
      "email": [
        "The email field is required."
      ]
    }
  },
  "meta": {
    "trace_id": "9f86d081884c7d659a2feaa0c55ad01568f3a1c2b4d5e"
  }
}