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

# Ingest Text

> Add text data to your project for knowledge extraction and indexing

## Endpoint

```
POST https://api.intellibase.dev/api/v1/projects/{project_id}/ingest
```

## Path Parameters

<ParamField path="project_id" type="string" required>
  The unique identifier of the project
</ParamField>

## Authentication

Requires a valid API key with access to the project.

## Request Body

<ParamField body="text" type="string" required>
  The raw text content to ingest
</ParamField>

<ParamField body="source_doc_id" type="string" required>
  Unique identifier for this document (used for provenance tracking)
</ParamField>

## Response

<ResponseField name="job_id" type="string">
  Unique identifier for the ingestion job
</ResponseField>

<ResponseField name="status" type="string">
  Initial job status: `pending` or `running`
</ResponseField>

<ResponseField name="created_at" type="string" format="datetime">
  When the job was created
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.intellibase.dev/api/v1/projects/proj-abc123/ingest \
    -H "Authorization: Bearer ib-your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "text": "Alice joined the engineering team in January 2024. She is working on the authentication feature, which is part of the security module. The feature is scheduled to launch in March 2024.",
      "source_doc_id": "doc-001"
    }'
  ```

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

  project_id = "proj-abc123"
  headers = {
      "Authorization": "Bearer ib-your-api-key",
      "Content-Type": "application/json"
  }

  response = requests.post(
      f"https://api.intellibase.dev/api/v1/projects/{project_id}/ingest",
      headers=headers,
      json={
          "text": "Alice joined the engineering team...",
          "source_doc_id": "doc-001"
      }
  )

  job = response.json()
  print(f"Ingestion job created: {job['job_id']}")
  print(f"Status: {job['status']}")

  # Poll for completion
  import time
  while True:
      status_response = requests.get(
          f"https://api.intellibase.dev/api/v1/projects/{project_id}/jobs/{job['job_id']}",
          headers=headers
      )
      status = status_response.json()
      
      if status['status'] == 'completed':
          print(f"✓ Completed: {status['chunks_processed']} chunks, "
                f"{status['nodes_created']} nodes, {status['edges_created']} edges")
          break
      elif status['status'] == 'failed':
          print(f"✗ Failed: {status['error_message']}")
          break
      
      time.sleep(2)
  ```

  ```typescript TypeScript theme={null}
  const projectId = "proj-abc123";

  const response = await fetch(
    `https://api.intellibase.dev/api/v1/projects/${projectId}/ingest`,
    {
      method: "POST",
      headers: {
        "Authorization": "Bearer ib-your-api-key",
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
        text: "Alice joined the engineering team...",
        source_doc_id: "doc-001"
      })
    }
  );

  const job = await response.json();
  console.log(`Ingestion job created: ${job.job_id}`);
  console.log(`Status: ${job.status}`);

  // Poll for completion
  const pollStatus = async () => {
    while (true) {
      const statusResponse = await fetch(
        `https://api.intellibase.dev/api/v1/projects/${projectId}/jobs/${job.job_id}`,
        {
          headers: {
            "Authorization": "Bearer ib-your-api-key"
          }
        }
      );
      
      const status = await statusResponse.json();
      
      if (status.status === "completed") {
        console.log(`✓ Completed: ${status.chunks_processed} chunks, ` +
                    `${status.nodes_created} nodes, ${status.edges_created} edges`);
        break;
      } else if (status.status === "failed") {
        console.error(`✗ Failed: ${status.error_message}`);
        break;
      }
      
      await new Promise(resolve => setTimeout(resolve, 2000));
    }
  };

  await pollStatus();
  ```
</RequestExample>

<ResponseExample>
  ```json 200 Success theme={null}
  {
    "job_id": "job-abc123",
    "status": "pending",
    "created_at": "2024-01-15T10:30:00Z"
  }
  ```

  ```json 404 Not Found theme={null}
  {
    "detail": "Project proj-invalid not found"
  }
  ```

  ```json 403 Forbidden (Rate Limit) theme={null}
  {
    "detail": "Token usage limit exceeded"
  }
  ```

  ```json 429 Too Many Requests theme={null}
  {
    "detail": "Rate limit exceeded. Try again in 60 seconds."
  }
  ```
</ResponseExample>

<Info>
  **Job Status**: Use the [Get Job](/api-reference/jobs/get) endpoint to poll for completion status.
</Info>

<Warning>
  **Rate Limits**: Ingestion is limited to 10 requests per minute. Also check your token usage limits.
</Warning>
