POST
/
apps
/
{app_id}
/
files
curl --request POST \
  --url https://api.withcortex.ai/apps/{app_id}/files \
  --header 'Content-Type: application/json' \
  --data '{
  "file_url": "https://example.com/files/document.pdf",
  "allowed_types": [
    "<string>"
  ],
  "document_extract_contents": true,
  "document_extract_images": false,
  "document_extract_pages": true,
  "document_pages": [
    1,
    2,
    3
  ],
  "document_max_pages": 10,
  "visibility": "PRIVATE"
}'
{
  "id": "<string>",
  "file_id": "<string>",
  "file_filename": "document.pdf",
  "file_size": 1024,
  "file_mimetype": "application/pdf",
  "file_url": "<string>",
  "file_format": "DOCUMENT",
  "file_status": "PROCESSED",
  "file_status_message": "<string>",
  "document": {
    "filename": "<string>",
    "filetype": "<string>",
    "contents": [
      {
        "id": 123,
        "type": "TITLE",
        "content": "<string>",
        "content_as_html": "<string>",
        "page": 123,
        "parent": 123
      }
    ],
    "images": [
      {
        "id": "<string>",
        "file_id": "<string>",
        "image_url": "<string>",
        "type": "<string>",
        "page": 123,
        "height": 123,
        "width": 123
      }
    ],
    "extracted_pages": "<string>",
    "time": 123
  },
  "document_extract_contents": true,
  "document_extract_images": true,
  "document_extract_pages": true,
  "document_pages": [
    1,
    2,
    3
  ],
  "document_progress": 123,
  "created_at": "2023-12-25"
}

Path Parameters

app_id
string
required

The ID of the app

Body

File data and options for upload
file

File to be uploaded. It can be a file object, a base64 encoded string, or a file data object containing base64 data, name, and type.

file_url
string

URL of the file to be uploaded

Example:

"https://example.com/files/document.pdf"

allowed_types
string[]

The allowed mime types for the file field (e.g. image/*, application/pdf)

document_extract_contents
boolean

Flag indicating whether to extract contents from the document

Example:

true

document_extract_images
boolean

Flag indicating whether to extract images from the document

Example:

false

document_extract_pages
boolean

Flag indicating whether to extract pages from the document

Example:

true

document_pages
number[]

Array of page numbers to extract from the document

Example:
[1, 2, 3]
document_max_pages
number

Maximum number of pages to extract from the document

Required range: x >= 1
Example:

10

visibility
enum<string>

If the file should be public or private, by default is private and the file url is signed

Available options:
PUBLIC,
PRIVATE
Example:

"PRIVATE"

Response

200 - application/json

Detailed information about a file

id
string
required

Unique identifier for the file

file_id
string
required

File identifier used in the storage system

file_filename
string
required

Name of the file

Example:

"document.pdf"

file_size
number
required

Size of the file in bytes

Example:

1024

file_mimetype
string
required

MIME type of the file

Example:

"application/pdf"

file_url
string
required

URL to access the file

file_format
enum<string> | null
required

Format of the file

Available options:
DOCUMENT
Example:

"DOCUMENT"

document_extract_contents
boolean
required

Flag indicating whether to extract contents from the document

document_extract_images
boolean
required

Flag indicating whether to extract images from the document

document_extract_pages
boolean
required

Flag indicating whether to extract pages from the document

created_at
string | null
required

Timestamp when the file was created

file_status
enum<string>

Current status of the file

Available options:
PROCESSING,
PROCESSED,
FAILED
Example:

"PROCESSED"

file_status_message
string

Status message providing additional information about the file status

document
object

Document data associated with the file

document_pages
number[]

Array of page numbers to extract from the document

Example:
[1, 2, 3]
document_progress
number

Progress of the document extraction process