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

# Apply Manifest

> Apply a YAML manifest to create resources.

Creates all resources defined in the manifest file in dependency order.
Fails if any resource already exists (create-only mode).
Performs automatic rollback if any resource creation fails.

**Features:**
- Topological sorting ensures resources are created in correct dependency order
- Secret references (`${{ secrets.NAME }}`) are resolved from organization secrets
- Atomic operation: rolls back all created resources if any creation fails
- Dry run mode validates the manifest without making changes

**Example:**
```bash
curl -X POST /v1/manifest/apply \
  -H "Authorization: Bearer $API_KEY" \
  -H "X-Namespace-Id: ns_xxx" \
  -F "manifest_file=@mixpeek.yaml"
```

**Example manifest:**
```yaml
version: "1.0"
metadata:
  name: "my-environment"

namespaces:
  - name: video_search
    feature_extractors:
      - name: multimodal_extractor
        version: v1

buckets:
  - name: raw_videos
    namespace: video_search
    schema:
      properties:
        video: { type: video }
```



## OpenAPI

````yaml post /v1/manifest/apply
openapi: 3.1.0
info:
  title: Mixpeek API
  description: >-
    This is the Mixpeek API, providing access to various endpoints for data
    processing and retrieval.
  termsOfService: https://mixpeek.com/terms
  contact:
    name: Mixpeek Support
    url: https://mixpeek.com/contact
    email: info@mixpeek.com
  version: '0.82'
servers:
  - url: https://api.mixpeek.com
    description: Production
security: []
paths:
  /v1/manifest/apply:
    post:
      tags:
        - Manifest
      summary: Apply Manifest
      description: >-
        Apply a YAML manifest to create resources.


        Creates all resources defined in the manifest file in dependency order.

        Fails if any resource already exists (create-only mode).

        Performs automatic rollback if any resource creation fails.


        **Features:**

        - Topological sorting ensures resources are created in correct
        dependency order

        - Secret references (`${{ secrets.NAME }}`) are resolved from
        organization secrets

        - Atomic operation: rolls back all created resources if any creation
        fails

        - Dry run mode validates the manifest without making changes


        **Example:**

        ```bash

        curl -X POST /v1/manifest/apply \
          -H "Authorization: Bearer $API_KEY" \
          -H "X-Namespace-Id: ns_xxx" \
          -F "manifest_file=@mixpeek.yaml"
        ```


        **Example manifest:**

        ```yaml

        version: "1.0"

        metadata:
          name: "my-environment"

        namespaces:
          - name: video_search
            feature_extractors:
              - name: multimodal_extractor
                version: v1

        buckets:
          - name: raw_videos
            namespace: video_search
            schema:
              properties:
                video: { type: video }
        ```
      operationId: apply_manifest_v1_manifest_apply_post
      parameters:
        - name: dry_run
          in: query
          required: false
          schema:
            type: boolean
            description: Validate only, don't create resources
            default: false
            title: Dry Run
          description: Validate only, don't create resources
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_apply_manifest_v1_manifest_apply_post'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplyResult'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    Body_apply_manifest_v1_manifest_apply_post:
      properties:
        manifest_file:
          type: string
          format: binary
          title: Manifest File
          description: YAML manifest file
      type: object
      required:
        - manifest_file
      title: Body_apply_manifest_v1_manifest_apply_post
    ApplyResult:
      properties:
        success:
          type: boolean
          title: Success
          description: Whether all resources were created successfully
        resources:
          items:
            $ref: '#/components/schemas/ResourceResult'
          type: array
          title: Resources
          description: Results for each resource
        created_count:
          type: integer
          title: Created Count
          description: Number of resources created
          default: 0
        failed_count:
          type: integer
          title: Failed Count
          description: Number of resources that failed
          default: 0
        skipped_count:
          type: integer
          title: Skipped Count
          description: Number of resources skipped
          default: 0
        errors:
          items:
            type: string
          type: array
          title: Errors
          description: Error messages
        rollback_performed:
          type: boolean
          title: Rollback Performed
          description: Whether rollback was performed due to failure
          default: false
        dry_run:
          type: boolean
          title: Dry Run
          description: Whether this was a dry run (no changes made)
          default: false
      type: object
      required:
        - success
      title: ApplyResult
      description: Result of applying a manifest.
      examples:
        - created_count: 2
          dry_run: false
          errors: []
          failed_count: 0
          resources:
            - name: video_search
              resource_id: ns_abc123
              resource_type: namespace
              status: created
            - name: raw_videos
              resource_id: bkt_xyz789
              resource_type: bucket
              status: created
          rollback_performed: false
          skipped_count: 0
          success: true
    ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Always false for error responses
          default: false
        status:
          type: integer
          title: Status
          description: HTTP status code for this error
        error:
          $ref: '#/components/schemas/ErrorDetail'
          description: Error details payload
      type: object
      required:
        - status
        - error
      title: ErrorResponse
      description: Error response model.
      examples:
        - error:
            details:
              id: ns_123
              resource: namespace
            message: Namespace not found
            type: NotFoundError
          status: 404
          success: false
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ResourceResult:
      properties:
        resource_type:
          type: string
          title: Resource Type
          description: Type of resource (namespace, bucket, etc.)
        name:
          type: string
          title: Name
          description: Resource name from manifest
        resource_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Resource Id
          description: Created resource ID
        status:
          $ref: '#/components/schemas/ResourceResultStatus'
          description: Result status
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Error message if failed
      type: object
      required:
        - resource_type
        - name
        - status
      title: ResourceResult
      description: Result of applying a single resource.
      examples:
        - name: video_search
          resource_id: ns_abc123
          resource_type: namespace
          status: created
    ErrorDetail:
      properties:
        message:
          type: string
          title: Message
          description: Human-readable error message
        type:
          type: string
          title: Type
          description: Stable error type identifier (machine-readable)
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: >-
            Fine-grained error code for programmatic handling (e.g.,
            namespace_name_taken, feature_extractor_not_found). Present only
            when consumers may need to branch on a specific error condition.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: >-
            Optional structured details to help debugging (validation errors,
            IDs, etc.)
      type: object
      required:
        - message
        - type
      title: ErrorDetail
      description: Error detail model.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ResourceResultStatus:
      type: string
      enum:
        - created
        - skipped
        - failed
      title: ResourceResultStatus
      description: Status of a resource creation attempt.

````