Rapidata RankingFlowItem API

The RankingFlowItem API from Rapidata — 4 operation(s) for rankingflowitem.

OpenAPI Specification

rapidata-rankingflowitem-api-openapi.yml Raw ↑
openapi: 3.0.4
info:
  title: Rapidata Asset RankingFlowItem API
  description: The API for the Rapidata Asset service
  version: v1
servers:
- url: https://api.rapidata.ai/
tags:
- name: RankingFlowItem
  x-displayName: RankingFlowItem
paths:
  /flow/ranking/{flowId}/item:
    post:
      tags:
      - RankingFlowItem
      summary: Creates a new flow item for the specified flow.
      parameters:
      - name: flowId
        in: path
        description: The ID of the flow to create the item in.
        required: true
        schema:
          type: string
      requestBody:
        description: The flow item creation parameters.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFlowItemEndpoint_Input'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateFlowItemEndpoint_Output'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationProblemDetails'
        '401':
          description: Unauthenticated
        '403':
          description: Forbidden
      security:
      - OpenIdConnect:
        - openid
        - profile
        - email
        - offline_access
    get:
      tags:
      - RankingFlowItem
      summary: Queries flow items for a flow.
      parameters:
      - name: flowId
        in: path
        description: The ID of the flow to query items for.
        required: true
        schema:
          type: string
      - name: page
        in: query
        description: The 1-based page index.
        schema:
          type: integer
        x-parameter-group: page
      - name: page_size
        in: query
        description: The number of items per page.
        schema:
          type: integer
        x-parameter-group: page
      - name: sort
        in: query
        description: Sort fields. Prefix with - for descending order (e.g. -created_at).
        schema:
          type: array
          items:
            enum:
            - state
            - -state
            - created_at
            - -created_at
            type: string
        x-parameter-group: sort
      - name: state
        in: query
        description: Filter by state.
        style: deepObject
        explode: true
        schema:
          type: object
          properties:
            eq:
              type: string
            neq:
              type: string
            gt:
              type: string
            gte:
              type: string
            lt:
              type: string
            lte:
              type: string
            contains:
              type: string
            starts_with:
              type: string
            ends_with:
              type: string
            in:
              type: array
              items:
                type: string
            not_contains:
              type: string
        x-parameter-group: filters
      - name: created_at
        in: query
        description: Filter by created_at.
        style: deepObject
        explode: true
        schema:
          type: object
          properties:
            eq:
              type: string
            neq:
              type: string
            gt:
              type: string
            gte:
              type: string
            lt:
              type: string
            lte:
              type: string
            contains:
              type: string
            starts_with:
              type: string
            ends_with:
              type: string
            in:
              type: array
              items:
                type: string
            not_contains:
              type: string
        x-parameter-group: filters
      - name: logic
        in: query
        description: 'How to combine the field filters: "and" (default) requires every filter to match, "or" requires any of them to match.'
        schema:
          enum:
          - and
          - or
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryFlowItemsEndpoint_PagedResultOfOutput'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationProblemDetails'
        '401':
          description: Unauthenticated
        '403':
          description: Forbidden
      security:
      - OpenIdConnect:
        - openid
        - profile
        - email
        - offline_access
  /flow/ranking/item/{flowItemId}:
    get:
      tags:
      - RankingFlowItem
      summary: Retrieves a flow item by its ID.
      parameters:
      - name: flowItemId
        in: path
        description: The ID of the flow item to retrieve.
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetFlowItemByIdEndpoint_Output'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationProblemDetails'
        '401':
          description: Unauthenticated
        '403':
          description: Forbidden
      security:
      - OpenIdConnect:
        - openid
        - profile
        - email
        - offline_access
  /flow/ranking/item/{flowItemId}/results:
    get:
      tags:
      - RankingFlowItem
      summary: Returns ranking results with Elo scores for a completed flow item.
      description: Returns 409 Conflict if the flow item is not yet completed or has no associated workflow.
      parameters:
      - name: flowItemId
        in: path
        description: The ID of the flow item to get results for.
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetRankingFlowItemResultsEndpoint_Output'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationProblemDetails'
        '401':
          description: Unauthenticated
        '403':
          description: Forbidden
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
      security:
      - OpenIdConnect:
        - openid
        - profile
        - email
        - offline_access
  /flow/ranking/item/{flowItemId}/vote-matrix:
    get:
      tags:
      - RankingFlowItem
      summary: Retrieves the pairwise vote matrix for a completed flow item.
      description: Returns 409 Conflict if the flow item is not completed or has no associated workflow.
      parameters:
      - name: flowItemId
        in: path
        description: The ID of the flow item to get the vote matrix for.
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetRankingFlowItemVoteMatrixEndpoint_Output'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationProblemDetails'
        '401':
          description: Unauthenticated
        '403':
          description: Forbidden
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
      security:
      - OpenIdConnect:
        - openid
        - profile
        - email
        - offline_access
