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

# Create segment

> Create a Segment.



## OpenAPI

````yaml https://api.vantage.sh/v2/oas_v3.json post /segments
openapi: 3.0.1
info:
  title: Vantage
  description: Vantage API
  termsOfService: https://www.vantage.sh/terms-of-use
  contact:
    name: Vantage Support
    url: https://www.vantage.sh
    email: support@vantage.sh
  version: 2.0.0
servers:
  - url: https://api.vantage.sh/v2
security:
  - oauth2:
      - read
tags:
  - name: AccessGrants
    description: Operations about AccessGrants
  - name: AnomalyAlerts
    description: Operations about AnomalyAlerts
  - name: AnomalyNotifications
    description: Operations about AnomalyNotifications
  - name: AuditLogs
    description: Operations about AuditLogs
  - name: BillingProfiles
    description: Operations about BillingProfiles
  - name: BillingRules
    description: Operations about BillingRules
  - name: BudgetAlerts
    description: Operations about BudgetAlerts
  - name: Budgets
    description: Operations about Budgets
  - name: BusinessMetrics
    description: Operations about BusinessMetrics
  - name: Canvases
    description: Operations about Canvases
  - name: CostAlertEvents
    description: Operations about CostAlertEvents
  - name: CostAlerts
    description: Operations about CostAlerts
  - name: CostProvider
    description: Operations about CostProviders
  - name: CostProviderAccounts
    description: Operations about CostProviderAccounts
  - name: Costs
    description: Operations about Costs
  - name: CostService
    description: Operations about CostServices
  - name: Dashboards
    description: Operations about Dashboards
  - name: DataExports
    description: Operations about DataExports
  - name: ExchangeRates
    description: Operations about ExchangeRates
  - name: FinancialCommitmentReports
    description: Operations about FinancialCommitmentReports
  - name: FinancialCommitments
    description: Operations about FinancialCommitments
  - name: Folders
    description: Operations about Folders
  - name: Integrations
    description: Operations about Integrations
  - name: Invoices
    description: Operations about Invoices
  - name: KubernetesEfficiencyReports
    description: Operations about KubernetesEfficiencyReports
  - name: ManagedAccounts
    description: Operations about ManagedAccounts
  - name: Me
    description: Operations about Mes
  - name: NetworkFlowReports
    description: Operations about NetworkFlowReports
  - name: OpenAPISpecification
    description: Operations about OpenAPISpecifications
  - name: Ping
    description: Operations about Pings
  - name: Prices
    description: Operations about Prices
  - name: Recommendations
    description: Operations about Recommendations
  - name: RecommendationViews
    description: Operations about RecommendationViews
  - name: ReportNotifications
    description: Operations about ReportNotifications
  - name: ResourceReports
    description: Operations about ResourceReports
  - name: Resources
    description: Operations about Resources
  - name: SavedFilters
    description: Operations about SavedFilters
  - name: Segments
    description: Operations about Segments
  - name: Tags
    description: Operations about Tags
  - name: Teams
    description: Operations about Teams
  - name: UnitCosts
    description: Operations about UnitCosts
  - name: UserFeedback
    description: Operations about UserFeedbacks
  - name: Users
    description: Operations about Users
  - name: VirtualTags
    description: Operations about VirtualTags
  - name: Workspaces
    description: Operations about Workspaces
paths:
  /segments:
    post:
      tags:
        - Segments
      summary: Create segment
      description: Create a Segment.
      operationId: createSegment
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/createSegment'
        required: true
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Segment'
              example:
                token: fltr_sgmt_a22e3e52e9a93a75
                title: New Segment
                parent_segment_token: fltr_sgmt_7f1af73e92e5e156
                description: I'm a Segment.
                track_unallocated: false
                priority: 100
                filter: >-
                  costs.provider = 'aws' AND costs.service = 'Amazon Simple
                  Storage Service'
                created_at: '2024-05-14T14:34:24Z'
                workspace_token: wrkspc_f75aec7671a72dd3
                report_token: null
        '400':
          description: BadRequest
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
        '422':
          description: UnprocessableEntity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      security:
        - oauth2:
            - write
