Skip to content

Upload a file

POST
/v1/files
Code sample: curl
API="${PARSEHAWK_API_URL:-http://127.0.0.1:8000}"
curl --fail --silent --show-error \
--request POST "$API/v1/files" \
--form "upload=@document.pdf;type=application/pdf" | jq .

Store a document locally and return metadata for use in extraction jobs.

Media typemultipart/form-data
Body_uploadFile
object
upload
required
Upload

PDF, image, text, or Markdown document to store for extraction.

string

Successful Response

Media typeapplication/json
FileResponse

Metadata for a file stored by ParseHawk.

object
id
required
Id

Immutable file identifier.

string
file_name
required
File Name

Original upload filename.

string
content_type
required
Content Type

Detected or supplied media type.

string
size_bytes
required
Size Bytes

Stored file size in bytes.

integer
sha256
required
Sha256

Lowercase SHA-256 digest of the stored bytes.

string
source
required
FileSource

How the file entered ParseHawk.

string
Allowed values: user example
is_example
required
Is Example

Whether the file ships as a built-in example.

boolean
created_at
required
Created At

UTC creation time.

string format: date-time
Example
{
"id": "file_01JZ6QK8M7",
"file_name": "invoice.pdf",
"content_type": "application/pdf",
"source": "user"
}

The request or domain input failed validation.

Media typeapplication/json
ApiErrorResponse

Error returned by request validation or a ParseHawk domain service.

object
detail
required
Any of:
string
Examplegenerated
{
"detail": [
{}
]
}

Unexpected server error.

Media typeapplication/json
ApiErrorResponse

Error returned by request validation or a ParseHawk domain service.

object
detail
required
Any of:
string
Examplegenerated
{
"detail": [
{}
]
}