# Create Transaction

Endpoint: POST /storage_operations/goods_transactions/{location_id}
Version: 1.0.0
Security: BearerPartnerUser

## Security:

  - `BearerPartnerUser` (unknown)
    http bearer Bearer {PartnerToken}, User {UserToken}

## Path parameters:

  - `location_id` (number, required)
    location ID

## Header parameters:

  - `Accept` (string, required)
    e.g. application/vnd.api.v2+json

  - `Content-Type` (string, required)
    application/json

  - `Authorization` (string, required)
    Bearer partner_token, User user_token

## Request fields (application/json):

  - `document_id` (number, required)
    Document ID

  - `good_id` (number, required)
    Item ID

  - `amount` (number, required)
    Quantity

  - `cost_per_unit` (number, required)
    Unit cost

  - `discount` (number, required)
    Discount in %

  - `cost` (number, required)
    Total transaction amount

  - `operation_unit_type` (number, required)
    unit type: 1 - for sale, 2 - for write-off

  - `master_id` (number)
    ID of the team member who sold the product

  - `client_id` (number)
    ID of the customer who bought the product

  - `supplier_id` (number)
    Vendor ID

  - `comment` (string)
    A comment

  - `good_special_number` (string)
    Membership/subscription number. Required when selling a loyalty membership product to a specified client; must be unique.

## Response 200:

  - `200` (unknown)
    OK

