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

# Upload a notebook to the caller's home prefix

> Upload an ``.ipynb`` file to ``home/{preferred_username}/{filename}``.

The uploaded filename is used as-is (no path separators allowed) and any
existing notebook with the same name is overwritten.



## OpenAPI

````yaml post /api/notebooks
openapi: 3.1.0
info:
  title: Nx1 AI API
  description: |

    AI API for Nx1 Data Platform Management and Automated Data Tasks.

    Authentication is required via PSK in Authorization header.

    Default PSK is | [ask a friend] |
  version: 0.10.2
servers: []
security: []
paths:
  /api/notebooks:
    post:
      tags:
        - Notebooks
      summary: Upload a notebook to the caller's home prefix
      description: |-
        Upload an ``.ipynb`` file to ``home/{preferred_username}/{filename}``.

        The uploaded filename is used as-is (no path separators allowed) and any
        existing notebook with the same name is overwritten.
      operationId: upload_notebook_api_notebooks_post
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_notebook_api_notebooks_post'
        required: true
      responses:
        '201':
          description: Notebook uploaded successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotebookSummary'
        '400':
          description: Invalid filename or content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '422':
          description: Uploaded file is not a valid .ipynb document
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    Body_upload_notebook_api_notebooks_post:
      properties:
        file:
          type: string
          contentMediaType: application/octet-stream
          title: File
          description: The .ipynb file to upload.
      type: object
      required:
        - file
      title: Body_upload_notebook_api_notebooks_post
    NotebookSummary:
      properties:
        s3_key:
          type: string
          title: S3 Key
          description: >-
            Object key under the notebooks bucket, e.g.
            'home/kcowan/churn.ipynb'.
        owner:
          type: string
          title: Owner
          description: Owner username extracted from the S3 path prefix.
        size_bytes:
          type: integer
          title: Size Bytes
          description: Size of the notebook in bytes.
        last_modified:
          type: string
          format: date-time
          title: Last Modified
          description: S3 LastModified timestamp.
      type: object
      required:
        - s3_key
        - owner
        - size_bytes
        - last_modified
      title: NotebookSummary
      description: Lightweight view of a notebook on S3 for list endpoints.
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
          description: A brief description of the error that occurred.
        code:
          type: integer
          title: Code
          description: The HTTP status code associated with the error.
          default: 500
      type: object
      required:
        - error
      title: ErrorResponse
  securitySchemes:
    OAuth2AuthorizationCodeBearer:
      type: oauth2
      flows:
        authorizationCode:
          scopes: {}
          authorizationUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/auth
          tokenUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/token
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization-PSK

````