Ctrl K
ComunidadGuías…

sdk/openapi.yaml

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
openapi: 3.1.0
info:
  title: Flagsmith API
  version: v1
  description: 'Flagsmith''s Core and SDK APIs. Check out <a href=''https://docs.flagsmith.com''>Flagsmith documentation</a>.'
  contact:
    email: support@flagsmith.com
  license:
    name: BSD License
    identifier: BSD-3-Clause
servers:
  - url: 'https://edge.api.flagsmith.com'
    description: Flagsmith Edge API
paths:
  /api/v1/environment-document/:
    get:
      operationId: sdk_v1_environment_document
      description: |-
        Retrieve the environment document.
        Used by SDKs in local evaluation mode, and Edge Proxy.
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V1EnvironmentDocumentResponse'
      security:
        - Environment API Key: []
      tags:
        - sdk
  /api/v1/flags/:
    get:
      operationId: sdk_v1_flags
      description: |-
        Retrieve the feature flags for an environment.

        ---
        *Note*: when providing the `feature` query argument, this endpoint will
        return either a single object or a 404 (if the feature does not exist) rather
        than a list.

        ---
        *Note*: using this endpoint with an identifier is deprecated.
        Please use `/api/v1/identities/?identifier=<identifier>` instead.
      parameters:
        - name: feature
          in: query
          description: Name of the feature to get the state of
          schema:
            type: string
            minLength: 1
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  description: Represents a single flag (feature state) returned by the Flagsmith SDK.
                  properties:
                    feature:
                      description: 'Represents a Flagsmith feature, defined at project level.'
                      type: object
                      properties:
                        id:
                          type: integer
                        name:
                          type: string
                        type:
                          type: string
                          enum:
                            - STANDARD
                            - MULTIVARIATE
                      required:
                        - id
                        - name
                        - type
                    enabled:
                      type: boolean
                    feature_state_value:
                      nullable: true
                      oneOf:
                        - type: integer
                        - type: boolean
                        - type: string
                    variant:
                      type: string
                      nullable: true
                    reason:
                      type: string
                      nullable: true
                    metadata:
                      description: 'Additional, non-evaluation data about a feature state.'
                      type: object
                      properties:
                        experiment:
                          description: Represents the experiment a feature state is part of. Only present while the experiment is running.
                          type: object
                          properties:
                            id:
                              type: integer
                            name:
                              type: string
                            in_experiment:
                              type: boolean
                          required:
                            - id
                            - in_experiment
                            - name
                  required:
                    - enabled
                    - feature
                    - feature_state_value
      security:
        - Environment API Key: []
      tags:
        - sdk
  /api/v1/identities/:
    get:
      operationId: sdk_v1_get_identities
      description: Retrieve the flags and traits for an identity.
      parameters:
        - name: identifier
          in: query
          required: true
          schema:
            type: string
            minLength: 1
        - name: transient
          in: query
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V1IdentitiesResponse'
      security:
        - Environment API Key: []
      tags:
        - sdk
    post:
      operationId: sdk_v1_post_identities
      description: 'Identify a user, set their traits, and retrieve their flags.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/V1IdentitiesRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/V1IdentitiesRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/V1IdentitiesRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V1IdentitiesResponse'
      security:
        - Environment API Key: []
      tags:
        - sdk
