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

# Set Spec Task Split

> Move up to 5,000 tasks into train or test by creating a new latest version of the spec, with new task IDs; the spec itself is unchanged. Any unknown task ID refuses the request. The version is copied in the background: poll getSpecOperation until it succeeds.



## OpenAPI

````yaml /openapi.json post /api/v1/specs/{spec_id}/tasks/split
openapi: 3.1.0
info:
  title: Trajectory API
  version: 0.1.0
  x-trajectory-api-version: '2026-10-14'
  description: >-
    This contract is API version 2026-10-14. The optional Trajectory-API-Version
    header pins it, and tmp-contract is accepted as an alias. Requests without
    the header get this version. Version 2026-10-07 and the pre-launch legacy
    response formats are retired.
servers:
  - url: https://api.trajectory.ai
security: []
tags:
  - name: projects
    x-group: Projects
  - name: specs
    x-group: Specs
  - name: diagnostics
    x-group: Diagnostics
  - name: spec-ingestion
    x-group: Spec submissions
  - name: spec-findings
    x-group: Spec findings
  - name: eval
    x-group: Evaluations
  - name: training
    x-group: Training
  - name: deployments
    x-group: Deployments
  - name: model-endpoints
    x-group: Model endpoints
  - name: inference
    x-group: Inference
  - name: trajectories
    x-group: Trajectories
  - name: artifacts
    x-group: Artifacts
  - name: telemetry
    x-group: Telemetry
  - name: supported-models
    x-group: Supported models
  - name: organizations
    x-group: Organizations
  - name: secrets
    x-group: Secrets
  - name: datasets
    x-group: Datasets
paths:
  /api/v1/specs/{spec_id}/tasks/split:
    post:
      tags:
        - specs
      summary: Set Spec Task Split
      description: >-
        Move up to 5,000 tasks into train or test by creating a new latest
        version of the spec, with new task IDs; the spec itself is unchanged.
        Any unknown task ID refuses the request. The version is copied in the
        background: poll getSpecOperation until it succeeds.
      operationId: setSpecTaskSplit
      parameters:
        - name: spec_id
          in: path
          required: true
          schema:
            type: string
            title: Spec Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetSpecTaskSplitRequest'
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SpecOperation'
        '404':
          description: >-
            The requested resource does not exist or is not visible to the
            caller.
          headers:
            X-Request-ID:
              $ref: '#/components/headers/RequestId'
            Trajectory-Should-Retry:
              $ref: '#/components/headers/TrajectoryShouldRetry'
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceNotFoundErrorResponse'
        default:
          $ref: '#/components/responses/ApiErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    SetSpecTaskSplitRequest:
      properties:
        task_ids:
          items:
            type: string
            maxLength: 64
            minLength: 1
          type: array
          maxItems: 5000
          minItems: 1
          title: Task Ids
          description: >-
            IDs of the spec's tasks to move; each must be a task of the spec.
            List them with listSpecTasks.
        split:
          $ref: '#/components/schemas/TaskSplit'
          description: 'The split the tasks join: `train` or `test`.'
      additionalProperties: false
      type: object
      required:
        - task_ids
        - split
      title: SetSpecTaskSplitRequest
    SpecOperation:
      properties:
        operation_id:
          type: string
          title: Operation Id
          description: ID to poll with getSpecOperation.
        kind:
          type: string
          enum:
            - update_split
            - public_copy
          title: Kind
          description: >-
            `update_split` makes a new version with tasks moved; `public_copy`
            copies a public spec.
        status:
          type: string
          enum:
            - queued
            - running
            - succeeded
            - failed
          title: Status
        spec_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Spec Id
          description: >-
            The spec the operation made, readable with getSpec; null until it
            succeeds.
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Why the operation failed; null otherwise.
        created_at:
          type: string
          format: date-time
          title: Created At
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
      type: object
      required:
        - operation_id
        - kind
        - status
        - spec_id
        - error
        - created_at
        - completed_at
      title: SpecOperation
    ResourceNotFoundErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ResourceNotFoundErrorBody'
      type: object
      required:
        - error
      title: ResourceNotFoundErrorResponse
    TaskSplit:
      type: string
      enum:
        - train
        - test
      title: TaskSplit
    ResourceNotFoundErrorBody:
      properties:
        type:
          type: string
          const: invalid_request_error
          title: Type
        code:
          type: string
          const: resource_not_found
          title: Code
        message:
          type: string
          title: Message
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
        doc_url:
          type: string
          title: Doc Url
        context:
          $ref: '#/components/schemas/EmptyErrorContext'
      type: object
      required:
        - type
        - code
        - message
        - doc_url
        - context
      title: ResourceNotFoundErrorBody
    ApiErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/ApiErrorBody'
      required:
        - error
      title: ApiErrorEnvelope
      type: object
    EmptyErrorContext:
      properties: {}
      additionalProperties: false
      type: object
      title: EmptyErrorContext
    ApiErrorBody:
      properties:
        type:
          $ref: '#/components/schemas/ErrorType'
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
        param:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Param
        doc_url:
          type: string
          title: Doc Url
        context:
          additionalProperties: true
          title: Context
          type: object
      required:
        - type
        - code
        - message
        - doc_url
        - context
      title: ApiErrorBody
      type: object
    ErrorType:
      enum:
        - invalid_request_error
        - authentication_error
        - permission_error
        - conflict_error
        - billing_error
        - rate_limit_error
        - dependency_error
        - api_error
      title: ErrorType
      type: string
  headers:
    RequestId:
      schema:
        type: string
    TrajectoryShouldRetry:
      schema:
        type: boolean
    RetryAfter:
      schema:
        type: string
  responses:
    ApiErrorResponse:
      description: >-
        Common API error. Possible codes: `authentication_required`,
        `permission_denied`, `validation_error`, `rate_limited`,
        `internal_error`, `service_unavailable`.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/RequestId'
        Trajectory-Should-Retry:
          $ref: '#/components/headers/TrajectoryShouldRetry'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorEnvelope'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Organization API key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.