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

# Set Task Metadata

> Update the metadata for a [Task](/core-resources/task).

<Accordion title="Authentication" icon="key">
  Every request sent to Scale's API requires authentication. In short, your API Key is the Bearer token. See the [Authentication](/get-started/authentication) section for more details.
</Accordion>


## OpenAPI

````yaml POST /v2/task/metadata
openapi: 3.1.0
info:
  title: GenAI API Spec
  description: 'Data Engine: Generative AI API Specification'
  version: 0.0.1
servers:
  - url: https://api.scale.com
security:
  - bearerAuth: []
  - basicAuth: []
paths:
  /v2/task/metadata:
    post:
      tags:
        - v2
      summary: Set Task Metadata
      description: Update the metadata for a [Task](/core-resources/task).
      operationId: setTaskMetadata
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - task_id
                - metadata
              properties:
                task_id:
                  $ref: '#/components/schemas/TaskId'
                metadata:
                  $ref: '#/components/schemas/Metadata'
                merge:
                  type: boolean
                  description: >-
                    Whether to deep merge the provided metadata with existing
                    metadata. If false, replaces the entire metadata object. If
                    true, performs a deep merge and replaces existing keys with
                    new values.
                  default: false
            examples:
              Basic Task Metadata:
                value:
                  task_id: task_123
                  metadata:
                    priority: high
                    source: api
                    custom_field: value
              Merge Task Metadata:
                value:
                  task_id: task_123
                  metadata:
                    environment: production
                    version: '2.0'
                  merge: true
      responses:
        '200':
          description: Task metadata updated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Task'
              examples:
                Updated Task:
                  value:
                    task_id: task_123
                    project: project_123
                    batch: batch_123
                    status: pending
                    created_at: '2025-01-01T08:31:03.169Z'
                    metadata:
                      priority: high
                      source: api
                      custom_field: value
                    threads: []
        '500':
          description: Error response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status_code:
                    type: number
                    example: 500
                  error:
                    type: string
                    example: An error has occurred.
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |
            API_KEY='live_...'
            TASK_ID='task_123'
            curl --request POST \
                --url "https://api.scale.com/v2/task/metadata" \
                --header "Authorization: Bearer $API_KEY" \
                --header "Content-Type: application/json" \
                --data '{
                  "task_id": "'$TASK_ID'",
                  "metadata": {
                    "priority": "high",
                    "source": "api"
                  }
                }'
        - lang: python
          label: Python SDK
          source: |
            import scaleapi

            API_KEY = 'live_...'
            client = scaleapi.ScaleClient(API_KEY)

            TASK_ID = 'task_123'
            response = client.v2.set_task_metadata(
              task_id=TASK_ID,
              metadata={
                "priority": "high",
                "source": "api"
              }
            )
            print(response.to_json())
        - lang: python
          label: Python
          source: |
            import requests

            API_KEY = 'live_...'
            TASK_ID = 'task_123'

            response = requests.request(
              "POST",
              url="https://api.scale.com/v2/task/metadata",
              json={
                "task_id": TASK_ID,
                "metadata": {
                  "priority": "high",
                  "source": "api"
                }
              },
              headers={
                "Accept": "application/json",
                "Authorization": f"Bearer {API_KEY}",
                "Content-Type": "application/json",
              },
            )
            print(response.json())
        - lang: javascript
          label: JavaScript
          source: >
            const API_KEY = 'live_...';

            const TASK_ID = 'task_123';


            const response = await
            fetch('https://api.scale.com/v2/task/metadata', {
              method: 'POST',
              headers: {
                Accept: 'application/json',
                Authorization: `Bearer ${API_KEY}`,
                'Content-Type': 'application/json',
              },
              body: JSON.stringify({
                task_id: TASK_ID,
                metadata: {
                  priority: 'high',
                  source: 'api'
                }
              }),
            });

            console.log(await response.json());
        - lang: go
          label: Go
          source: |
            package main

            import (
              "bytes"
              "encoding/json"
              "fmt"
              "io/ioutil"
              "net/http"
            )

            func main() {
              apiKey := "live_..."
              taskId := "task_123"

              requestBody := map[string]interface{}{
                "task_id": taskId,
                "metadata": map[string]interface{}{
                  "priority": "high",
                  "source": "api",
                },
              }
              jsonData, _ := json.Marshal(requestBody)

              req, _ := http.NewRequest("POST", "https://api.scale.com/v2/task/metadata", bytes.NewBuffer(jsonData))

              req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", apiKey))
              req.Header.Add("Content-Type", "application/json")

              res, _ := http.DefaultClient.Do(req)

              defer res.Body.Close()
              body, _ := ioutil.ReadAll(res.Body)

              fmt.Println(string(body))
            }
        - lang: java
          label: Java
          source: |
            package com.scale.api;

            import kong.unirest.HttpResponse;
            import kong.unirest.Unirest;

            public class App {
                public static void main(String[] args) {
                    String apiKey = "live_...";
                    String taskId = "task_123";

                    String requestBody = String.format(
                      "{\"task_id\": \"%s\", \"metadata\": {\"priority\": \"high\", \"source\": \"api\"}}", 
                      taskId
                    );

                    HttpResponse<String> response = Unirest.post("https://api.scale.com/v2/task/metadata")
                      .header("Authorization", String.format("Bearer %s", apiKey))
                      .header("Content-Type", "application/json")
                      .body(requestBody)
                      .asString();

                    System.out.println(response.getBody());
                }
            }