components:
  schemas:
    DependencyConflictDetailSegmentCondition:
      type: object
      properties:
        property:
          anyOf:
            - type: string
            - type: 'null'
          title: Property
        operator:
          allOf:
            - $ref: '#/components/schemas/Operator2a7Enum'
          title: Operator
        value:
          anyOf:
            - type: string
            - type: 'null'
          title: Value
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
      required:
        - property
        - operator
        - value
        - description
      title: SegmentCondition
    DependencyConflictDetailSegmentRule:
      type: object
      properties:
        type:
          allOf:
            - $ref: '#/components/schemas/TypeC8eEnum'
          title: Type
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/DependencyConflictDetailSegmentCondition'
          title: Conditions
        rules:
          type: array
          items:
            $ref: '#/components/schemas/DependencyConflictDetailSegmentRule'
          title: Rules
      required:
        - type
        - conditions
      title: SegmentRule
    DependencyEdgeSegmentCondition:
      type: object
      properties:
        property:
          anyOf:
            - type: string
            - type: 'null'
          title: Property
        operator:
          allOf:
            - $ref: '#/components/schemas/Operator2a7Enum'
          title: Operator
        value:
          anyOf:
            - type: string
            - type: 'null'
          title: Value
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
      required:
        - property
        - operator
        - value
        - description
      title: SegmentCondition
    DependencyEdgeSegmentRule:
      type: object
      properties:
        type:
          allOf:
            - $ref: '#/components/schemas/TypeC8eEnum'
          title: Type
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/DependencyEdgeSegmentCondition'
          title: Conditions
        rules:
          type: array
          items:
            $ref: '#/components/schemas/DependencyEdgeSegmentRule'
          title: Rules
      required:
        - type
        - conditions
      title: SegmentRule
    DependencyListSegmentCondition:
      type: object
      properties:
        property:
          anyOf:
            - type: string
            - type: 'null'
          title: Property
        operator:
          allOf:
            - $ref: '#/components/schemas/Operator2a7Enum'
          title: Operator
        value:
          anyOf:
            - type: string
            - type: 'null'
          title: Value
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
      required:
        - property
        - operator
        - value
        - description
      title: SegmentCondition
    DependencyListSegmentRule:
      type: object
      properties:
        type:
          allOf:
            - $ref: '#/components/schemas/TypeC8eEnum'
          title: Type
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/DependencyListSegmentCondition'
          title: Conditions
        rules:
          type: array
          items:
            $ref: '#/components/schemas/DependencyListSegmentRule'
          title: Rules
      required:
        - type
        - conditions
      title: SegmentRule
    FeatureIsReferencedDetailSegmentCondition:
      type: object
      properties:
        property:
          anyOf:
            - type: string
            - type: 'null'
          title: Property
        operator:
          allOf:
            - $ref: '#/components/schemas/Operator2a7Enum'
          title: Operator
        value:
          anyOf:
            - type: string
            - type: 'null'
          title: Value
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
      required:
        - property
        - operator
        - value
        - description
      title: SegmentCondition
    FeatureIsReferencedDetailSegmentRule:
      type: object
      properties:
        type:
          allOf:
            - $ref: '#/components/schemas/TypeC8eEnum'
          title: Type
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/FeatureIsReferencedDetailSegmentCondition'
          title: Conditions
        rules:
          type: array
          items:
            $ref: '#/components/schemas/FeatureIsReferencedDetailSegmentRule'
          title: Rules
      required:
        - type
        - conditions
      title: SegmentRule
    Operator2a7Enum:
      type: string
      enum:
        - EQUAL
        - GREATER_THAN
        - LESS_THAN
        - LESS_THAN_INCLUSIVE
        - CONTAINS
        - GREATER_THAN_INCLUSIVE
        - NOT_CONTAINS
        - NOT_EQUAL
        - REGEX
        - PERCENTAGE_SPLIT
        - MODULO
        - IS_SET
        - IS_NOT_SET
        - IN
    TypeC8eEnum:
      type: string
      enum:
        - ALL
        - ANY
        - NONE
    TypeD77Enum:
      description: |-
        * `STANDARD` - STANDARD
        * `MULTIVARIATE` - MULTIVARIATE
      type: string
      enum:
        - STANDARD
        - MULTIVARIATE
    V1EnvironmentDocumentResponse:
      description: |-
        `/api/v1/environment-documents/` response.

        Powers Flagsmith SDK's local evaluation mode.
      type: object
      properties:
        api_key:
          type: string
          title: Api Key
        feature_states:
          type: array
          items:
            $ref: '#/components/schemas/V1EnvironmentDocumentResponseFeatureState'
          title: Feature States
        identity_overrides:
          type: array
          items:
            $ref: '#/components/schemas/V1EnvironmentDocumentResponseIdentityOverride'
          title: Identity Overrides
        name:
          type: string
          title: Name
        project:
          $ref: '#/components/schemas/V1EnvironmentDocumentResponseProject'
      required:
        - api_key
        - feature_states
        - identity_overrides
        - name
        - project
      title: V1EnvironmentDocumentResponse
    V1EnvironmentDocumentResponseExperimentMetadata:
      description: Represents the experiment a feature state is part of. Only present while the experiment is running.
      type: object
      properties:
        id:
          type: integer
          title: Id
        name:
          type: string
          title: Name
        in_experiment:
          type: boolean
          title: In Experiment
      required:
        - id
        - name
        - in_experiment
      title: ExperimentMetadata
    V1EnvironmentDocumentResponseFeature:
      description: 'Represents a Flagsmith feature, defined at project level.'
      type: object
      properties:
        id:
          type: integer
          title: Id
        name:
          type: string
          title: Name
        type:
          allOf:
            - $ref: '#/components/schemas/TypeD77Enum'
          title: Type
      required:
        - id
        - name
        - type
      title: Feature
    V1EnvironmentDocumentResponseFeatureSegment:
      description: Represents data specific to a segment feature override.
      type: object
      properties:
        priority:
          anyOf:
            - type: integer
            - type: 'null'
          title: Priority
      required:
        - priority
      title: FeatureSegment
    V1EnvironmentDocumentResponseFeatureState:
      description: 'Used to define the state of a feature for an environment, segment overrides, and identity overrides.'
      type: object
      properties:
        feature:
          $ref: '#/components/schemas/V1EnvironmentDocumentResponseFeature'
        enabled:
          type: boolean
          title: Enabled
        feature_state_value:
          anyOf:
            - type: integer
            - type: boolean
            - type: string
            - type: 'null'
          title: Feature State Value
        featurestate_uuid:
          type: string
          format: uuid
          title: Featurestate Uuid
        feature_segment:
          anyOf:
            - $ref: '#/components/schemas/V1EnvironmentDocumentResponseFeatureSegment'
            - type: 'null'
        multivariate_feature_state_values:
          type: array
          items:
            $ref: '#/components/schemas/V1EnvironmentDocumentResponseMultivariateFeatureStateValue'
          title: Multivariate Feature State Values
        metadata:
          $ref: '#/components/schemas/V1EnvironmentDocumentResponseFeatureStateMetadata'
      required:
        - feature
        - enabled
        - feature_state_value
        - featurestate_uuid
        - feature_segment
        - multivariate_feature_state_values
      title: FeatureState
    V1EnvironmentDocumentResponseFeatureStateMetadata:
      description: 'Additional, non-evaluation data about a feature state.'
      type: object
      properties:
        experiment:
          $ref: '#/components/schemas/V1EnvironmentDocumentResponseExperimentMetadata'
      additionalProperties: true
      title: FeatureStateMetadata
    V1EnvironmentDocumentResponseIdentityOverride:
      description: 'Represents an identity override, defining feature states specific to an identity.'
      type: object
      properties:
        identifier:
          type: string
          title: Identifier
        identity_features:
          type: array
          items:
            $ref: '#/components/schemas/V1EnvironmentDocumentResponseFeatureState'
          title: Identity Features
      required:
        - identifier
        - identity_features
      title: IdentityOverride
    V1EnvironmentDocumentResponseMultivariateFeatureOption:
      description: Represents a single multivariate feature option in the Flagsmith UI.
      type: object
      properties:
        value:
          type: string
          title: Value
      required:
        - value
      title: MultivariateFeatureOption
    V1EnvironmentDocumentResponseMultivariateFeatureStateValue:
      description: Represents a multivariate feature state value.
      type: object
      properties:
        id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Id
        mv_fs_value_uuid:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          title: Mv Fs Value Uuid
        percentage_allocation:
          type: number
          title: Percentage Allocation
        multivariate_feature_option:
          $ref: '#/components/schemas/V1EnvironmentDocumentResponseMultivariateFeatureOption'
      required:
        - id
        - mv_fs_value_uuid
        - percentage_allocation
        - multivariate_feature_option
      title: MultivariateFeatureStateValue
    V1EnvironmentDocumentResponseProject:
      description: 'Represents a Flagsmith project. For SDKs, this is mainly used to convey segment data.'
      type: object
      properties:
        segments:
          type: array
          items:
            $ref: '#/components/schemas/V1EnvironmentDocumentResponseSegment'
          title: Segments
      required:
        - segments
      title: Project
    V1EnvironmentDocumentResponseSegment:
      description: Represents a Flagsmith segment. Carries rules and feature overrides.
      type: object
      properties:
        id:
          type: integer
          title: Id
        name:
          type: string
          title: Name
        rules:
          type: array
          items:
            $ref: '#/components/schemas/V1EnvironmentDocumentResponseSegmentRule'
          title: Rules
        feature_states:
          type: array
          items:
            $ref: '#/components/schemas/V1EnvironmentDocumentResponseFeatureState'
          title: Feature States
      required:
        - id
        - name
        - rules
      title: Segment
    V1EnvironmentDocumentResponseSegmentCondition:
      description: Represents a condition within a segment rule used by Flagsmith engine.
      type: object
      properties:
        operator:
          allOf:
            - $ref: '#/components/schemas/Operator2a7Enum'
          title: Operator
        value:
          type: string
          title: Value
        property_:
          type: string
          title: Property
      required:
        - operator
        - value
        - property_
      title: SegmentCondition
    V1EnvironmentDocumentResponseSegmentRule:
      description: Represents a rule within a segment used by Flagsmith engine. Root rules usually contain nested rules.
      type: object
      properties:
        type:
          allOf:
            - $ref: '#/components/schemas/TypeC8eEnum'
          title: Type
        rules:
          type: array
          items:
            $ref: '#/components/schemas/V1EnvironmentDocumentResponseSegmentRule'
          title: Rules
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/V1EnvironmentDocumentResponseSegmentCondition'
          title: Conditions
      required:
        - type
        - rules
        - conditions
      title: SegmentRule
    V1IdentitiesRequest:
      description: |-
        `/api/v1/identities/` request.

        Used to retrieve flags for an identity and store its traits.
      type: object
      properties:
        identifier:
          type: string
          title: Identifier
        traits:
          anyOf:
            - items:
                $ref: '#/components/schemas/V1IdentitiesRequestTraitInput'
              type: array
            - type: 'null'
          title: Traits
        transient:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Transient
      required:
        - identifier
      title: V1IdentitiesRequest
    V1IdentitiesRequestTraitInput:
      description: Represents a key-value pair trait provided as input when creating or updating an identity.
      type: object
      properties:
        trait_key:
          type: string
          title: Trait Key
        trait_value:
          anyOf:
            - type: integer
            - type: number
            - type: boolean
            - type: string
            - type: 'null'
          title: Trait Value
        transient:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Transient
      required:
        - trait_key
        - trait_value
      title: TraitInput
    V1IdentitiesResponse:
      description: |-
        `/api/v1/identities/` response.

        Represents the identity created or updated, along with its flags.
      type: object
      properties:
        identifier:
          type: string
          title: Identifier
        flags:
          type: array
          items:
            $ref: '#/components/schemas/V1IdentitiesResponseV1Flag'
          title: Flags
        traits:
          type: array
          items:
            $ref: '#/components/schemas/V1IdentitiesResponseTrait'
          title: Traits
      required:
        - identifier
        - flags
        - traits
      title: V1IdentitiesResponse
    V1IdentitiesResponseExperimentMetadata:
      description: Represents the experiment a feature state is part of. Only present while the experiment is running.
      type: object
      properties:
        id:
          type: integer
          title: Id
        name:
          type: string
          title: Name
        in_experiment:
          type: boolean
          title: In Experiment
      required:
        - id
        - name
        - in_experiment
      title: ExperimentMetadata
    V1IdentitiesResponseFeature:
      description: 'Represents a Flagsmith feature, defined at project level.'
      type: object
      properties:
        id:
          type: integer
          title: Id
        name:
          type: string
          title: Name
        type:
          allOf:
            - $ref: '#/components/schemas/TypeD77Enum'
          title: Type
      required:
        - id
        - name
        - type
      title: Feature
    V1IdentitiesResponseFeatureStateMetadata:
      description: 'Additional, non-evaluation data about a feature state.'
      type: object
      properties:
        experiment:
          $ref: '#/components/schemas/V1IdentitiesResponseExperimentMetadata'
      additionalProperties: true
      title: FeatureStateMetadata
    V1IdentitiesResponseTrait:
      description: Represents a key-value pair associated with an identity.
      type: object
      properties:
        trait_key:
          type: string
          title: Trait Key
        trait_value:
          anyOf:
            - type: integer
            - type: number
            - type: boolean
            - type: string
            - type: 'null'
          title: Trait Value
      required:
        - trait_key
        - trait_value
      title: Trait
    V1IdentitiesResponseV1Flag:
      description: Represents a single flag (feature state) returned by the Flagsmith SDK.
      type: object
      properties:
        feature:
          $ref: '#/components/schemas/V1IdentitiesResponseFeature'
        enabled:
          type: boolean
          title: Enabled
        feature_state_value:
          anyOf:
            - type: integer
            - type: boolean
            - type: string
            - type: 'null'
          title: Feature State Value
        variant:
          anyOf:
            - type: string
            - type: 'null'
          title: Variant
        reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reason
        metadata:
          $ref: '#/components/schemas/V1IdentitiesResponseFeatureStateMetadata'
      required:
        - feature
        - enabled
        - feature_state_value
      title: V1Flag
  securitySchemes:
    Cohort Sync Key:
      type: http
      scheme: bearer
      description: 'For cohort sync endpoints called by an external cohort source, such as Amplitude.'
    Cohort Sync Key (Basic):
      type: http
      scheme: basic
      description: 'For cohort sync endpoints called by an external cohort source that can only send Basic credentials, such as Mixpanel. The key is the password; the username is ignored.'
    Environment API Key:
      type: apiKey
      in: header
      name: X-Environment-Key
      description: 'For SDK endpoints. <a href=''https://docs.flagsmith.com/clients/rest#public-api-endpoints''>Find out more</a>.'
    Master API Key:
      type: apiKey
      in: header
      name: Authorization
      description: 'For Management API endpoints. <a href=''https://docs.flagsmith.com/integrating-with-flagsmith/flagsmith-api-overview/management-api''>Find out more</a>.'
    basicAuth:
      type: http
      scheme: basic
    tokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Token-based authentication with required prefix "Token"
tags:
  - name: sdk
    description: 'SDK endpoints for flags, identities, and traits.'
$schema: 'https://spec.openapis.org/oas/3.1/dialect/base'