## Response 200 fields (application/json):

  - `success` (boolean)
    Execution success status (true)

  - `data` (object)
    Object with data

  - `data.id` (integer)

  - `data.document_id` (integer)

  - `data.type_id` (integer)

  - `data.type` (object)
    Transaction type

  - `data.type.id` (number)
    Transaction type ID

  - `data.type.title` (string)
    Transaction type name

  - `data.company_id` (number)
    location ID

  - `data.good_id` (number)
    Product ID

  - `data.amount` (number)
    Quantity

  - `data.cost_per_unit` (number)
    Unit price

  - `data.cost` (number)
    Price

  - `data.discount` (number)
    Discount

  - `data.unit_id` (number)
    Unit ID

  - `data.storage_id` (number)
    Inventory ID

  - `data.supplier_id` (number)
    Vendor ID

  - `data.client_id` (number)
    Client ID

  - `data.master_id` (number)
    team member ID

  - `data.create_date` (string)
    date of creation

  - `data.last_change_date` (string)
    Last modified date

  - `data.comment` (string)
    A comment

  - `data.deleted` (boolean)
    Delete transaction flag

  - `data.good_special_number` (string)
    Special number (e.g., certificate code)

  - `data.service_amount` (number)
    Service quantity

  - `data.sale_amount` (number)
    Sale quantity

  - `data.service_unit_id` (number)
    Service unit ID

  - `data.sale_unit_id` (number)
    Sale unit ID

  - `data.operation_unit_type` (number)
    Operation unit type

  - `data.good` (object)
    Product

  - `data.good.id` (number)
    Product ID

  - `data.good.title` (string)
    Product Name

  - `data.good.unit` (string)
    unit of measurement

  - `data.good.value` (string)
    Product Name

  - `data.good.label` (string)
    Product Name

  - `data.good.article` (string)
    vendor code

  - `data.good.category` (string)
    Product category name

  - `data.good.category_id` (number)
    Product category ID

  - `data.good.salon_id` (number)
    location ID

  - `data.good.good_id` (number)
    Product ID

  - `data.good.cost` (number)
    Price

  - `data.good.unit_id` (number)
    Unit ID

  - `data.good.unit_short_title` (string)
    Abbreviated name of the unit of measurement

  - `data.good.service_unit_id` (number)
    Unit ID for the service

  - `data.good.service_unit_short_title` (string)
    Abbreviated name of the unit of measure for the service

  - `data.good.actual_cost` (number)
    Cost price

  - `data.good.unit_actual_cost` (number)
    unit cost

  - `data.good.unit_actual_cost_format` (string)
    Unit cost format

  - `data.good.unit_equals` (number)
    Unit value

  - `data.good.barcode` (string)
    Barcode

  - `data.good.loyalty_abonement_type_id` (number)
    Membership ID (if the product is a membership)

  - `data.good.loyalty_certificate_type_id` (number)
    Certificate identifier (if the product is a certificate)

  - `data.good.loyalty_allow_empty_code` (number)
    Is it allowed to sell without a code

  - `data.good.actual_amounts` (array)
    Quantity of products

  - `data.good.last_change_date` (string)
    Date of last product change

  - `data.good.comment` (string)
    Product comment

  - `data.good.loyalty_certificate_type` (object | null)
    Certificate type details (if product is certificate)

  - `data.good.loyalty_serial_number_limited` (number)
    Serial number limit flag

  - `data.good.is_goods_mark_enabled` (boolean)
    Whether products marking is enabled

  - `data.good.critical_amount` (number)
    Critical stock amount threshold

  - `data.good.desired_amount` (number)
    Desired stock amount

  - `data.good.is_chain` (boolean)
    Whether product belongs to chain

  - `data.sale_unit` (any)
    Sales unit (can be object or null)

  - `data.sale_unit.id` (number)

  - `data.sale_unit.company_id` (number)

  - `data.sale_unit.title` (string)

  - `data.sale_unit.short_title` (string)

  - `data.service_unit` (any)
    Sales unit for service (can be object or null)

  - `data.service_unit.id` (number)

  - `data.service_unit.company_id` (number)

  - `data.service_unit.title` (string)

  - `data.service_unit.short_title` (string)

  - `data.goods_marks` (array)
    Product marking codes

  - `data.storage` (object)
    Inventory

  - `data.storage.id` (number)
    Inventory ID

  - `data.storage.title` (string)
    Inventory name

  - `data.supplier` (array)
    The supplier

  - `data.client` (any)
    Customer (can be array or object)

  - `data.client.id` (number)

  - `data.client.name` (string)

  - `data.client.phone` (string)

  - `data.client.email` (string)

  - `data.master` (any)
    Team Member (can be array or object)

  - `data.master.id` (number)
    team member ID

  - `data.master.name` (string)
    Team Member name

  - `data.unit` (object)
    unit of measurement

  - `data.unit.id` (number)
    Unit ID

  - `data.unit.company_id` (number)
    Location ID

  - `data.unit.title` (string)
    Unit name

  - `data.unit.short_title` (string)
    Abbreviated name of the unit of measurement

  - `meta` (array)
    Metadata (empty array)

## Response 400:

  - `400` (unknown)
    Bad Request - validation errors

## Response 400 fields (application/json):

  - `success` (boolean)
    Response status.
    Example: false

  - `data` (object | null)
    Response data.
    Example: null

  - `meta` (object)
    Additional response data.

  - `meta.message` (string)
    Error message.
    Example: An error has occurred.

  - `meta.errors` (array)
    Set of a validation error messages.

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 401 fields (application/json):

  - `success` (boolean)
    Response status.
    Example: false

  - `data` (object | null)
    Response data.
    Example: null

  - `meta` (object)
    Additional response data.

  - `meta.message` (string)
    Error message.
    Example: Authentication needed.

## Response 403:

  - `403` (unknown)
    Forbidden

## Response 403 fields (application/json):

  - `success` (boolean)
    Response status.
    Example: false

  - `data` (object | null)
    Response data.
    Example: null

  - `meta` (object)
    Additional response data.

  - `meta.message` (string)
    Error message.
    Example: Access denied.

## Response 404:

  - `404` (unknown)
    Not Found

## Response 404 fields (application/json):

  - `success` (boolean)
    Response status.
    Example: false

  - `data` (object | null)
    Response data.
    Example: null

  - `meta` (object | array)
    Additional response data (empty object or empty array)
    Example: {}

