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

# Update File Namespaces

> Set the namespaces a file belongs to. Replaces any existing namespace assignments. The 'default' namespace is always preserved.

Set which namespaces a file belongs to. This **replaces** any existing namespace assignments for the file. The `default` namespace is always preserved.

## Overview

Use this endpoint to move a file between namespaces or assign it to multiple namespaces at once. The response returns the updated `namespace_ids` and resolved `namespaces` reflecting the new assignments.

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT "https://api.vidnavigator.com/v1/file/file_abc123/namespaces" \
    -H "X-API-Key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "namespace_ids": ["64a1b2c3d4e5f6789abc0002", "64a1b2c3d4e5f6789abc0003"]
    }'
  ```

  ```python Python theme={null}
  import requests

  file_id = "file_abc123"
  url = f"https://api.vidnavigator.com/v1/file/{file_id}/namespaces"
  headers = {
      "X-API-Key": "YOUR_API_KEY",
      "Content-Type": "application/json"
  }
  data = {
      "namespace_ids": ["64a1b2c3d4e5f6789abc0002", "64a1b2c3d4e5f6789abc0003"]
  }

  response = requests.put(url, headers=headers, json=data)
  result = response.json()
  ```

  ```javascript JavaScript theme={null}
  const fileId = 'file_abc123';
  const response = await fetch(`https://api.vidnavigator.com/v1/file/${fileId}/namespaces`, {
    method: 'PUT',
    headers: {
      'X-API-Key': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      namespace_ids: ['64a1b2c3d4e5f6789abc0002', '64a1b2c3d4e5f6789abc0003']
    })
  });

  const result = await response.json();
  ```
</CodeGroup>

## Success Response

```json theme={null}
{
  "status": "success",
  "message": "File namespaces updated successfully",
  "data": {
    "namespace_ids": ["64a1b2c3d4e5f6789abc0001", "64a1b2c3d4e5f6789abc0002", "64a1b2c3d4e5f6789abc0003"],
    "namespaces": [
      { "id": "64a1b2c3d4e5f6789abc0001", "name": "default" },
      { "id": "64a1b2c3d4e5f6789abc0002", "name": "Client Calls" },
      { "id": "64a1b2c3d4e5f6789abc0003", "name": "Product Demos" }
    ]
  }
}
```

<Note>
  The `default` namespace is always preserved in the response, even if not explicitly included in `namespace_ids`.
</Note>


## OpenAPI

````yaml PUT /file/{file_id}/namespaces
openapi: 3.0.3
info:
  title: VidNavigator Developer API
  description: >-
    The VidNavigator Developer API provides programmatic access to video
    analysis, transcription, and search capabilities.


    ## Authentication

    All endpoints require API key authentication via the `X-API-Key` header:

    ```

    X-API-Key: YOUR_API_KEY

    ```


    ## Rate Limits

    Check the documentation for the rate limits for each endpoint.


    ## Error Handling

    The API uses standard HTTP status codes and returns error responses in JSON
    format:

    ```json

    {
      "status": "error",
      "error": "error_type",
      "message": "Human readable error message"
    }

    ```
  version: 1.0.0
  contact:
    name: VidNavigator Support
    url: https://vidnavigator.com/support
    email: support@vidnavigator.com
  license:
    name: Proprietary
    url: https://vidnavigator.com/terms
servers:
  - url: https://api.vidnavigator.com/v1
    description: Production server
security:
  - ApiKeyAuth: []
tags:
  - name: Transcripts
    description: Extract transcripts from online videos
  - name: TikTok
    description: Scrape TikTok profile metadata and per-video stats
  - name: Files
    description: Manage uploaded audio/video files
  - name: Analysis
    description: AI-powered content analysis
  - name: Extraction
    description: >-
      Extract structured data from video and file transcripts using custom
      schemas
  - name: Namespaces
    description: Organize uploaded files into namespaces (folders)
  - name: Search
    description: Search videos and files using AI
  - name: System
    description: System health and information
  - name: Tweet Analysis
    description: Extract structured claims and metadata from X/Twitter tweets
paths:
  /file/{file_id}/namespaces:
    put:
      tags:
        - Namespaces
      summary: Update file namespace assignments
      description: >-
        Set the namespaces a file belongs to. Replaces any existing namespace
        assignments. The 'default' namespace is always preserved.
      operationId: updateFileNamespaces
      parameters:
        - name: file_id
          in: path
          required: true
          description: The ID of the file to update
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - namespace_ids
              properties:
                namespace_ids:
                  type: array
                  items:
                    type: string
                  description: List of namespace IDs to assign to this file
                  example:
                    - 64a1b2c3d4e5f6789...
      responses:
        '200':
          description: File namespaces updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - success
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      namespace_ids:
                        type: array
                        items:
                          type: string
                        description: Updated list of namespace IDs
                      namespaces:
                        type: array
                        items:
                          $ref: '#/components/schemas/NamespaceRef'
                        description: Resolved namespaces with names
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/FileNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    NamespaceRef:
      type: object
      description: Resolved namespace reference with ID and display name
      properties:
        id:
          type: string
          description: Namespace identifier
        name:
          type: string
          description: Namespace display name
  responses:
    BadRequest:
      description: Bad request - invalid parameters
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                enum:
                  - error
              error:
                type: string
              message:
                type: string
    FileNotFound:
      description: File not found
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                enum:
                  - error
              error:
                type: string
                enum:
                  - file_not_found
              message:
                type: string
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                enum:
                  - error
              error:
                type: string
                enum:
                  - internal_server_error
              message:
                type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key authentication. Include your VidNavigator API key in the
        X-API-Key header.

````