components:
  schemas:
    MetadataModelCollection:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/IMetadataModel'
    IMetadataModelClassificationMetadataModel:
      required:
      - classification
      - _t
      properties:
        _t:
          enum:
          - ClassificationMetadata
          type: string
        classification:
          type: string
    IMetadataModelTextMetadataModel:
      required:
      - text
      - _t
      properties:
        _t:
          enum:
          - TextMetadata
          type: string
        text:
          type: string
          nullable: true
    MetadataVisibilities:
      type: array
      items:
        enum:
        - None
        - Users
        - Customers
        - Admins
        - Dashboard
        - All
        type: string
    IAssetModelNullAssetModel:
      required:
      - metadata
      - identifier
      - _t
      properties:
        _t:
          enum:
          - NullAsset
          type: string
        metadata:
          $ref: '#/components/schemas/MetadataModelCollection'
        identifier:
          type: string
    IAssetInputMultiAssetInput:
      required:
      - assets
      - _t
      properties:
        _t:
          enum:
          - MultiAssetInput
          type: string
        assets:
          type: array
          items:
            $ref: '#/components/schemas/IAssetInput'
        metadata:
          type: object
          oneOf:
          - $ref: '#/components/schemas/MetadataInputCollection'
          nullable: true
        identifier:
          type: string
          nullable: true
    IMetadataModelFileTypeMetadataModel:
      required:
      - fileType
      - _t
      properties:
        _t:
          enum:
          - FileTypeMetadata
          type: string
        fileType:
          $ref: '#/components/schemas/FileType'
    IMetadataModel:
      required:
      - _t
      type: object
      oneOf:
      - $ref: '#/components/schemas/IMetadataModelClassificationMetadataModel'
      - $ref: '#/components/schemas/IMetadataModelCountMetadataModel'
      - $ref: '#/components/schemas/IMetadataModelFileTypeMetadataModel'
      - $ref: '#/components/schemas/IMetadataModelImageDimensionMetadataModel'
      - $ref: '#/components/schemas/IMetadataModelLocationMetadataModel'
      - $ref: '#/components/schemas/IMetadataModelOriginalFilenameMetadataModel'
      - $ref: '#/components/schemas/IMetadataModelSourceUrlMetadataModel'
      - $ref: '#/components/schemas/IMetadataModelStreamsMetadataModel'
      - $ref: '#/components/schemas/IMetadataModelTextMetadataModel'
      - $ref: '#/components/schemas/IMetadataModelVideoDurationMetadataModel'
      discriminator:
        propertyName: _t
        mapping:
          ClassificationMetadata: '#/components/schemas/IMetadataModelClassificationMetadataModel'
          CountMetadata: '#/components/schemas/IMetadataModelCountMetadataModel'
          FileTypeMetadata: '#/components/schemas/IMetadataModelFileTypeMetadataModel'
          ImageDimensionMetadata: '#/components/schemas/IMetadataModelImageDimensionMetadataModel'
          LocationMetadata: '#/components/schemas/IMetadataModelLocationMetadataModel'
          OriginalFilenameMetadata: '#/components/schemas/IMetadataModelOriginalFilenameMetadataModel'
          SourceUrlMetadataModel: '#/components/schemas/IMetadataModelSourceUrlMetadataModel'
          StreamsMetadata: '#/components/schemas/IMetadataModelStreamsMetadataModel'
          TextMetadata: '#/components/schemas/IMetadataModelTextMetadataModel'
          VideoDurationMetadata: '#/components/schemas/IMetadataModelVideoDurationMetadataModel'
    IAssetModelMultiAssetModel:
      required:
      - assets
      - metadata
      - identifier
      - _t
      properties:
        _t:
          enum:
          - MultiAsset
          type: string
        assets:
          type: array
          items:
            $ref: '#/components/schemas/IAssetModel'
        metadata:
          $ref: '#/components/schemas/MetadataModelCollection'
        identifier:
          type: string
    QueryFlowItemsEndpoint_Output:
      required:
      - id
      - datasetId
      - state
      - createdAt
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the flow item.
        datasetId:
          type: string
          description: The ID of the dataset used by this flow item.
        workflowId:
          type: string
          description: The ID of the workflow created for this flow item.
          nullable: true
        state:
          allOf:
          - $ref: '#/components/schemas/FlowItemState'
          description: The current state of the flow item.
        context:
          type: string
          description: Optional context associated with this flow item.
          nullable: true
        contextAsset:
          allOf:
          - $ref: '#/components/schemas/IAssetModel'
          description: Optional asset context associated with this flow item.
        failureMessage:
          type: string
          description: The failure message if the flow item failed.
          nullable: true
        createdAt:
          type: string
          description: The timestamp when the flow item was created.
          format: date-time
        startedAt:
          type: string
          description: The timestamp when the flow item started processing.
          format: date-time
          nullable: true
        completedAt:
          type: string
          description: The timestamp when the flow item completed.
          format: date-time
          nullable: true
        failedAt:
          type: string
          description: The timestamp when the flow item failed.
          format: date-time
          nullable: true
    IMetadataModelSourceUrlMetadataModel:
      required:
      - url
      - _t
      properties:
        _t:
          enum:
          - SourceUrlMetadataModel
          type: string
        url:
          type: string
    IMetadataModelVideoDurationMetadataModel:
      required:
      - duration
      - _t
      properties:
        _t:
          enum:
          - VideoDurationMetadata
          type: string
        duration:
          type: string
          format: date-time
    FlowItemState:
      enum:
      - Pending
      - Running
      - Completed
      - Failed
      - Stopping
      - Stopped
      - Incomplete
    IMetadataModelStreamsMetadataModel:
      required:
      - hasVideo
      - hasAudio
      - hasSubtitles
      - _t
      properties:
        _t:
          enum:
          - StreamsMetadata
          type: string
        hasVideo:
          type: boolean
        hasAudio:
          type: boolean
        hasSubtitles:
          type: boolean
    ValidationProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
    IAssetInputTextAssetInput:
      required:
      - text
      - _t
      properties:
        _t:
          enum:
          - TextAssetInput
          type: string
        text:
          type: string
        metadata:
          type: object
          oneOf:
          - $ref: '#/components/schemas/MetadataInputCollection'
          nullable: true
        identifier:
          type: string
          nullable: true
    GetRankingFlowItemResultsEndpoint_Output_Datapoint:
      required:
      - id
      - asset
      - elo
      type: object
      properties:
        id:
          type: string
        asset:
          $ref: '#/components/schemas/IAssetModel'
        elo:
          type: integer
          format: int32
    CreateFlowItemEndpoint_Output:
      required:
      - flowItemId
      type: object
      properties:
        flowItemId:
          type: string
          description: The ID of the created flow item.
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
    IAssetModelTextAssetModel:
      required:
      - text
      - metadata
      - identifier
      - _t
      properties:
        _t:
          enum:
          - TextAsset
          type: string
        text:
          type: string
        metadata:
          $ref: '#/components/schemas/MetadataModelCollection'
        identifier:
          type: string
    QueryFlowItemsEndpoint_PagedResultOfOutput:
      required:
      - total
      - page
      - pageSize
      - items
      type: object
      properties:
        total:
          type: integer
          format: int64
        page:
          type: integer
          format: int32
        pageSize:
          type: integer
          format: int32
        items:
          type: array
          items:
            $ref: '#/components/schemas/QueryFlowItemsEndpoint_Output'
        totalPages:
          type: integer
          format: int32
    IMetadataInputTextMetadataInput:
      required:
      - text
      - visibilities
      - _t
      properties:
        _t:
          enum:
          - TextMetadataInput
          type: string
        text:
          type: string
          nullable: true
        visibilities:
          $ref: '#/components/schemas/MetadataVisibilities'
    IAssetInput:
      required:
      - _t
      type: object
      oneOf:
      - $ref: '#/components/schemas/IAssetInputExistingAssetInput'
      - $ref: '#/components/schemas/IAssetInputMultiAssetInput'
      - $ref: '#/components/schemas/IAssetInputTextAssetInput'
      discriminator:
        propertyName: _t
        mapping:
          ExistingAssetInput: '#/components/schemas/IAssetInputExistingAssetInput'
          MultiAssetInput: '#/components/schemas/IAssetInputMultiAssetInput'
          TextAssetInput: '#/components/schemas/IAssetInputTextAssetInput'
    IMetadataModelOriginalFilenameMetadataModel:
      required:
      - originalFilename
      - _t
      properties:
        _t:
          enum:
          - OriginalFilenameMetadata
          type: string
        originalFilename:
          type: string
    IAssetModel:
      required:
      - _t
      type: object
      oneOf:
      - $ref: '#/components/schemas/IAssetModelFileAssetModel'
      - $ref: '#/components/schemas/IAssetModelMultiAssetModel'
      - $ref: '#/components/schemas/IAssetModelNullAssetModel'
      - $ref: '#/components/schemas/IAssetModelTextAssetModel'
      discriminator:
        propertyName: _t
        mapping:
          FileAsset: '#/components/schemas/IAssetModelFileAssetModel'
          MultiAsset: '#/components/schemas/IAssetModelMultiAssetModel'
          NullAsset: '#/components/schemas/IAssetModelNullAssetModel'
          TextAsset: '#/components/schemas/IAssetModelTextAssetModel'
    GetRankingFlowItemResultsEndpoint_Output:
      required:
      - datapoints
      - totalVotes
      type: object
      properties:
        datapoints:
          allOf:
          - type: array
            items:
              $ref: '#/components/schemas/GetRankingFlowItemResultsEndpoint_Output_Datapoint'
          description: The ranked datapoints with their Elo scores.
        totalVotes:
          type: integer
          description: The total number of votes across all datapoints.
          format: int64
    FileType:
      enum:
      - Unknown
      - Image
      - Video
      - Audio
    CreateFlowItemEndpoint_Input:
      required:
      - datasetId
      type: object
      properties:
        datasetId:
          type: string
          description: The ID of the dataset to use for this flow item.
        context:
          type: string
          description: Optional context to provide additional ranking guidance.
          nullable: true
        contextAsset:
          allOf:
          - $ref: '#/components/schemas/IAssetInput'
          description: Optional asset context to provide additional ranking guidance.
        timeToLiveInSeconds:
          type: integer
          description: Optional time-to-live in seconds before the flow item expires. Must be between 60 seconds and 1 hour; defaults to 1 hour when omitted.
          format: int32
          nullable: true
        drainDurationInSeconds:
          type: integer
          description: Optional drain duration in seconds. When set, rapids are paused this many seconds before TTL expiry to allow in-flight responses to complete.
          format: int32
          nullable: true
    GetRankingFlowItemVoteMatrixEndpoint_Output:
      required:
      - index
      - columns
      - data
      type: object
      properties:
        index:
          allOf:
          - type: array
            items:
              type: string
          description: Row labels of the vote matrix.
        columns:
          allOf:
          - type: array
            items:
              type: string
          description: Column labels of the vote matrix.
        data:
          allOf:
          - type: array
            items:
              type: array
              items:
                type: number
                format: double
          description: The vote counts as a two-dimensional matrix where Data[i][j] is the number of times row i was preferred over column j.
    MetadataInputCollection:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/IMetadataInput'
    IMetadataModelImageDimensionMetadataModel:
      required:
      - _t
      properties:
        _t:
          enum:
          - ImageDimensionMetadata
          type: string
        height:
          type: integer
          format: int32
        width:
          type: integer
          format: int32
    IMetadataModelCountMetadataModel:
      required:
      - count
      - _t
      properties:
        _t:
          enum:
          - CountMetadata
          type: string
        count:
          type: integer
          format: int32
    IMetadataModelLocationMetadataModel:
      required:
      - x
      - y
      - _t
      properties:
        _t:
          enum:
          - LocationMetadata
          type: string
        x:
          type: number
          format: float
        y:
          type: number
          format: float
    IMetadataInput:
      required:
      - _t
      type: object
      oneOf:
      - $ref: '#/components/schemas/IMetadataInputTextMetadataInput'
      discriminator:
        propertyName: _t
        mapping:
          TextMetadataInput: '#/components/schemas/IMetadataInputTextMetadataInput'
    IAssetInputExistingAssetInput:
      required:
      - name
      - _t
      properties:
        _t:
          enum:
          - ExistingAssetInput
          type: string
        name:
          type: string
        metadata:
          type: object
          oneOf:
          - $ref: '#/components/schemas/MetadataInputCollection'
          nullable: true
        identifier:
          type: string
          nullable: true
    IAssetModelFileAssetModel:
      required:
      - fileName
      - metadata
      - identifier
      - _t
      properties:
        _t:
          enum:
          - FileAsset
          type: string
        fileName:
          type: string
        metadata:
          $ref: '#/components/schemas/MetadataModelCollection'
        identifier:
          type: string
    GetFlowItemByIdEndpoint_Output:
      required:
      - id
      - flowId
      - datasetId
      - state
      - createdAt
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the flow item.
        flowId:
          type: string
          description: The ID of the flow this item belongs to.
        datasetId:
          type: string
          description: The ID of the dataset used by this flow item.
        workflowId:
          type: string
          description: The ID of the workflow created for this flow item.
          nullable: true
        state:
          allOf:
          - $ref: '#/components/schemas/FlowItemState'
          description: The current state of the flow item.
        context:
          type: string
          description: Optional context associated with this flow item.
          nullable: true
        contextAsset:
          allOf:
          - $ref: '#/components/schemas/IAssetModel'
          description: Optional asset context associated with this flow item.
        failureMessage:
          type: string
          description: The failure message if the flow item failed.
          nullable: true
        expiresAt:
          type: string
          description: The expiration timestamp of the flow item.
          format: date-time
          nullable: true
        createdAt:
          type: string
          description: The timestamp when the flow item was created.
          format: date-time
        startedAt:
          type: string
          description: The timestamp when the flow item started processing.
          format: date-time
          nullable: true
        completedAt:
          type: string
          description: The timestamp when the flow item completed.
          format: date-time
          nullable: true
        failedAt:
          type: string
          description: The timestamp when the flow item failed.
          format: date-time
          nullable: true
  securitySchemes:
    OpenIdConnect:
      type: openIdConnect
      description: OpenID Connect connection flow
      openIdConnectUrl: https://auth.rapidata.ai/.well-known/openid-configuration
