File Object
| Field | Type | Description |
|---|---|---|
id | String | This is the file ID (sometimes referred to as a token) and is unique to each file. File operations are conducted using this as a primary key. |
filename | String | The filename, as received, upon uploading. |
size | String | The file size in bytes |
sha256 | String | The SHA-256 hash of the file as uploaded. |
size_label | String | A human readable file size label. |
mimetype | String | The mimetype based on the file name or as provided upon upload. |
url | String | A short-lived URL to download the related file. The default time limit is 15 minutes. |
upload_source | String | A tag for the original uploading application, typically api |
source_word_count | Integer | The number of words in the source file. For machine-readable formats (DOC, DOCX, TXT, etc..) this is almost always set. For non-machine readable (PDF, JPEG, etc..) this is most likely not set. |
page_count | Integer | The number of pages within the file. For PDF, this is the number of pages in the PDF. For image files, this defaults to 1. |
language_detection | String | A ISO-639 Language Code based on detection. If the language is known and can be provided, it will default to the provided value. |
pdf_title | String | For PDFs only: The title according to metadata |
pdf_creator | String | For PDFs only: The creator according to metadata |
pdf_last_modified | String | For PDFs only: The last modification date according to metadata |
source_metadata | Object | Source Metadata Object |
integrations | Array | If the file was uploaded with a native integration, additional metadata related to that integration is provided here. |
created_at | DateTime | The timestamp for the file creation |
updated_at | DateTime | The timestamp for the file update, typically refers to the last time metadata was changed. |
Upload File
POST https://api.immitranslate.com/v1/files
curl -X POST https://api.immitranslate.com/v1/files \
-H "Authorization: Bearer a1s2d3f4q5w6e7r8t9y0" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "url=https://api-test-files.immitranslate.com/test-document-de-scanned.pdf"
curl -X POST https://api.immitranslate.com/v1/files \
-H "Authorization: Bearer a1s2d3f4q5w6e7r8t9y0" \
-F "file=@test-document-de-scanned.pdf"
{
"data": {
"id": "file...",
"filename": "immitranslate-api-test-file-standard.pdf",
"size": 157231,
"sha256": "6815eeab802020c22288664ad0ff64870ac9e3eb56fd5b098d6fe558a4c39ed1",
"mimetype": "application/pdf",
"url": "https://...",
"created_at": "2022-02-26T20:01:49+00:00",
"updated_at": "2022-02-26T20:01:49+00:00",
"upload_source": "api",
"source_word_count": null,
"page_count": 1,
"language_detection": null,
"pdf_title": "Scan_2022-02-17T153135",
"pdf_creator": "Smart Touch 1.9",
"pdf_last_modified": "2022-02-17T20:32:54+00:00",
"integrations": []
}
}
Content-Type: multipart/form-data header set and a file contained in the variable file or a Content-Type: application/x-www-form-urlencoded form with the parameter url.
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
file | File | Yes (If url not provided) | multipart/form-data File |
url | String | Yes (If file not provided) | A publicly accessible URL of the file. |
Permitted File Types
- DOC
- DOCX
- JPG
- JPEG
- XLS
- XLSX
- GIF
- PNG
- BMP
- TIFF
- TIF
- HEIC
- TXT