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

# Update a segment



## OpenAPI

````yaml /api-reference/openapi.json patch /v1/segments/{segmentId}
openapi: 3.0.0
info:
  title: Flovoo API
  description: |-
    Authenticate with an API key created from **Connectors → API**:

    ```
    Authorization: Bearer flv_...
    ```

    The organization is derived from the key, so no request carries an
    organization id.
  version: '1.0'
  contact: {}
servers: []
security: []
tags: []
paths:
  /v1/segments/{segmentId}:
    patch:
      tags:
        - Segments
      summary: Update a segment
      operationId: PublicSegmentsController_update
      parameters:
        - name: segmentId
          required: true
          in: path
          description: The segment id.
          schema:
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublicUpdateSegmentDoc'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicSegmentDoc'
        '400':
          description: >-
            The request failed validation. Every failing field is listed in
            `details`, not just the first.
          content:
            application/json:
              example:
                error:
                  type: invalid_request_error
                  code: validation_failed
                  message: The request failed validation.
                  details:
                    - param: phone
                      code: invalid_string
                      message: Invalid phone number format
                  requestId: req_01J8X4M2N9P3Q5R7
        '401':
          description: The key is missing, unknown, or revoked.
          content:
            application/json:
              examples:
                missing:
                  summary: No Authorization header
                  value:
                    error:
                      type: authentication_error
                      code: missing_api_key
                      message: No API key was provided.
                      requestId: req_01J8X4M2N9P3Q5R7
                invalid:
                  summary: Unknown key
                  value:
                    error:
                      type: authentication_error
                      code: invalid_api_key
                      message: The API key provided is not valid.
                      requestId: req_01J8X4M2N9P3Q5R7
                revoked:
                  summary: Revoked key
                  value:
                    error:
                      type: authentication_error
                      code: revoked_api_key
                      message: This API key has been revoked.
                      requestId: req_01J8X4M2N9P3Q5R7
        '403':
          description: The key is valid but lacks the route's scope.
          content:
            application/json:
              example:
                error:
                  type: permission_error
                  code: insufficient_scope
                  message: >-
                    This API key does not have the required scope:
                    contacts.create.
                  requestId: req_01J8X4M2N9P3Q5R7
        '404':
          description: No such Segment in this organization.
          content:
            application/json:
              example:
                error:
                  type: invalid_request_error
                  code: not_found
                  message: >-
                    Segment with ID 0198f2a1-8c3d-7a4e-b5f6-1a2b3c4d5e6f not
                    found in this organization.
                  requestId: req_01J8X4M2N9P3Q5R7
        '409':
          description: A segment with this name already exists in this organization.
        '429':
          description: Rate limit exceeded. `Retry-After` gives the seconds to wait.
          content:
            application/json:
              example:
                error:
                  type: rate_limit_error
                  code: rate_limit_exceeded
                  message: >-
                    Rate limit of 300 requests per minute exceeded. Retry in
                    23s.
                  requestId: req_01J8X4M2N9P3Q5R7
        '500':
          description: >-
            An error on our side. The original exception is never returned;
            quote `requestId` to support.
          content:
            application/json:
              example:
                error:
                  type: api_error
                  code: internal_error
                  message: An unexpected error occurred.
                  requestId: req_01J8X4M2N9P3Q5R7
      security:
        - api-key: []
