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

# Availablespace Segment

> Check if there is space available for a specific segment to be allocated.
 Used when a segment is coordinated before trying to allocate it.



## OpenAPI

````yaml /api/flags/api/segment.openapi.json post /v1/segments/{segment}:segmentAvailableSpace
openapi: 3.1.0
info:
  title: Confidence Segment API
  version: 1.0.0
  description: API documentation for segment
servers: []
security: []
paths:
  /v1/segments/{segment}:segmentAvailableSpace:
    post:
      summary: Availablespace Segment
      description: >-
        Check if there is space available for a specific segment to be
        allocated.
         Used when a segment is coordinated before trying to allocate it.
      operationId: Segment.availablespace
      parameters:
        - name: segment
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                queryParams:
                  type: object
                  properties:
                    targeting:
                      $ref: '#/components/schemas/confidence.flags.types.v1.Targeting'
                      description: >-
                        The targeting to filter by. More space can be free if
                        specific targeting is used. For instance an already
                         existing segment in one country may use space in that country, but targeting another country can safely overlap.
                    exclusivityTags:
                      type: array
                      items:
                        type: string
                      description: >-
                        Set of tags that can be used to coordinate this segment
                        with others.
                    exclusiveTo:
                      type: array
                      items:
                        type: string
                      description: |2-

                         List of tags that this segment is exclusive to, meaning that an entity
                         cannot be in this segment and also in any segment that has a tag in the
                         list.
                  description: Parameters to query the segment by
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  availableSpace:
                    type: object
                    properties:
                      value:
                        type: string
                        description: |-
                          The decimal value, as a string.

                           The string representation consists of an optional sign, `+` (`U+002B`)
                           or `-` (`U+002D`), followed by a sequence of zero or more decimal digits
                           ("the integer"), optionally followed by a fraction, optionally followed
                           by an exponent.

                           The fraction consists of a decimal point followed by zero or more decimal
                           digits. The string must contain at least one digit in either the integer
                           or the fraction. The number formed by the sign, the integer and the
                           fraction is referred to as the significand.

                           The exponent consists of the character `e` (`U+0065`) or `E` (`U+0045`)
                           followed by one or more decimal digits.

                           Services **should** normalize decimal values before storing them by:

                             - Removing an explicitly-provided `+` sign (`+2.5` -{">"} `2.5`).
                             - Replacing a zero-length integer value with `0` (`.5` -{">"} `0.5`).
                             - Coercing the exponent character to lower-case (`2.5E8` -{">"} `2.5e8`).
                             - Removing an explicitly-provided zero exponent (`2.5e0` -{">"} `2.5`).

                           Services **may** perform additional normalization based on its own needs
                           and the internal decimal implementation selected, such as shifting the
                           decimal point and exponent value together (example: `2.5e-1` {"<"}-{">"} `0.25`).
                           Additionally, services **may** preserve trailing zeroes in the fraction
                           to indicate increased precision, but are not required to do so.

                           Note that only the `.` character is supported to divide the integer
                           and the fraction; `,` **should not** be supported regardless of locale.
                           Additionally, thousand separators **should not** be supported. If a
                           service does support them, values **must** be normalized.

                           The ENBF grammar is:

                               DecimalString =
                                 [Sign] Significand [Exponent];

                               Sign = '+' | '-';

                               Significand =
                                 Digits ['.'] [Digits] | [Digits] '.' Digits;

                               Exponent = ('e' | 'E') [Sign] Digits;

                               Digits = \{ '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' };

                           Services **should** clearly document the range of supported values, the
                           maximum supported precision (total number of digits), and, if applicable,
                           the scale (number of digits after the decimal point), as well as how it
                           behaves when receiving out-of-bounds values.

                           Services **may** choose to accept values passed as input even when the
                           value has a higher precision or scale than the service supports, and
                           **should** round the value to fit the supported scale. Alternatively, the
                           service **may** error with `400 Bad Request` (`INVALID_ARGUMENT` in gRPC)
                           if precision would be lost.

                           Services **should** error with `400 Bad Request` (`INVALID_ARGUMENT` in
                           gRPC) if the service receives a value outside of the supported range.
                    description: The amount of space available to the segment.
                  relatedSegments:
                    type: array
                    items:
                      type: string
                    description: >-
                      The resource names of segments that coordinate with the
                      current segment.
                  reclaimableSpace:
                    type: array
                    items:
                      type: object
                      additionalProperties:
                        type: object
                        properties:
                          value:
                            type: string
                            description: |-
                              The decimal value, as a string.

                               The string representation consists of an optional sign, `+` (`U+002B`)
                               or `-` (`U+002D`), followed by a sequence of zero or more decimal digits
                               ("the integer"), optionally followed by a fraction, optionally followed
                               by an exponent.

                               The fraction consists of a decimal point followed by zero or more decimal
                               digits. The string must contain at least one digit in either the integer
                               or the fraction. The number formed by the sign, the integer and the
                               fraction is referred to as the significand.

                               The exponent consists of the character `e` (`U+0065`) or `E` (`U+0045`)
                               followed by one or more decimal digits.

                               Services **should** normalize decimal values before storing them by:

                                 - Removing an explicitly-provided `+` sign (`+2.5` -{">"} `2.5`).
                                 - Replacing a zero-length integer value with `0` (`.5` -{">"} `0.5`).
                                 - Coercing the exponent character to lower-case (`2.5E8` -{">"} `2.5e8`).
                                 - Removing an explicitly-provided zero exponent (`2.5e0` -{">"} `2.5`).

                               Services **may** perform additional normalization based on its own needs
                               and the internal decimal implementation selected, such as shifting the
                               decimal point and exponent value together (example: `2.5e-1` {"<"}-{">"} `0.25`).
                               Additionally, services **may** preserve trailing zeroes in the fraction
                               to indicate increased precision, but are not required to do so.

                               Note that only the `.` character is supported to divide the integer
                               and the fraction; `,` **should not** be supported regardless of locale.
                               Additionally, thousand separators **should not** be supported. If a
                               service does support them, values **must** be normalized.

                               The ENBF grammar is:

                                   DecimalString =
                                     [Sign] Significand [Exponent];

                                   Sign = '+' | '-';

                                   Significand =
                                     Digits ['.'] [Digits] | [Digits] '.' Digits;

                                   Exponent = ('e' | 'E') [Sign] Digits;

                                   Digits = \{ '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' };

                               Services **should** clearly document the range of supported values, the
                               maximum supported precision (total number of digits), and, if applicable,
                               the scale (number of digits after the decimal point), as well as how it
                               behaves when receiving out-of-bounds values.

                               Services **may** choose to accept values passed as input even when the
                               value has a higher precision or scale than the service supports, and
                               **should** round the value to fit the supported scale. Alternatively, the
                               service **may** error with `400 Bad Request` (`INVALID_ARGUMENT` in gRPC)
                               if precision would be lost.

                               Services **should** error with `400 Bad Request` (`INVALID_ARGUMENT` in
                               gRPC) if the service receives a value outside of the supported range.
                    description: >-
                      The amount of space that would be returned if a specific
                      segment is archived.

                       The key is the resource name of the segment.
                       The value is the amount of space reclaimed.
      security:
        - admin: []
      servers:
        - url: https://flags.eu.confidence.dev
        - url: https://flags.us.confidence.dev
        - url: https://flags.confidence.dev
