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

# Getting Started with Morphik API

> Quick guide to start using the Morphik API

## Get Your Credentials

<img src="https://mintcdn.com/databridge/eYNTu58F8b1Z2Eq-/assets/copy_uri.png?fit=max&auto=format&n=eYNTu58F8b1Z2Eq-&q=85&s=c808871149228d2db24a430ddea83def" alt="Copy URI from Morphik Dashboard" width="1214" height="910" data-path="assets/copy_uri.png" />

From the Morphik dashboard:

* **Python SDK**: Click "Copy URI"
* **TypeScript/API**: Click "Copy Token"

## Installation

<Tabs>
  <Tab title="TypeScript/JavaScript">
    ```bash theme={null}
    npm install morphik
    ```
  </Tab>

  <Tab title="Python">
    ```bash theme={null}
    pip install morphik
    ```
  </Tab>
</Tabs>

## Ingest a Document

<Tabs>
  <Tab title="Python SDK">
    ```python theme={null}
    from morphik import Morphik

    # Initialize with your URI
    client = Morphik("YOUR_COPIED_URI")

    # Ingest a file
    with open('document.pdf', 'rb') as f:
        doc = client.ingest_file(f)
    print(f"Document ID: {doc.id}")
    ```
  </Tab>

  <Tab title="TypeScript SDK">
    ```typescript theme={null}
    import Morphik from 'morphik';
    import * as fs from 'fs';

    // Initialize with your token
    const client = new Morphik({
      apiKey: 'YOUR_COPIED_TOKEN'
    });

    // Ingest a file
    const file = fs.createReadStream('document.pdf');
    const doc = await client.ingest.ingestFile({ file });
    console.log('Document ID:', doc.external_id);
    ```
  </Tab>

  <Tab title="API (cURL)">
    ```bash theme={null}
    curl -X POST https://api.morphik.ai/ingest/file \
      -H "Authorization: Bearer YOUR_COPIED_TOKEN" \
      -H "Content-Type: multipart/form-data" \
      -F "file=@document.pdf"
    ```
  </Tab>
</Tabs>

## Query Your Documents

<Tabs>
  <Tab title="Python SDK">
    ```python theme={null}
    from morphik import Morphik

    # Initialize with your URI
    client = Morphik("YOUR_COPIED_URI")

    # Query with RAG
    response = client.query(
        "What are the key points in this document?",
        k=5,
        use_colpali=True
    )

    print(response.answer)
    ```
  </Tab>

  <Tab title="TypeScript SDK">
    ```typescript theme={null}
    import Morphik from 'morphik';

    const client = new Morphik({
      apiKey: 'YOUR_COPIED_TOKEN'
    });

    // Query with RAG
    const response = await client.query.generateCompletion({
      query: 'What are the key points in this document?',
      k: 5,
      use_colpali: true
    });

    console.log(response.completion);
    ```
  </Tab>

  <Tab title="API (cURL)">
    ```bash theme={null}
    curl -X POST https://api.morphik.ai/query \
      -H "Authorization: Bearer YOUR_COPIED_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
        "query": "What are the key points in this document?",
        "k": 5,
        "use_colpali": true
      }'
    ```
  </Tab>
</Tabs>