components:
  schemas:
    PublicUpdateSegmentDoc:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 30
        filters:
          type: object
          properties:
            tagIds:
              type: array
              items:
                type: string
                format: uuid
            stageIds:
              type: array
              items:
                type: string
                format: uuid
            assigneeIds:
              type: array
              items:
                type: string
                format: uuid
            includeUnassigned:
              type: boolean
            channelIds:
              type: array
              items:
                type: string
                format: uuid
            createdAfter:
              type: string
              format: date-time
            createdBefore:
              type: string
              format: date-time
            lastUpdatedAfter:
              type: string
              format: date-time
            lastUpdatedBefore:
              type: string
              format: date-time
            lastInteractionAfter:
              type: string
              format: date-time
            lastInteractionBefore:
              type: string
              format: date-time
            phoneFilters:
              type: array
              maxItems: 5
              items:
                type: object
                properties:
                  countryCode:
                    type: string
                    maxLength: 5
                  prefix:
                    type: string
                    pattern: ^\d*$
                    maxLength: 10
                required:
                  - countryCode
                  - prefix
            adIds:
              type: array
              items:
                type: string
                minLength: 1
            campaignIds:
              type: array
              items:
                type: string
                minLength: 1
            adSetIds:
              type: array
              items:
                type: string
                minLength: 1
            adUrls:
              type: array
              items:
                type: string
                minLength: 1
            hasConversations:
              type: boolean
            sourceMethods:
              type: array
              items:
                type: string
                enum:
                  - WHATSAT
                  - INSTAGRAM
                  - FACEBOOK
                  - WAZZUP
                  - MANUAL
                  - WIDGET
                  - WHATSAPP_API_AD
                  - WHATSAPP_API_POST
                  - WHATSAPP_API_ORGANIC
                  - WHATSAPP_HISTORY_SYNC
                  - WHATSAPP_CONTACT_SYNC
                  - WHATSAPP_LITE
                  - IMPORT
                x-enumNames:
                  - WHATSAT
                  - INSTAGRAM
                  - FACEBOOK
                  - WAZZUP
                  - MANUAL
                  - WIDGET
                  - WHATSAPP_API_AD
                  - WHATSAPP_API_POST
                  - WHATSAPP_API_ORGANIC
                  - WHATSAPP_HISTORY_SYNC
                  - WHATSAPP_CONTACT_SYNC
                  - WHATSAPP_LITE
                  - IMPORT
            status:
              type: string
              enum:
                - active
                - archived
              x-enumNames:
                - ACTIVE
                - ARCHIVED
            broadcastIds:
              type: array
              items:
                type: string
                format: uuid
            isBlocked:
              type: boolean
            countries:
              type: array
              items:
                type: string
                minLength: 1
            customFieldFilters:
              type: array
              items:
                type: object
                properties:
                  fieldKey:
                    type: string
                    minLength: 1
                  values:
                    type: array
                    minItems: 1
                    items:
                      type: string
                required:
                  - fieldKey
                  - values
          x-nestjs_zod-self-required: false
      required:
        - filters
    PublicSegmentDoc:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        filters:
          type: object
          properties:
            tagIds:
              type: array
              items:
                type: string
                format: uuid
            stageIds:
              type: array
              items:
                type: string
                format: uuid
            assigneeIds:
              type: array
              items:
                type: string
                format: uuid
            includeUnassigned:
              type: boolean
            channelIds:
              type: array
              items:
                type: string
                format: uuid
            createdAfter:
              type: string
              format: date-time
            createdBefore:
              type: string
              format: date-time
            lastUpdatedAfter:
              type: string
              format: date-time
            lastUpdatedBefore:
              type: string
              format: date-time
            lastInteractionAfter:
              type: string
              format: date-time
            lastInteractionBefore:
              type: string
              format: date-time
            phoneFilters:
              type: array
              maxItems: 5
              items:
                type: object
                properties:
                  countryCode:
                    type: string
                    maxLength: 5
                  prefix:
                    type: string
                    pattern: ^\d*$
                    maxLength: 10
                required:
                  - countryCode
                  - prefix
            adIds:
              type: array
              items:
                type: string
                minLength: 1
            campaignIds:
              type: array
              items:
                type: string
                minLength: 1
            adSetIds:
              type: array
              items:
                type: string
                minLength: 1
            adUrls:
              type: array
              items:
                type: string
                minLength: 1
            hasConversations:
              type: boolean
            sourceMethods:
              type: array
              items:
                type: string
                enum:
                  - WHATSAT
                  - INSTAGRAM
                  - FACEBOOK
                  - WAZZUP
                  - MANUAL
                  - WIDGET
                  - WHATSAPP_API_AD
                  - WHATSAPP_API_POST
                  - WHATSAPP_API_ORGANIC
                  - WHATSAPP_HISTORY_SYNC
                  - WHATSAPP_CONTACT_SYNC
                  - WHATSAPP_LITE
                  - IMPORT
                x-enumNames:
                  - WHATSAT
                  - INSTAGRAM
                  - FACEBOOK
                  - WAZZUP
                  - MANUAL
                  - WIDGET
                  - WHATSAPP_API_AD
                  - WHATSAPP_API_POST
                  - WHATSAPP_API_ORGANIC
                  - WHATSAPP_HISTORY_SYNC
                  - WHATSAPP_CONTACT_SYNC
                  - WHATSAPP_LITE
                  - IMPORT
            status:
              type: string
              enum:
                - active
                - archived
              x-enumNames:
                - ACTIVE
                - ARCHIVED
            broadcastIds:
              type: array
              items:
                type: string
                format: uuid
            isBlocked:
              type: boolean
            countries:
              type: array
              items:
                type: string
                minLength: 1
            customFieldFilters:
              type: array
              items:
                type: object
                properties:
                  fieldKey:
                    type: string
                    minLength: 1
                  values:
                    type: array
                    minItems: 1
                    items:
                      type: string
                required:
                  - fieldKey
                  - values
          x-nestjs_zod-self-required: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      required:
        - id
        - name
        - filters
        - createdAt
        - updatedAt
  securitySchemes:
    api-key:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Your API key, e.g. flv_9f2a8c1e…

````