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

# Get document

> Retrieve a document's canonical content, metadata, and processing state by document ID or caller-defined ID. Optionally include its source chunks, derived memories, or both in the same response.



## OpenAPI

````yaml https://api.supermemory.ai/v5/openapi get /ns/{namespace}/document/{id}
openapi: 3.1.0
info:
  title: supermemory API
  description: >-
    The Memory API for the AI era. OpenAPI operations include x-codeSamples for
    the official TypeScript and Python SDKs (Mintlify-compatible).
  version: 5.0.0
servers:
  - description: Production Server
    url: https://api.supermemory.ai
security:
  - bearerAuth: []
tags:
  - name: Ingest
    description: Ingest documents, files, URLs, conversations, and other content
  - name: Recall (Search)
    description: >-
      Semantic recall across your content — supports memories, hybrid, and
      documents modes
  - name: Profiles
    description: Maintained static, dynamic, and custom-bucket profiles scoped by namespace
  - name: Content Management
    description: List, get, update, and delete content and memories
  - name: Namespaces
    description: List and manage isolated namespaces and their settings
  - name: Connectors
    description: >-
      Sync external sources such as Google Drive, Notion and GitHub into a
      namespace
  - name: Organization
    description: Read and update organization-wide settings
paths:
  /ns/{namespace}/document/{id}:
    get:
      tags:
        - Content Management
      summary: Get document
      description: >-
        Retrieve a document's canonical content, metadata, and processing state
        by document ID or caller-defined ID. Optionally include its source
        chunks, derived memories, or both in the same response.
      operationId: getNsByNamespaceDocumentById
      parameters:
        - in: path
          name: namespace
          schema:
            type: string
            maxLength: 100
            pattern: ^[a-zA-Z0-9_:-]+$
            example: user_alex
          required: true
          description: >-
            The isolated namespace. This can be an ID for your user, a project
            ID, or any other identifier you wish to use to scope documents.
        - in: path
          name: id
          schema:
            type: string
            minLength: 1
            maxLength: 255
            example: my-doc-123
          required: true
          description: The public document ID
        - in: query
          name: include
          schema:
            type: array
            items:
              type: string
              enum:
                - chunks
                - memories
            style: form
            explode: false
          description: >-
            Comma-separated child resources to include: chunks, memories, or
            both.
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Stable document identifier
                    example: doc_xyz789
                  title:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: Extracted or caller-provided document title
                    example: API Rate Limiting Policy
                  type:
                    type: string
                    description: Detected source or content type
                    example: text
                  summary:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: Generated summary of the document, when available
                  content:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: Canonical extracted text used for processing and recall
                    example: >-
                      Our API rate limits are 100 req/min on free and 1000 on
                      pro.
                  metadata:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties: {}
                    description: Caller metadata with internal fields removed
                    example:
                      source: api-docs
                  system:
                    type: object
                    properties:
                      status:
                        type: string
                        enum:
                          - unknown
                          - queued
                          - extracting
                          - chunking
                          - embedding
                          - indexing
                          - done
                          - failed
                        description: Current extraction and memory-processing status
                      createdAt:
                        type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                        description: ISO 8601 timestamp when the document was created
                      updatedAt:
                        type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                        description: ISO 8601 timestamp of the latest document update
                    required:
                      - status
                      - createdAt
                      - updatedAt
                    description: >-
                      Processing status, lifecycle timestamps, and storage path
                      maintained by Supermemory
                  chunks:
                    description: Ordered document chunks; included only when requested
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Stable chunk identifier
                        position:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                          description: Zero-based order within the document
                        content:
                          type: string
                          description: Chunk text used for retrieval
                        type:
                          type: string
                          description: Chunk content type
                        metadata:
                          type: object
                          propertyNames:
                            type: string
                          additionalProperties: {}
                          description: Chunk metadata; empty object when none
                        system:
                          type: object
                          properties:
                            createdAt:
                              type: string
                              format: date-time
                              pattern: >-
                                ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                              description: ISO 8601 timestamp when the chunk was created
                          required:
                            - createdAt
                          description: Lifecycle timestamps maintained by Supermemory
                      required:
                        - id
                        - position
                        - content
                        - type
                        - metadata
                        - system
                      description: A chunk of source content belonging to a document
                  memories:
                    description: >-
                      Memories derived from the document; included only when
                      requested
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Stable memory identifier
                        memory:
                          type: string
                          description: Learned fact or context extracted from the document
                        metadata:
                          type: object
                          propertyNames:
                            type: string
                          additionalProperties: {}
                          description: >-
                            Memory metadata, including temporal context; empty
                            object when none
                        isStatic:
                          type: boolean
                          description: >-
                            Whether the memory belongs to the stable profile
                            section
                        isInference:
                          type: boolean
                          description: >-
                            Whether the memory was inferred rather than
                            explicitly stated
                        isLatest:
                          type: boolean
                          description: >-
                            Whether this is the newest version in its memory
                            chain
                        isForgotten:
                          type: boolean
                          description: >-
                            Whether this memory has been excluded from normal
                            recall
                        version:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                          description: Version number within the memory chain
                        system:
                          type: object
                          properties:
                            createdAt:
                              type: string
                              format: date-time
                              pattern: >-
                                ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                              description: >-
                                ISO 8601 timestamp when this memory version was
                                created
                            updatedAt:
                              type: string
                              format: date-time
                              pattern: >-
                                ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                              description: >-
                                ISO 8601 timestamp of the latest update to this
                                version
                          required:
                            - createdAt
                            - updatedAt
                          description: Lifecycle timestamps maintained by Supermemory
                      required:
                        - id
                        - memory
                        - metadata
                        - isStatic
                        - isInference
                        - isLatest
                        - isForgotten
                        - version
                        - system
                      description: A memory formed from documents in this namespace
                required:
                  - id
                  - title
                  - type
                  - summary
                  - content
                  - metadata
                  - system
                description: >-
                  Namespace-scoped document. Included keys are omitted unless
                  requested and are empty arrays when requested without results.
          description: Document retrieved successfully
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ErrorResponse'
                  - $ref: '#/components/schemas/ValidationErrorResponse'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Namespace access denied
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Document not found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
      x-codeSamples:
        - lang: typescript
          label: TypeScript SDK
          source: >-
            import { Supermemory } from "supermemory";


            const client = new Supermemory(); // reads SUPERMEMORY_API_KEY


            const doc = await client.documents.get("user_123", "doc_abc123", {
              include: ["chunks", "memories"],
            });

            console.log(doc.system.status, doc.chunks?.length,
            doc.memories?.length);
        - lang: python
          label: Python SDK
          source: >-
            from supermemory import Supermemory


            client = Supermemory()  # reads SUPERMEMORY_API_KEY


            doc = client.documents.get("user_123", "doc_abc123",
            include=["chunks", "memories"])

            print(doc.system.status, len(doc.chunks or []), len(doc.memories or
            []))
        - lang: bash
          label: cURL
          source: >-
            curl
            "https://api.supermemory.ai/ns/user_123/document/doc_abc123?include=chunks,memories"
            \
              -H "Authorization: Bearer $SUPERMEMORY_API_KEY"
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
          example: Invalid request parameters
        details:
          type: string
          description: Additional error details
          example: Query must be at least 1 character long
      required:
        - error
    ValidationErrorResponse:
      type: object
      description: Body returned when request input fails schema validation
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: array
          description: Validation issues
          items:
            type: object
            properties:
              message:
                type: string
              path:
                type: array
                items:
                  oneOf:
                    - type: string
                    - type: number
            required:
              - message
        data:
          description: The input that failed validation
      required:
        - success
        - error
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````

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