> ## 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.

# Create a stock count



## OpenAPI

````yaml https://dev.flextell.ai/docs/api.json post /v1/stocks/count
openapi: 3.1.0
info:
  title: Flextell API
  version: 0.0.1
  description: '## Flextell API'
servers:
  - url: https://dev.flextell.ai/api
security:
  - oauth2: []
  - bearer: []
paths:
  /v1/stocks/count:
    post:
      tags:
        - Stock
      summary: Create a stock count
      operationId: stock.count
      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/StockCountRequest'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    type: object
                    properties:
                      items:
                        type: array
                        items:
                          anyOf:
                            - type: object
                              properties:
                                count:
                                  type: 'null'
                                movement:
                                  $ref: '#/components/schemas/StockMovementResource'
                              required:
                                - count
                                - movement
                            - type: object
                              properties:
                                count:
                                  $ref: '#/components/schemas/StockCountResource'
                                movement:
                                  anyOf:
                                    - $ref: >-
                                        #/components/schemas/StockMovementResource
                                    - type: 'null'
                              required:
                                - count
                                - movement
                    required:
                      - items
                required:
                  - success
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    StockCountRequest:
      type: object
      properties:
        warehouse_id:
          type: integer
          description: Filter by warehouse ID.
          minimum: 1
        notes:
          type:
            - string
            - 'null'
          description: Internal notes.
          maxLength: 65535
        items:
          type: array
          description: List of items.
          items:
            type: object
            properties:
              product_id:
                type: integer
                description: The items.*.product ID.
                minimum: 1
              boxes:
                type:
                  - number
                  - 'null'
                description: The items.*.boxes.
                minimum: 0
              inner_units:
                type:
                  - number
                  - 'null'
                description: The items.*.inner units.
                minimum: 0
              base_units:
                type:
                  - number
                  - 'null'
                description: The items.*.base units.
                minimum: 0
            required:
              - product_id
          minItems: 1
      required:
        - warehouse_id
        - items
      title: StockCountRequest
    StockMovementResource:
      type: object
      properties:
        id:
          type: integer
        product:
          type: object
          properties:
            id:
              type: integer
            name:
              type: string
          required:
            - id
            - name
        warehouse:
          type: object
          properties:
            id:
              type: integer
            name:
              type: string
          required:
            - id
            - name
        type:
          type: string
        direction:
          type: string
        quantity:
          type: number
        unit_label:
          type: string
        reference:
          type:
            - string
            - 'null'
        user:
          type: object
          properties:
            id:
              type:
                - integer
                - 'null'
            name:
              type: string
          required:
            - id
            - name
        notes:
          type:
            - string
            - 'null'
        effective_at:
          type: string
          format: date-time
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - product
        - warehouse
        - type
        - direction
        - quantity
        - unit_label
        - reference
        - user
        - notes
        - effective_at
        - created_at
        - updated_at
      title: StockMovementResource
    StockCountResource:
      type: object
      properties:
        id:
          type: integer
        product:
          type: object
          properties:
            id:
              type: integer
            name:
              type: string
          required:
            - id
            - name
        warehouse:
          type: object
          properties:
            id:
              type: integer
            name:
              type: string
          required:
            - id
            - name
        counted_quantity:
          type: number
        system_quantity:
          type: number
        difference:
          type: number
        user:
          type: object
          properties:
            id:
              type:
                - integer
                - 'null'
            name:
              type: string
          required:
            - id
            - name
        notes:
          type:
            - string
            - 'null'
        counted_at:
          type: string
          format: date-time
        adjustment_movement_id:
          type:
            - string
            - 'null'
        adjustment_movement:
          anyOf:
            - $ref: '#/components/schemas/StockMovementResource'
            - type: 'null'
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - product
        - warehouse
        - counted_quantity
        - system_quantity
        - difference
        - user
        - notes
        - counted_at
        - adjustment_movement_id
        - created_at
        - updated_at
      title: StockCountResource
  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://dev.flextell.ai/oauth/authorize
          tokenUrl: https://dev.flextell.ai/oauth/token
          scopes:
            '*': all
    bearer:
      type: http
      scheme: bearer

````