# Ingest a new file

> You're reading the Mindset v3 documentation. v3 is no longer sold; this is reference for existing customers. Mindset 4 docs are at /docs.

Mindset v3 REST API reference: Context Files.

**POST** `/api/v1/appuid/{appUid}/contexts/{contextUid}/files`

## Base URL

Requests go to your region's API host, for example `https://a.api.mindset.ai`. Hosts: `https://a.api.mindset.ai`, `https://b.api.mindset.ai`, `https://c.api.mindset.ai`, `https://d.api.mindset.ai`.

## Authorization

- `x-api-key` (string, required, header)

  Your API key.

## Path parameters

- `appUid` (string, required, path)

  Your application's uid

* `contextUid` (string, required, path)

  Your context's uid

## Request body

Content type: `application/json`.

- `externalId` (string, body)

  Optional External ID of the file

* `name` (string, required, body)

  Name of the file

- `mimeType` (string, required, body)

  mime type of the file to be ingested

  One of: `video/mp4`, `audio/mpeg`, `application/pdf`, `application/vnd.openxmlformats-officedocument.presentationml.presentation`, `application/vnd.openxmlformats-officedocument.wordprocessingml.document`, `text/html`, `text/plain`, `application/zip`.

* `zipType` (string, body)

  When sending a scorm file set mimeType to application/zip and specify 'scorm' here

- `sourceUrl` (string, body)

  Url to download the file from for ingestion

* `documentContent` (string, body)

  Content of the file, text (plain or markdown) or html to be ingested directly. Supports up to \~10MB of Base64-encoded content.

- `autoPublish` (boolean, body)

  Automatically publish this file after successful ingestion

* `hideContentSegments` (boolean, body)

  Allows the agent to refer to knowledge ingested from this document without ever revealing the source doc

- `knownAs` (string, body)

  How the agent can refer to this file. eg 'video', 'discussion', 'sales pitch'

* `externalUrl` (string, body)

  An external URL to direct an end user to the file for this document

- `thumbnailUrl` (string, body)

  An external URL for a custom thumbnail for this file. It must point to an image of less than 3MB

* `thumbnail` (string, body)

  A base64 encoded image to use as a thumbnail for this file.

- `viewOriginalSource` (boolean, body)

  Instruct agent UI to launch the externalUrl provided

* `contentHash` (string, body)

  Optional string to support spotting content change

- `labels` (string\[], body)

  Array of label uids (max 10)

* `runId` (string, body)

  Optional string to track id of triggering process

```json
{
  "externalId": "string",
  "name": "string",
  "mimeType": "video/mp4",
  "zipType": "string",
  "sourceUrl": "string",
  "documentContent": "string",
  "autoPublish": true,
  "hideContentSegments": true,
  "knownAs": "string",
  "externalUrl": "string",
  "thumbnailUrl": "string",
  "thumbnail": "string",
  "viewOriginalSource": true,
  "contentHash": "string",
  "labels": [
    "string"
  ],
  "runId": "string"
}
```

## Responses

### 201

File accepted. Ingestion processing started

```json
{
  "uid": "string",
  "externalId": "string",
  "createdAt": "string",
  "name": "string",
  "status": "string",
  "statusMessage": "string",
  "runId": "string",
  "mimeType": "string",
  "autoPublish": true,
  "hideContentSegments": true,
  "labels": [
    "string"
  ],
  "contentHash": "string",
  "knownAs": "string",
  "externalUrl": "string",
  "viewOriginalSource": true,
  "thumbnailUpdatedByAdmin": true
}
```

### 400

Bad Request

### 401

Unauthorized

### 403

Forbidden

### 404

Context does not exist

### 422

Unprocessable Entity

### 500

Internal Server Error

## Example request

```bash
curl -X POST "https://a.api.mindset.ai/api/v1/appuid/{appUid}/contexts/{contextUid}/files" \
  -H "x-api-key: <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{"externalId":"string","name":"string","mimeType":"video/mp4","zipType":"string","sourceUrl":"string","documentContent":"string","autoPublish":true,"hideContentSegments":true,"knownAs":"string","externalUrl":"string","thumbnailUrl":"string","thumbnail":"string","viewOriginalSource":true,"contentHash":"string","labels":["string"],"runId":"string"}'
```