components:
  schemas:
    confidence.flags.types.v1.Targeting:
      title: Targeting
      type: object
      description: ''
      properties:
        criteria:
          type: array
          items:
            type: object
            additionalProperties:
              $ref: >-
                #/components/schemas/confidence.flags.types.v1.Targeting.Criterion
        expression:
          type: object
          properties:
            ref:
              type: string
            not:
              type: object
              description: >-
                A boolean expression with leaf nodes that reference criteria
                elements
            and:
              type: object
              properties:
                operands:
                  type: array
                  items:
                    type: object
                  description: >-
                    A boolean expression with leaf nodes that reference criteria
                    elements
            or:
              type: object
              properties:
                operands:
                  type: array
                  items:
                    type: object
                  description: >-
                    A boolean expression with leaf nodes that reference criteria
                    elements
          description: >-
            A boolean expression with leaf nodes that reference criteria
            elements
    confidence.flags.types.v1.Targeting.Criterion:
      title: Targeting.Criterion
      type: object
      description: ''
      properties:
        attribute:
          type: object
          properties:
            attributeName:
              type: string
            eqRule:
              type: object
              properties:
                value:
                  type: object
                  properties:
                    boolValue:
                      type: boolean
                    numberValue:
                      type: number
                    stringValue:
                      type: string
                    timestampValue:
                      type: object
                    versionValue:
                      type: object
                      properties:
                        version:
                          type: string
                    listValue:
                      type: object
                      properties:
                        values:
                          type: array
                          items:
                            type: object
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                  description: |-
                    equality (==, !=, ∈) defined for all types
                     comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
              description: same as SetRule with a single value
            setRule:
              type: object
              properties:
                values:
                  type: array
                  items:
                    type: object
                    properties:
                      boolValue:
                        type: boolean
                      numberValue:
                        type: number
                      stringValue:
                        type: string
                      timestampValue:
                        type: object
                      versionValue:
                        type: object
                        properties:
                          version:
                            type: string
                      listValue:
                        type: object
                        properties:
                          values:
                            type: array
                            items:
                              type: object
                            description: |-
                              equality (==, !=, ∈) defined for all types
                               comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                  description: |-
                    equality (==, !=, ∈) defined for all types
                     comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
              description: |-
                represents a set of allowed values
                 in \{a, b, c}  -{">"} x == a || x == b || x == c || ...
                 not in \{a, b} -{">"} x != a && x != b && ...
            rangeRule:
              type: object
              properties:
                startInclusive:
                  type: object
                  properties:
                    boolValue:
                      type: boolean
                    numberValue:
                      type: number
                    stringValue:
                      type: string
                    timestampValue:
                      type: object
                    versionValue:
                      type: object
                      properties:
                        version:
                          type: string
                    listValue:
                      type: object
                      properties:
                        values:
                          type: array
                          items:
                            type: object
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                  description: |-
                    equality (==, !=, ∈) defined for all types
                     comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                startExclusive:
                  type: object
                  properties:
                    boolValue:
                      type: boolean
                    numberValue:
                      type: number
                    stringValue:
                      type: string
                    timestampValue:
                      type: object
                    versionValue:
                      type: object
                      properties:
                        version:
                          type: string
                    listValue:
                      type: object
                      properties:
                        values:
                          type: array
                          items:
                            type: object
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                  description: |-
                    equality (==, !=, ∈) defined for all types
                     comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                endInclusive:
                  type: object
                  properties:
                    boolValue:
                      type: boolean
                    numberValue:
                      type: number
                    stringValue:
                      type: string
                    timestampValue:
                      type: object
                    versionValue:
                      type: object
                      properties:
                        version:
                          type: string
                    listValue:
                      type: object
                      properties:
                        values:
                          type: array
                          items:
                            type: object
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                  description: |-
                    equality (==, !=, ∈) defined for all types
                     comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                endExclusive:
                  type: object
                  properties:
                    boolValue:
                      type: boolean
                    numberValue:
                      type: number
                    stringValue:
                      type: string
                    timestampValue:
                      type: object
                    versionValue:
                      type: object
                      properties:
                        version:
                          type: string
                    listValue:
                      type: object
                      properties:
                        values:
                          type: array
                          items:
                            type: object
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                  description: |-
                    equality (==, !=, ∈) defined for all types
                     comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
              description: |-
                represents a criteria on a value using inequalities
                 closed range start, end -{">"} start {"<"}[=] x && x {"<"}[=] end
                 open end start, ...     -{">"} start {"<"}[=] x
                 open start ..., end     -{">"} x {"<"}[=] end
            anyRule:
              type: object
              properties:
                rule:
                  type: object
                  properties:
                    eqRule:
                      type: object
                      properties:
                        value:
                          type: object
                          properties:
                            boolValue:
                              type: boolean
                            numberValue:
                              type: number
                            stringValue:
                              type: string
                            timestampValue:
                              type: object
                            versionValue:
                              type: object
                              properties:
                                version:
                                  type: string
                            listValue:
                              type: object
                              properties:
                                values:
                                  type: array
                                  items:
                                    type: object
                                  description: |-
                                    equality (==, !=, ∈) defined for all types
                                     comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                      description: same as SetRule with a single value
                    setRule:
                      type: object
                      properties:
                        values:
                          type: array
                          items:
                            type: object
                            properties:
                              boolValue:
                                type: boolean
                              numberValue:
                                type: number
                              stringValue:
                                type: string
                              timestampValue:
                                type: object
                              versionValue:
                                type: object
                                properties:
                                  version:
                                    type: string
                              listValue:
                                type: object
                                properties:
                                  values:
                                    type: array
                                    items:
                                      type: object
                                    description: |-
                                      equality (==, !=, ∈) defined for all types
                                       comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                      description: |-
                        represents a set of allowed values
                         in \{a, b, c}  -{">"} x == a || x == b || x == c || ...
                         not in \{a, b} -{">"} x != a && x != b && ...
                    rangeRule:
                      type: object
                      properties:
                        startInclusive:
                          type: object
                          properties:
                            boolValue:
                              type: boolean
                            numberValue:
                              type: number
                            stringValue:
                              type: string
                            timestampValue:
                              type: object
                            versionValue:
                              type: object
                              properties:
                                version:
                                  type: string
                            listValue:
                              type: object
                              properties:
                                values:
                                  type: array
                                  items:
                                    type: object
                                  description: |-
                                    equality (==, !=, ∈) defined for all types
                                     comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                        startExclusive:
                          type: object
                          properties:
                            boolValue:
                              type: boolean
                            numberValue:
                              type: number
                            stringValue:
                              type: string
                            timestampValue:
                              type: object
                            versionValue:
                              type: object
                              properties:
                                version:
                                  type: string
                            listValue:
                              type: object
                              properties:
                                values:
                                  type: array
                                  items:
                                    type: object
                                  description: |-
                                    equality (==, !=, ∈) defined for all types
                                     comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                        endInclusive:
                          type: object
                          properties:
                            boolValue:
                              type: boolean
                            numberValue:
                              type: number
                            stringValue:
                              type: string
                            timestampValue:
                              type: object
                            versionValue:
                              type: object
                              properties:
                                version:
                                  type: string
                            listValue:
                              type: object
                              properties:
                                values:
                                  type: array
                                  items:
                                    type: object
                                  description: |-
                                    equality (==, !=, ∈) defined for all types
                                     comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                        endExclusive:
                          type: object
                          properties:
                            boolValue:
                              type: boolean
                            numberValue:
                              type: number
                            stringValue:
                              type: string
                            timestampValue:
                              type: object
                            versionValue:
                              type: object
                              properties:
                                version:
                                  type: string
                            listValue:
                              type: object
                              properties:
                                values:
                                  type: array
                                  items:
                                    type: object
                                  description: |-
                                    equality (==, !=, ∈) defined for all types
                                     comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                      description: |-
                        represents a criteria on a value using inequalities
                         closed range start, end -{">"} start {"<"}[=] x && x {"<"}[=] end
                         open end start, ...     -{">"} start {"<"}[=] x
                         open start ..., end     -{">"} x {"<"}[=] end
                    startsWithRule:
                      type: object
                      properties:
                        value:
                          type: string
                      description: matches if the string value starts with the given prefix
                    endsWithRule:
                      type: object
                      properties:
                        value:
                          type: string
                      description: matches if the string value ends with the given suffix
              description: |-
                is match if at least one input item matches the inner rule
                 is not match if the input list is empty/missing
            allRule:
              type: object
              properties:
                rule:
                  type: object
                  properties:
                    eqRule:
                      type: object
                      properties:
                        value:
                          type: object
                          properties:
                            boolValue:
                              type: boolean
                            numberValue:
                              type: number
                            stringValue:
                              type: string
                            timestampValue:
                              type: object
                            versionValue:
                              type: object
                              properties:
                                version:
                                  type: string
                            listValue:
                              type: object
                              properties:
                                values:
                                  type: array
                                  items:
                                    type: object
                                  description: |-
                                    equality (==, !=, ∈) defined for all types
                                     comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                      description: same as SetRule with a single value
                    setRule:
                      type: object
                      properties:
                        values:
                          type: array
                          items:
                            type: object
                            properties:
                              boolValue:
                                type: boolean
                              numberValue:
                                type: number
                              stringValue:
                                type: string
                              timestampValue:
                                type: object
                              versionValue:
                                type: object
                                properties:
                                  version:
                                    type: string
                              listValue:
                                type: object
                                properties:
                                  values:
                                    type: array
                                    items:
                                      type: object
                                    description: |-
                                      equality (==, !=, ∈) defined for all types
                                       comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                      description: |-
                        represents a set of allowed values
                         in \{a, b, c}  -{">"} x == a || x == b || x == c || ...
                         not in \{a, b} -{">"} x != a && x != b && ...
                    rangeRule:
                      type: object
                      properties:
                        startInclusive:
                          type: object
                          properties:
                            boolValue:
                              type: boolean
                            numberValue:
                              type: number
                            stringValue:
                              type: string
                            timestampValue:
                              type: object
                            versionValue:
                              type: object
                              properties:
                                version:
                                  type: string
                            listValue:
                              type: object
                              properties:
                                values:
                                  type: array
                                  items:
                                    type: object
                                  description: |-
                                    equality (==, !=, ∈) defined for all types
                                     comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                        startExclusive:
                          type: object
                          properties:
                            boolValue:
                              type: boolean
                            numberValue:
                              type: number
                            stringValue:
                              type: string
                            timestampValue:
                              type: object
                            versionValue:
                              type: object
                              properties:
                                version:
                                  type: string
                            listValue:
                              type: object
                              properties:
                                values:
                                  type: array
                                  items:
                                    type: object
                                  description: |-
                                    equality (==, !=, ∈) defined for all types
                                     comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                        endInclusive:
                          type: object
                          properties:
                            boolValue:
                              type: boolean
                            numberValue:
                              type: number
                            stringValue:
                              type: string
                            timestampValue:
                              type: object
                            versionValue:
                              type: object
                              properties:
                                version:
                                  type: string
                            listValue:
                              type: object
                              properties:
                                values:
                                  type: array
                                  items:
                                    type: object
                                  description: |-
                                    equality (==, !=, ∈) defined for all types
                                     comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                        endExclusive:
                          type: object
                          properties:
                            boolValue:
                              type: boolean
                            numberValue:
                              type: number
                            stringValue:
                              type: string
                            timestampValue:
                              type: object
                            versionValue:
                              type: object
                              properties:
                                version:
                                  type: string
                            listValue:
                              type: object
                              properties:
                                values:
                                  type: array
                                  items:
                                    type: object
                                  description: |-
                                    equality (==, !=, ∈) defined for all types
                                     comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                          description: |-
                            equality (==, !=, ∈) defined for all types
                             comparison ({"<"}, {"<"}=, {">"}, {">"}=) defined for number, timestamp, version
                      description: |-
                        represents a criteria on a value using inequalities
                         closed range start, end -{">"} start {"<"}[=] x && x {"<"}[=] end
                         open end start, ...     -{">"} start {"<"}[=] x
                         open start ..., end     -{">"} x {"<"}[=] end
                    startsWithRule:
                      type: object
                      properties:
                        value:
                          type: string
                      description: matches if the string value starts with the given prefix
                    endsWithRule:
                      type: object
                      properties:
                        value:
                          type: string
                      description: matches if the string value ends with the given suffix
              description: |-
                is match if each and every input item matches the inner rule
                 is also match if the input field is empty/missing
            startsWithRule:
              type: object
              properties:
                value:
                  type: string
              description: matches if the string value starts with the given prefix
            endsWithRule:
              type: object
              properties:
                value:
                  type: string
              description: matches if the string value ends with the given suffix
        segment:
          type: object
          properties:
            segment:
              type: string
        materializedSegment:
          type: object
          properties:
            materializedSegment:
              type: string
  securitySchemes:
    admin:
      type: http
      scheme: bearer

````