components:
  schemas:
    TaskId:
      type: string
      description: Unique identifier for a task
      example: task_abc123
    Metadata:
      type: object
      description: Custom metadata for the entity.
      additionalProperties: true
      default: {}
    Task:
      type: object
      required:
        - task_id
        - project
        - created_at
        - status
      properties:
        task_id:
          $ref: '#/components/schemas/TaskId'
          description: Unique identifier for the task.
        project:
          $ref: '#/components/schemas/ExpandableProject'
          description: >-
            Project ID or [Project](/core-resources/project) associated with the
            task.
        batch:
          $ref: '#/components/schemas/ExpandableBatch'
          description: Batch ID or [Batch](/core-resources/batch) associated with the task.
        status:
          $ref: '#/components/schemas/TaskStatus'
          description: Current status of the task.
        created_at:
          $ref: '#/components/schemas/DateString'
          description: UTC timestamp when the task was created.
        completed_at:
          $ref: '#/components/schemas/DateString'
          description: UTC timestamp when the task was completed.
        metadata:
          $ref: '#/components/schemas/Metadata'
        threads:
          $ref: '#/components/schemas/Threads'
        errors:
          $ref: '#/components/schemas/Errors'
        sensitive_content_reports:
          $ref: '#/components/schemas/SensitiveContentReports'
    ExpandableProject:
      description: >-
        Project ID or [Project](/core-resources/project) associated with the
        task.
      oneOf:
        - $ref: '#/components/schemas/ProjectId'
        - $ref: '#/components/schemas/Project'
    ExpandableBatch:
      description: Batch ID or [Batch](/core-resources/batch) associated with the task.
      oneOf:
        - $ref: '#/components/schemas/BatchId'
        - $ref: '#/components/schemas/Batch'
    TaskStatus:
      type: string
      enum:
        - pending
        - completed
        - canceled
        - error
      description: >-
        The current status of the task, indicating whether it is pending,
        completed, error, or canceled.
    DateString:
      type: string
      format: date-time
      description: A timestamp formatted as an ISO 8601 date-time string.
    Threads:
      type: array
      description: >-
        Threads associated with the task. Tasks that do not have a `status` of
        `completed` will have an empty `threads` array.
      items:
        $ref: '#/components/schemas/Thread'
    Errors:
      type: array
      description: >-
        Errors associated with the task. Available when the task status is
        `error`
      items:
        $ref: '#/components/schemas/ErrorDetail'
    SensitiveContentReports:
      type: array
      description: >-
        Reports of sensitive content within the task. Available when the task
        status is `completed`. `threads` will not exist when the task is
        reported.
      items:
        $ref: '#/components/schemas/SensitiveContentReport'
    ProjectId:
      type: string
      description: A unique identifier for the project.
      example: project_abc123
    Project:
      type: object
      required:
        - id
        - name
        - created_at
      properties:
        id:
          $ref: '#/components/schemas/ProjectId'
          description: Unique identifier for the project
        name:
          $ref: '#/components/schemas/ProjectName'
        created_at:
          $ref: '#/components/schemas/DateString'
        types:
          type: array
          description: List of project types associated with the project.
          items:
            $ref: '#/components/schemas/GenAIProjectType'
          example:
            - 'RLHF: Pref Ranking'
        models:
          type: array
          description: List of models associated with the project.
          items:
            $ref: '#/components/schemas/Model'
          example:
            - gpt-4
            - my-model-123
    BatchId:
      type: string
      description: A unique identifier for the batch.
      example: batch_abc123
    Batch:
      type: object
      required:
        - id
        - name
        - project
        - created_at
        - status
        - metadata
      properties:
        id:
          $ref: '#/components/schemas/BatchId'
        name:
          $ref: '#/components/schemas/BatchName'
        project:
          $ref: '#/components/schemas/ExpandableProject'
          description: >-
            Project ID or [Project](/core-resources/project) associated with the
            batch.
        created_at:
          $ref: '#/components/schemas/DateString'
        completed_at:
          $ref: '#/components/schemas/DateString'
          description: UTC timestamp when the batch was completed.
        status:
          $ref: '#/components/schemas/BatchStatus'
        callback:
          $ref: '#/components/schemas/Callback'
        metadata:
          $ref: '#/components/schemas/BatchMetadata'
    Thread:
      type: object
      required:
        - id
        - turns
        - annotations
      properties:
        id:
          $ref: '#/components/schemas/ThreadId'
          description: Unique identifier for the thread.
        turns:
          $ref: '#/components/schemas/Turns'
        annotations:
          $ref: '#/components/schemas/Annotations'
          description: |
            [Annotations](/core-resources/annotation) for the entire thread.
    ErrorDetail:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/ErrorType'
          description: Type of the error
        message:
          $ref: '#/components/schemas/ErrorMessage'
          description: Details of the error message. e.g. Locale is not supported
    SensitiveContentReport:
      type: object
      properties:
        type:
          type: string
          example: violence
        message:
          type: string
          example: The prompt in the task promotes violence.
    ProjectName:
      type: string
      description: The name of the project.
      example: My Scale Project
    GenAIProjectType:
      type: string
      enum:
        - SFT
        - 'RLHF: Pref Ranking'
        - 'RLHF: Pref Ranking with Rewrites'
        - 'RLVR: Reinforcement Learning with Verifiable Rewards'
        - Rubrics
        - Process Supervision
        - Evals
        - Prompt Generation
        - Content Understanding
        - Other
    Model:
      type: string
      description: The name of the model that generated the message.
      example: my-model-123
    BatchName:
      type: string
      description: The name of the batch.
      example: My Scale Batch
    BatchStatus:
      type: string
      enum:
        - staging
        - in_progress
        - completed
        - paused
        - cancelled
      description: Status of the batch.
    Callback:
      type: string
      description: Callback URL or email for the entity upon completion.
      example: https://example.com/callback
    BatchMetadata:
      $ref: '#/components/schemas/Metadata'
    ThreadId:
      type: string
      description: Unique identifier for a thread
      example: thread_abc123
    Turns:
      type: array
      description: |
        [Turns](/core-resources/turn) within the thread.
      items:
        $ref: '#/components/schemas/Turn'
    Annotations:
      type: array
      description: Array of annotations.
      items:
        $ref: '#/components/schemas/Annotation'
    ErrorType:
      type: string
      enum:
        - UNSUPPORTED_LANGUAGE
        - LANGUAGE_MISMATCH
        - PROMPT_LENGTH_EXCEEDED
        - INVALID_CATEGORY
        - PROMPT_INFEASIBLE
      description: Type of the error
      example: UNSUPPORTED_LANGUAGE
    ErrorMessage:
      type: string
      description: Details of the error message
      example: The specified language or locale is not supported
    Turn:
      type: object
      required:
        - id
        - messages
        - annotations
      properties:
        id:
          $ref: '#/components/schemas/TurnId'
        messages:
          type: array
          description: >-
            A list of [messages](/core-resources/message) associated with this
            turn.
          items:
            $ref: '#/components/schemas/Message'
        annotations:
          $ref: '#/components/schemas/Annotations'
          description: >
            [Annotations](/core-resources/annotation) applied to the entire
            turn.
    Annotation:
      type: object
      description: Represents a generic annotation.
      required:
        - id
        - key
        - type
      oneOf:
        - $ref: '#/components/schemas/AnnotationInteger'
        - $ref: '#/components/schemas/AnnotationBoolean'
        - $ref: '#/components/schemas/AnnotationText'
        - $ref: '#/components/schemas/AnnotationCategory'
        - $ref: '#/components/schemas/AnnotationCategoryMultiple'
        - $ref: '#/components/schemas/AnnotationFile'
        - $ref: '#/components/schemas/AnnotationWorkspaceContainer'
        - $ref: '#/components/schemas/AnnotationRankedChoices'
        - $ref: '#/components/schemas/AnnotationRankedGroups'
      discriminator:
        propertyName: type
        mapping:
          integer:
            $ref: '#/components/schemas/AnnotationInteger'
          boolean:
            $ref: '#/components/schemas/AnnotationBoolean'
          text:
            $ref: '#/components/schemas/AnnotationText'
          category:
            $ref: '#/components/schemas/AnnotationCategory'
          category_multiple:
            $ref: '#/components/schemas/AnnotationCategoryMultiple'
          file:
            $ref: '#/components/schemas/AnnotationFile'
          workspace_container:
            $ref: '#/components/schemas/AnnotationWorkspaceContainer'
          ranked_choices:
            $ref: '#/components/schemas/AnnotationRankedChoices'
          ranked_groups:
            $ref: '#/components/schemas/AnnotationRankedGroups'
    TurnId:
      type: string
      description: A unique identifier for the turn.
      example: turn_abc123
    Message:
      type: object
      required:
        - role
        - content
        - source_id
        - annotations
      properties:
        role:
          $ref: '#/components/schemas/MessageRole'
          description: The role of the sender in the conversation (e.g., user, assistant).
        content:
          $ref: '#/components/schemas/MessageContent'
          description: The content of the message, including text and any attachments.
        source_id:
          $ref: '#/components/schemas/SourceId'
          description: The ID of the source system or user that sent the message.
        model_parameters:
          $ref: '#/components/schemas/ModelParameters'
        annotations:
          $ref: '#/components/schemas/Annotations'
          description: |
            [Annotations](/core-resources/annotation) specific to this message.
    AnnotationInteger:
      title: Integer
      allOf:
        - $ref: '#/components/schemas/BaseAnnotation'
        - $ref: '#/components/schemas/AnnotationIntegerProperties'
    AnnotationBoolean:
      title: Boolean
      allOf:
        - $ref: '#/components/schemas/BaseAnnotation'
        - $ref: '#/components/schemas/AnnotationBooleanProperties'
    AnnotationText:
      title: Text
      allOf:
        - $ref: '#/components/schemas/BaseAnnotation'
        - $ref: '#/components/schemas/AnnotationTextProperties'
    AnnotationCategory:
      title: Category
      allOf:
        - $ref: '#/components/schemas/BaseAnnotation'
        - $ref: '#/components/schemas/AnnotationCategoryProperties'
    AnnotationCategoryMultiple:
      title: Category-Multiple
      allOf:
        - $ref: '#/components/schemas/BaseAnnotation'
        - $ref: '#/components/schemas/AnnotationCategoryMultipleProperties'
    AnnotationFile:
      title: File
      allOf:
        - $ref: '#/components/schemas/BaseAnnotation'
        - $ref: '#/components/schemas/AnnotationFileProperties'
    AnnotationWorkspaceContainer:
      title: Workspace Container
      allOf:
        - $ref: '#/components/schemas/BaseAnnotation'
        - $ref: '#/components/schemas/AnnotationWorkspaceContainerProperties'
    AnnotationRankedChoices:
      title: Ranked Choices
      description: >-
        A list of choices where the beginning of the list is preferred. Ties are
        not allowed.
      allOf:
        - $ref: '#/components/schemas/BaseAnnotation'
        - $ref: '#/components/schemas/AnnotationRankedChoicesProperties'
    AnnotationRankedGroups:
      title: Ranked Groups
      description: >-
        A list of choices where the beginning of the list is preferred. When
        there's a tie, multiple choices will be at the same index.
      allOf:
        - $ref: '#/components/schemas/BaseAnnotation'
        - $ref: '#/components/schemas/AnnotationRankedGroupsProperties'
    MessageRole:
      type: string
      enum:
        - system
        - user
        - assistant
        - function
      description: >-
        The role of the sender in the conversation. Possible values include
        system, user, assistant, and function.
    MessageContent:
      type: object
      properties:
        text:
          $ref: '#/components/schemas/Text'
          description: The textual content of the message.
        reference_texts:
          $ref: '#/components/schemas/ReferenceTexts'
          description: The reference texts associated with the message.
        attachments:
          $ref: '#/components/schemas/Attachments'
          description: Any files or attachments included with the message.
        chunks:
          $ref: '#/components/schemas/Chunks'
          description: |
            [Chunks](/core-resources/chunk) specific to this message.
        reasoning:
          $ref: '#/components/schemas/ReasoningList'
    SourceId:
      type: string
      description: A unique identifier for the source.
      example: source_abc123
    ModelParameters:
      type: object
      properties:
        model:
          $ref: '#/components/schemas/Model'
        temperature:
          $ref: '#/components/schemas/Temperature'
        max_completion_tokens:
          $ref: '#/components/schemas/MaxCompletionTokens'
        top_p:
          $ref: '#/components/schemas/TopP'
        top_k:
          $ref: '#/components/schemas/TopK'
    BaseAnnotation:
      type: object
      required:
        - id
        - key
        - type
      properties:
        id:
          $ref: '#/components/schemas/AnnotationId'
          description: Unique identifier for the annotation.
          example: an_abc123efg456
        key:
          $ref: '#/components/schemas/AnnotationKey'
          description: Key for the annotation.
          example: formatting
        type:
          type: string
          description: The type of the value and the possible_values, if they exist.
        title:
          $ref: '#/components/schemas/Title'
          example: Response Formatting
        description:
          $ref: '#/components/schemas/Description'
          example: Does the response contain issues with formatting?
        labels:
          type: array
          description: String representation of the possible options.
          items:
            $ref: '#/components/schemas/AnnotationLabel'
          example:
            - Major Issues
            - Minor Issues
            - No Issues
        metadata:
          $ref: '#/components/schemas/AnnotationMetadata'
    AnnotationIntegerProperties:
      type: object
      properties:
        value:
          $ref: '#/components/schemas/IntegerValue'
        possible_values:
          type: array
          description: The possible values for this annotation.
          items:
            $ref: '#/components/schemas/IntegerValue'
            example:
              - 1
              - 2
              - 3
    AnnotationBooleanProperties:
      type: object
      properties:
        value:
          $ref: '#/components/schemas/BooleanValue'
        possible_values:
          type: array
          description: The possible values for this annotation.
          items:
            $ref: '#/components/schemas/BooleanValue'
            example:
              - true
              - false
    AnnotationTextProperties:
      type: object
      properties:
        value:
          $ref: '#/components/schemas/TextValue'
    AnnotationCategoryProperties:
      type: object
      properties:
        value:
          $ref: '#/components/schemas/CategoryValue'
        possible_values:
          type: array
          description: The possible values for this annotation.
          items:
            $ref: '#/components/schemas/CategoryValue'
            example:
              - Brainstorming
              - Critical Thinking
              - Math
    AnnotationCategoryMultipleProperties:
      type: object
      properties:
        value:
          $ref: '#/components/schemas/CategoryMultipleValue'
        possible_values:
          $ref: '#/components/schemas/CategoryMultipleValue'
          description: The possible values for this annotation.
          example:
            - Brainstorming
            - Critical Thinking
            - Math
    AnnotationFileProperties:
      type: object
      properties:
        value:
          oneOf:
            - $ref: '#/components/schemas/DetailedFile'
              title: File
            - $ref: '#/components/schemas/MultipleFiles'
              title: Multiple Attachments
    AnnotationWorkspaceContainerProperties:
      type: object
      properties:
        value:
          $ref: '#/components/schemas/WorkspaceContainerValue'
          title: Workspace Container
    AnnotationRankedChoicesProperties:
      type: object
      properties:
        value:
          type: array
          items:
            $ref: '#/components/schemas/RankedChoice'
          example:
            - model_1
            - model_3
            - model_2
    AnnotationRankedGroupsProperties:
      type: object
      properties:
        value:
          type: array
          items:
            $ref: '#/components/schemas/RankedGroup'
          example:
            - - model_a
              - model_c
            - - model_b
    Text:
      description: A plain text field.
      type: string
    ReferenceTexts:
      type: array
      items:
        $ref: '#/components/schemas/ReferenceText'
      description: A list of files or attachments associated with the message.
    Attachments:
      type: array
      items:
        $ref: '#/components/schemas/DetailedFile'
      description: A list of files or attachments associated with the message.
    Chunks:
      type: array
      items:
        $ref: '#/components/schemas/Chunk'
    ReasoningList:
      type: array
      description: List of reasoning blocks for a message.
      items:
        $ref: '#/components/schemas/Reasoning'
    Temperature:
      type: number
      description: The temperature of the model that generated the message.
      example: 0.9
    MaxCompletionTokens:
      type: integer
      description: The maximum number of tokens the model can generate.
      example: 1000
    TopP:
      type: number
      description: The top-p value of the model that generated the message.
      example: 0.9
    TopK:
      type: integer
      description: The top-k value of the model that generated the message.
      example: 4
    AnnotationId:
      type: string
      description: Unique identifier for an annotation.
      example: overall_quality
    AnnotationKey:
      type: string
      description: Key for the annotation.
      example: formatting
    Title:
      type: string
      description: Title of the annotation.
      example: Overall Response Score
    Description:
      type: string
      description: Further details about the question.
      example: How would you rate the entire response overall?
    AnnotationLabel:
      type: string
      description: A string representation of the annotation.
    AnnotationMetadata:
      type: object
      properties:
        criteria:
          $ref: '#/components/schemas/ExpandableAnnotation'
    IntegerValue:
      description: Integer type annotation value.
      type: integer
      example: 3
    BooleanValue:
      description: Boolean type annotation value.
      type: boolean
      example: true
    TextValue:
      type: string
      description: String type annotation value.
      example: 'There were multiple issues in the response: 1. ...'
    CategoryValue:
      type: string
      description: Single-select category annotation.
      example: Critical Thinking
    CategoryMultipleValue:
      description: Multi-select category annotation.
      example:
        - Critical Thinking
        - Math
      type: array
      items:
        type: string
    DetailedFile:
      oneOf:
        - $ref: '#/components/schemas/BasicFile'
          title: File
        - $ref: '#/components/schemas/ImageFile'
          title: Detailed Image File
        - $ref: '#/components/schemas/AudioFile'
          title: Detailed Audio File
    MultipleFiles:
      type: array
      items:
        $ref: '#/components/schemas/BasicFile'
    WorkspaceContainerValue:
      type: object
      properties:
        workspace_id:
          type: string
          description: ID of the workspace.
        workspace_config:
          $ref: '#/components/schemas/WorkspaceContainerConfig'
        last_code_run_event:
          $ref: '#/components/schemas/WorkspaceExecutionData'
          type: object
        output_files:
          type: array
          items:
            $ref: '#/components/schemas/WorkspaceFile'
        stdout_output:
          $ref: '#/components/schemas/ContentAndUrl'
          description: Standard output stream of the workspace.
        stderr_output:
          $ref: '#/components/schemas/ContentAndUrl'
          description: Standard error stream of the workspace.
        test_stdout_output:
          $ref: '#/components/schemas/ContentAndUrl'
          description: Standard output stream of the workspace for test cases.
        test_stderr_output:
          $ref: '#/components/schemas/ContentAndUrl'
          description: Standard error stream of the workspace for test cases.
    RankedChoice:
      type: string
    RankedGroup:
      type: array
      items:
        type: string
    ReferenceText:
      type: object
      properties:
        content:
          type: string
          description: Content of the reference text.
        category:
          type: string
          description: Category of the reference text.
        url:
          $ref: '#/components/schemas/URL'
          description: URL source of the reference text.
    Chunk:
      oneOf:
        - $ref: '#/components/schemas/ChunkText'
          title: Text
      discriminator:
        propertyName: type
        mapping:
          text:
            $ref: '#/components/schemas/ChunkText'
    Reasoning:
      type: object
      properties:
        content:
          type: string
          description: The reasoning for the content of a message.
    ExpandableAnnotation:
      oneOf:
        - $ref: '#/components/schemas/AnnotationId'
        - type: object
          description: >-
            A full Annotation object. This is defined as a generic object to
            avoid circular references that some tools cannot handle.
    BasicFile:
      type: object
      properties:
        content:
          $ref: '#/components/schemas/Bytes'
          description: The base64-encoded content of the file.
        mime_type:
          $ref: '#/components/schemas/MimeType'
          description: The MIME type of the file, indicating its format.
        scale_url:
          $ref: '#/components/schemas/URL'
          description: A URL pointing to the location of the file in Scale's storage.
        url:
          $ref: '#/components/schemas/URL'
          description: A URL pointing to the source location of the file.
        name:
          $ref: '#/components/schemas/FileName'
          description: The name of the file.
    ImageFile:
      type: object
      properties:
        mime_type:
          $ref: '#/components/schemas/MimeType'
          description: The MIME type of the file, indicating its format.
        scale_url:
          $ref: '#/components/schemas/URL'
          description: A URL pointing to the location of the file in Scale's storage.
        url:
          $ref: '#/components/schemas/URL'
          description: A URL pointing to the source location of the file.
        name:
          type: string
          description: The name of the image file.
        file_size_in_bytes:
          type: integer
          description: The size of the file in bytes.
    AudioFile:
      type: object
      properties:
        mime_type:
          $ref: '#/components/schemas/MimeType'
          description: The MIME type of the file, indicating its format.
        scale_url:
          $ref: '#/components/schemas/URL'
          description: A URL pointing to the scale location of the file.
        url:
          $ref: '#/components/schemas/URL'
          description: A URL pointing to the source location of the file.
        duration:
          type: number
          description: The duration of the audio file in seconds.
        transcript:
          type: string
          description: The transcript of the audio file.
        transcript_url:
          $ref: '#/components/schemas/URL'
          description: A URL pointing to the location of the transcript.
        transcript_start:
          type: number
          description: The start time of the transcript in seconds.
        transcript_end:
          type: number
          description: The end time of the transcript in seconds.
    WorkspaceContainerConfig:
      type: object
      required:
        - workspace_id
        - workspace_url
        - workspace_token
        - expires_at
        - inactivity_freeze_time
      properties:
        workspace_id:
          type: string
          description: ID of the workspace.
        workspace_url:
          $ref: '#/components/schemas/URL'
          type: string
          description: URL of the workspace.
        workspace_token:
          type: string
          description: Token of the workspace.
        expires_at:
          type: string
          description: Expiration time of the workspace.
        inactivity_freeze_time:
          type: integer
          description: Inactivity freeze time of the workspace.
        force_enable_workspace_access:
          type: boolean
          description: Force enable workspace access.
        workspace_image_version:
          type: integer
          description: Image version of the workspace.
    WorkspaceExecutionData:
      type: object
      properties:
        id:
          type: string
          description: ID of the workspace.
        result:
          type: object
          properties:
            status:
              type: object
              properties:
                code:
                  type: number
                  description: Status code of the workspace execution.
                name:
                  type: string
                  description: Execution full status.
            time:
              type: number
              description: Time taken for last execution.
            score:
              type: number
              description: Score of the output of last execution.
    WorkspaceFile:
      type: object
      required:
        - scale_url
      properties:
        file_name:
          type: string
          description: File name
        scale_url:
          $ref: '#/components/schemas/URL'
          description: A URL pointing to the scale location of the file.
        url:
          $ref: '#/components/schemas/URL'
          description: A URL pointing to the source location of the file.
        file_language:
          type: string
          description: Coding language of the file.
        file_content:
          type: string
          description: Content of the file.
    ContentAndUrl:
      type: object
      properties:
        content:
          type: string
          description: The content of the file.
        url:
          $ref: '#/components/schemas/URL'
          type: string
          description: A URL pointing to the source location of the file.
        scale_url:
          $ref: '#/components/schemas/URL'
          type: string
          description: A URL pointing to the scale location of the file.
    URL:
      type: string
      description: A URL string pointing to a resource.
    ChunkText:
      title: Text
      allOf:
        - $ref: '#/components/schemas/BaseChunk'
        - $ref: '#/components/schemas/ChunkTextProperties'
    Bytes:
      type: string
      format: byte
      description: Base-64 encoded data
    MimeType:
      type: string
      example: text/plain
      description: The MIME type of the content, such as application/json or image/png.
    FileName:
      type: string
      description: The name of the file.
    BaseChunk:
      type: object
      required:
        - type
        - annotations
      properties:
        type:
          type: string
          description: The type of chunked data.
        annotations:
          $ref: '#/components/schemas/Annotations'
          description: >
            [Annotations](/core-resources/annotation) for a chunk of the
            message.
    ChunkTextProperties:
      type: object
      required:
        - text
      properties:
        text:
          $ref: '#/components/schemas/Text'
  securitySchemes:
    bearerAuth:
      description: >-
        Your API Key is the Bearer token. See the
        [Authentication](/get-started/authentication) section to learn how to
        access your key.
      type: http
      scheme: bearer
    basicAuth:
      description: >-
        Basic HTTP Authentication. Your API Key is your username.  Learn more
        about setting up Authentication [here](/get-started/authentication).
      type: http
      scheme: basic

````