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

# Upload File

> Upload a file to your memory

## Overview

API endpoint for uploading files (PDF, DOCX, etc.) to your Personal AI memory.

## Authorization

<ParamField header="x-api-key" type="string" required>
  Your Personal AI API key
</ParamField>

## Headers

<ParamField header="Content-Type" type="string" required>
  Must be set to application/json
</ParamField>

## Query Params

<ParamField query="DomainName" type="string" required>
  The hyphenated text below the AI's name when clicked into a Persona.

  <img alt="DomainName" classname="block dark:hidden" src="https://mintcdn.com/personalai/kGsTZefXJjPC-_P1/images/domainname.png?fit=max&auto=format&n=kGsTZefXJjPC-_P1&q=85&s=36b7c320c44dba9f962cdb342de41f3a" width="1140" height="416" data-path="images/domainname.png" />
</ParamField>

### File

<ParamField body="file" type="File" required>
  The file to be uploaded
</ParamField>

<ParamField body="message_request" type="JSON" required>
  A JSON-encoded string containing additional request parameters
</ParamField>

```json Example message_request theme={null}
{"DomainName": "product-demo-jebzrhw", "Title": "Uploaded Files"}
```

### Body

<ResponseField name="Title" type="string" optional>
  Title of the uploaded document

  ```json Example Request theme={null}
  "Title": "My Document"
  ```
</ResponseField>

<ResponseField name="Starttime" type="string" optional>
  ISO timestamp string indicating start time (UTC). Defaults to current time.

  ```json Example Request theme={null}
  "Starttime": "2024-10-09T10:00:00.000Z"
  ```
</ResponseField>

<ResponseField name="EndTime" type="string" optional>
  ISO timestamp string indicating end time (UTC). Defaults to current time.

  ```json Example Request theme={null}
  "Endtime": "2024-10-10T10:00:00.000Z"
  ```
</ResponseField>

<ResponseField name="Tags" type="string" optional>
  Comma delimited list of tags for context and reference

  ```json Example Request theme={null}
  "Tags": "documents,developers,coding"
  ```
</ResponseField>

<ResponseField name="is_stack" type="boolean" optional>
  Boolean to specify whether to add the document to memory. If false, upload shows up as draft in Documents.
  Defaults to true.

  ```json Example Request theme={null}
  "is_stack": true
  ```
</ResponseField>

### Example Responses

<ResponseField name="message" type="string">
  Success or error message
</ResponseField>

```json Example Success Response theme={null}
{
  "message": "file accepted and processing"
}
```

```json Example Error Response theme={null}
{
  "detail": "AI memory api unauthorized."
}
```

### Example cURL

```bash cURL theme={null}
curl --location 'https://api.personal.ai/v1/upload-file?DomainName={DomainName}' \
--header 'x-api-key: <your-api-key>' \
--form 'file=@"/path/to/file.pdf"' \
--form 'message_request="{\"DomainName\": \"product-demo-jebzrhw\", \"Title\": \"My Document\"}"'
```

### Error Codes

| Code | Description                               |
| ---- | ----------------------------------------- |
| 403  | Forbidden - Check that API key is invalid |