components:
  schemas:
    createSegment:
      required:
        - title
      type: object
      properties:
        title:
          type: string
          description: The title of the Segment.
        description:
          type: string
          description: The description of the Segment.
        priority:
          type: integer
          description: The priority of the Segment.
          format: int32
        track_unallocated:
          type: boolean
          description: >-
            Track Unallocated Costs which are not assigned to any of the created
            Segments.
          default: false
        report_settings:
          type: object
          properties:
            include_credits:
              type: boolean
              description: Reports created under this Segment will include credits.
              nullable: true
            include_refunds:
              type: boolean
              description: Reports created under this Segment will include refunds.
              nullable: true
            include_discounts:
              type: boolean
              description: Reports created under this Segment will include discounts.
              nullable: true
            include_tax:
              type: boolean
              description: Reports created under this Segment will include tax.
              nullable: true
            amortize:
              type: boolean
              description: Reports created under this Segment will amortize.
              nullable: true
          description: Report settings configurable on top-level Segments.
        workspace_token:
          type: string
          description: >-
            The token of the Workspace to add the Segment to. Ignored if
            'segment_token' is set. Required if the API token is associated with
            multiple Workspaces.
        filter:
          type: string
          description: >-
            The filter query language to apply to the Segment. Additional
            documentation available at https://docs.vantage.sh/vql.
        parent_segment_token:
          type: string
          description: >-
            The token of the parent Segment this new Segment belongs to.
            Determines the Workspace the segment is assigned to.
      description: Create a Segment.
    Segment:
      required:
        - created_at
        - description
        - filter
        - parent_segment_token
        - priority
        - report_token
        - title
        - token
        - track_unallocated
        - workspace_token
      type: object
      properties:
        token:
          type: string
          nullable: false
        title:
          type: string
          description: The title of the Segment.
          nullable: false
          example: OPEX
        parent_segment_token:
          type: string
          description: The token of the parent Segment of this Segment.
          nullable: true
        description:
          type: string
          description: The description of the Segment.
          nullable: false
          example: Operating expenses
        track_unallocated:
          type: boolean
          description: >-
            Track Unallocated Costs which are not assigned to any of the created
            Segments.
          nullable: false
          example: false
        report_settings:
          type: object
          properties:
            include_credits:
              type: boolean
              nullable: true
            include_refunds:
              type: boolean
              nullable: true
            include_discounts:
              type: boolean
              nullable: true
            include_tax:
              type: boolean
              nullable: true
            amortize:
              type: boolean
              nullable: true
          description: Report settings configurable on top-level Segments.
        priority:
          type: integer
          description: >-
            Costs are assigned in priority order across all Segments with
            assigned filters.
          format: int32
          nullable: false
          example: 100
        filter:
          type: string
          description: >-
            The filter applied to the Segment. Additional documentation
            available at https://docs.vantage.sh/vql.
          nullable: true
        created_at:
          type: string
          description: >-
            The date and time, in UTC, the Segment was created. ISO 8601
            Formatted.
          nullable: false
          example: '2021-07-09T00:00:00Z'
        workspace_token:
          type: string
          description: The token for the Workspace the Segment is a part of.
          nullable: false
        report_token:
          type: string
          description: The token for the Report the Segment has generated.
          nullable: true
      description: Segment model
    Errors:
      required:
        - errors
      type: object
      properties:
        links:
          $ref: '#/components/schemas/Links'
        errors:
          type: array
          nullable: false
          items:
            type: string
      description: Errors model
    Links:
      type: object
      properties:
        self:
          type: string
          description: The URL of the current page of results.
          nullable: true
        first:
          type: string
          description: The URL of the first page of results.
          nullable: true
        next:
          type: string
          description: The URL of the next page of results, if one exists.
          nullable: true
        last:
          type: string
          description: The URL of the last page of results, if one exists.
          nullable: true
        prev:
          type: string
          description: The URL of the previous page of results, if one exists.
          nullable: true
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://console.vantage.sh/account/profile
          scopes:
            read: Grants read access
            write: Grants write access

````