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



## OpenAPI

````yaml /api-referansi/openapi.json post /v1/salespeople
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/salespeople:
    post:
      tags:
        - Salesperson
      summary: Create a salesperson
      operationId: salesperson.store
      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/SalespersonStoreRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
        '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:
    SalespersonStoreRequest:
      type: object
      properties:
        name:
          type: string
          description: Salesperson's name.
          maxLength: 255
        email:
          type: string
          format: email
          description: Salesperson's email address.
          maxLength: 255
        set_password:
          type:
            - boolean
            - 'null'
          description: >-
            Whether an explicit password is provided. When false, a random
            password is generated and a reset link is sent.
        password:
          type:
            - string
            - 'null'
          description: Salesperson's password. Required when set_password is true.
          minLength: 8
        password_confirmation:
          type:
            - string
            - 'null'
          description: Salesperson's password confirmation. Must match the password field.
          minLength: 8
        phone:
          type:
            - string
            - 'null'
          description: Salesperson's phone number.
          maxLength: 20
        language:
          type:
            - array
            - 'null'
          description: Salesperson's language preferences.
          items:
            type: string
            description: A language preference value.
            enum:
              - Turkish
              - English
              - Other
        avatar_url:
          type:
            - string
            - 'null'
          description: Salesperson's avatar URL.
          maxLength: 1000
        is_active:
          type:
            - boolean
            - 'null'
          description: Salesperson's active status.
        active_lead_cap:
          type:
            - integer
            - 'null'
          description: >-
            Maximum number of active leads the salesperson may hold at once.
            Ignored when is_lead_cap_unlimited is true.
          minimum: 0
          maximum: 100
        is_lead_cap_unlimited:
          type:
            - boolean
            - 'null'
          description: >-
            Whether the salesperson may hold an unlimited number of active
            leads. When true, active_lead_cap is not enforced.
        treatment_ids:
          type:
            - array
            - 'null'
          description: An array of treatment IDs the salesperson handles.
          items:
            type: integer
            description: A treatment ID.
            minimum: 1
        work_hours:
          type:
            - array
            - 'null'
          description: >-
            The weekly working hours, exactly one row per day from monday to
            sunday.
          items:
            type: object
            properties:
              day:
                type: string
                description: The weekday the row applies to.
                enum:
                  - monday
                  - tuesday
                  - wednesday
                  - thursday
                  - friday
                  - saturday
                  - sunday
              enabled:
                type: boolean
                description: Whether the salesperson works on this day.
              open:
                type:
                  - string
                  - 'null'
                description: >-
                  The opening time in H:i format. Required when the day is
                  enabled.
              close:
                type:
                  - string
                  - 'null'
                description: >-
                  The closing time in H:i format. Required when the day is
                  enabled.
            required:
              - day
              - enabled
          minItems: 7
          maxItems: 7
      required:
        - name
        - email
      title: SalespersonStoreRequest
  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

````

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