Files
Uploads one document. AirCredit stores the original bytes unchanged and starts preparing the file for analysis, for example by converting a Word file to PDF. Uploading is free and does not start an analysis.
Pass the returned id in files when you create an analysis.
The file is deleted after the integration's retention period, 30 days by default. Send
retention_days to shorten it.
A live upload counts the document's pages before it answers, because analyses are priced
by them. A Word file is converted to PDF for this, and a text file counts one page per
3,000 characters. A document with more than 500 pages returns 422 document_too_large,
and one that cannot be opened returns
422 unreadable_document. If counting is briefly unavailable, the upload returns
429 rate_limited with Retry-After.
With a test key, AirCredit checks the size and media type, then discards the bytes. It keeps only the metadata, for at most 24 hours.
BearerAuthAuthorizationBearer <token>A partner API key, sent as Authorization: Bearer <key>. Live keys look like sk_live_<lookup>_<secret> and test keys like sk_test_<lookup>_<secret>. A key sees only data of its own mode.
x-request-id?stringYour ID for correlating this request with your logs, up to 128 bytes. If it is missing, empty or longer, the API generates one as req_<uuid>. The response echoes the ID in x-request-id, and error bodies repeat it in request_id.
1 <= length <= 128Idempotency-Key*stringA unique key per create request, such as a UUID, so that a retry cannot create the resource twice.
- A retry with the same key and input returns the original resource in its current state, without running the work again. Defaults for omitted values stay as first resolved.
- The same key with different input returns
409 idempotency_conflict, even after the resource was deleted. - A retry with the same key and input after the resource was deleted or expired returns
410 resource_deleted.
Keys are scoped to the integration, the key's mode and the operation. They survive API key rotation and are removed with the integration.
Inputs match only when they are identical. An omitted member differs from one sent
explicitly, even as null, and array order matters. An upload compares the file's content
digest, accepted file name, media type and options. The multipart boundary, credentials,
x-request-id and Prefer are ignored.
^[!-~]+$1 <= length <= 255Exactly one file part and an optional retention_days part with a single number. Duplicate or unknown parts are rejected.
multipart/form-data- body
The file to upload and, optionally, how long to keep it.
file*fileThe original file. Text files must be UTF-8.
binaryretention_days?RetentionDaysHow many days to keep this file before it is deleted automatically., from 1 up to the integration's retention period. Without it, that period applies, 30 days by default. Other values, such as 0, return 422 invalid_spec.
1 <= value <= 90The file was stored. A retry with the same Idempotency-Key returns the original file, also with 201. The Location header points to the file.
application/json- response
An uploaded file. Its content never changes.
id*FileIdThe file's ID. Use it in files when you create an analysis.
^file_[A-Za-z0-9_-]+$mode*ModeWhether this is a test or a live file, decided by the key that uploaded it.
"test""live"bytes*NonnegativeIntegerThe size of the uploaded file in bytes.
0 <= valueexpires_at*DateTimeWhen the file is deleted automatically.
date-timecurl -X POST 'https://api.aircredit.de/partner/v1/files' \ -H 'Idempotency-Key: 5f0c8e2a-6b1d-4c3e-9a7f-2d4b8c1e0a93' \ -F 'file=@payslip.pdf'{ "id": "file_8f2a", "mode": "live", "bytes": 182044, "expires_at": "2026-11-06T10:00:00Z"}Downloads the preview of an uploaded file: a PDF of the pages that AirCredit read and that page citations point to. Every file with pages has one, and it is always a PDF:
- A PDF previews as a copy with a text layer, or as the original itself. Both have the same pages, sizes and rotations as the original.
- A JPEG or PNG previews as a one-page PDF of the image, turned upright by its EXIF orientation.
- A DOC or DOCX previews as the PDF that AirCredit converted it to.
To show a page citation, draw it on page page of this PDF. Its coordinates are fractions
of that page as it is displayed, so they need no rules per file type.
Text files have no pages and no preview. A text citation is a byte range in the original upload, so highlight it in the file you uploaded.
200with the PDF once the file is ready.409 preview_not_readywithRetry-Afterwhile AirCredit is still preparing the file, or while its preview may still be stored.404 preview_unavailablefor a text file, for a file that could not be processed, and for a file whose preview can no longer be made. Retrying does not help.
The pages of a preview never change. A later download can return a different PDF of the same pages, for example a Word file's converted PDF with a text layer added.
With a test key, every file with pages returns the same one-page sample PDF, free of charge.
BearerAuthAuthorizationBearer <token>A partner API key, sent as Authorization: Bearer <key>. Live keys look like sk_live_<lookup>_<secret> and test keys like sk_test_<lookup>_<secret>. A key sees only data of its own mode.
id*stringThe ID of the file.
^file_[A-Za-z0-9_-]+$x-request-id?stringYour ID for correlating this request with your logs, up to 128 bytes. If it is missing, empty or longer, the API generates one as req_<uuid>. The response echoes the ID in x-request-id, and error bodies repeat it in request_id.
1 <= length <= 128The preview PDF, whose pages are the pages that page citations count.
response?PreviewPdfapplication/pdfThe bytes of the preview PDF.
binarycurl -X GET 'https://api.aircredit.de/partner/v1/files/file_8f2a/preview'"string"Deletes the file and everything derived from it, such as its preview. Every analysis that uses the file becomes unavailable, and running work on it is canceled. The deletion takes effect at once, and the stored data is removed in the background.
BearerAuthAuthorizationBearer <token>A partner API key, sent as Authorization: Bearer <key>. Live keys look like sk_live_<lookup>_<secret> and test keys like sk_test_<lookup>_<secret>. A key sees only data of its own mode.
id*stringThe ID of the file.
^file_[A-Za-z0-9_-]+$x-request-id?stringYour ID for correlating this request with your logs, up to 128 bytes. If it is missing, empty or longer, the API generates one as req_<uuid>. The response echoes the ID in x-request-id, and error bodies repeat it in request_id.
1 <= length <= 128The deletion was recorded. The response has no body.
curl -X DELETE 'https://api.aircredit.de/partner/v1/files/file_8f2a'