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

# Preview a stock adjustment

> Takes the body of `POST /stocks/adjustment` without `notes` and returns the current balance, the signed
difference the adjustment would apply and the resulting balance. Nothing is written. Fails with the same
errors the adjustment would; a correction to the current balance previews a zero difference.



## OpenAPI

````yaml post /v1/stocks/adjustment/preview
openapi: 3.1.0
info:
  title: Flextell API
  version: 0.0.1
  description: >-
    Flextell REST API referansı. Kimlik doğrulama, scope ve istek kuralları için
    API sekmesindeki rehberlere bakın.
servers:
  - url: https://app.flextell.ai/api
    description: Üretim
security:
  - oauth2: []
  - bearer: []
paths:
  /v1/stocks/adjustment/preview:
    post:
      tags:
        - Stock
      summary: Preview a stock adjustment
      description: >-
        Takes the body of `POST /stocks/adjustment` without `notes` and returns
        the current balance, the signed

        difference the adjustment would apply and the resulting balance. Nothing
        is written. Fails with the same

        errors the adjustment would; a correction to the current balance
        previews a zero difference.
      operationId: stock.adjustmentPreview
      parameters:
        - name: X-Tenant
          in: header
          required: true
          description: >-
            Tenant identifier. Send the Tenant ID in the `X-Tenant` header to
            scope API requests to a specific tenant.
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StockAdjustmentPreviewRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    type: object
                    properties:
                      product_id:
                        type: integer
                      warehouse_id:
                        type: integer
                      current_balance:
                        type: number
                      difference:
                        type: number
                      resulting_balance:
                        type: number
                    required:
                      - product_id
                      - warehouse_id
                      - current_balance
                      - difference
                      - resulting_balance
                required:
                  - success
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
        '428':
          description: >-
            Mandatory setup is incomplete. Finish the setup wizard first;
            `data.next_step` names the step to continue with.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    examples:
                      - false
                  error_code:
                    type: string
                    enum:
                      - SETUP_REQUIRED
                    examples:
                      - SETUP_REQUIRED
                  message:
                    type: string
                    examples:
                      - Complete the required setup steps to continue.
                  data:
                    type: object
                    properties:
                      next_step:
                        type:
                          - string
                          - 'null'
                        examples:
                          - clinic_info
                    required:
                      - next_step
                required:
                  - success
                  - error_code
                  - message
                  - data
components:
  schemas:
    StockAdjustmentPreviewRequest:
      type: object
      properties:
        product_id:
          type: integer
          description: Filter by product ID.
          minimum: 1
        warehouse_id:
          type: integer
          description: Filter by warehouse ID.
          minimum: 1
        mode:
          type: string
          description: The mode of operation.
          enum:
            - in_out
            - correction
        direction:
          type:
            - string
            - 'null'
          description: Filter by direction.
          enum:
            - in
            - out
            - null
        quantity:
          type: number
          description: The quantity value.
      required:
        - product_id
        - warehouse_id
        - mode
        - quantity
      title: StockAdjustmentPreviewRequest
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://app.flextell.ai/oauth/authorize
          tokenUrl: https://app.flextell.ai/oauth/token
          scopes:
            '*': all
    bearer:
      type: http
      scheme: bearer

````

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