x-tagGroups:
- name: Rapidata Asset API
  tags:
  - Asset
  - BatchUpload
- name: Rapidata Audience API
  tags:
  - Audience
  - Examples
- name: Rapidata Campaign API
  tags:
  - Cache
  - Campaign
  - ExternalAudience
- name: Rapidata Dataset API
  tags:
  - ContextShortening
  - Datapoints
  - Dataset
  - DatasetGroup
- name: Rapidata Flow API
  tags:
  - Flow
  - FlowItem
  - RankingFlow
  - RankingFlowItem
- name: Rapidata Identity API
  tags:
  - Rapidata.Identity.API
  - Client
  - Customer
  - Identity
  - Newsletter
  - Organization
  - Survey
- name: Rapidata Leaderboard API
  tags:
  - Benchmark
  - SampleGeneration
  - Faucet
  - Replicate
  - Leaderboard
  - Participant
  - Prompt
  - Sample
- name: Rapidata Order API
  tags:
  - Feedback
  - Job
  - Order
- name: Rapidata Payment API
  tags:
  - Billing
  - ExternalServicePrices
  - Reconciliation
  - Settings
  - VolumeDiscount
  - BillingAccount
  - Invoice
  - Payment
- name: Rapidata Pipeline API
  tags:
  - Pipeline
- name: Rapidata Rapid API
  tags:
  - CustomerRapid
  - GlobalText
  - Rapid
  - UserRapid
  - ValidationFeedback
- name: Rapidata Signal API
  tags:
  - Signal
- name: Rapidata Translation API
  tags:
  - Translation
- name: Rapidata Validation API
  tags:
  - ValidationSet
- name: Rapidata Workflow API
  tags:
  - Evaluation
  - GroupedRanking
  - Ranking
  - SimpleWorkflow
  - Workflow