API reference

Files

Upload a file

POST
/v1/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.

Authorization

BearerAuth
headerAuthorizationBearer <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.

Header Parameters

x-request-id?string

Your 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.

Length1 <= length <= 128
Idempotency-Key*string

A 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.

Match^[!-~]+$
Length1 <= length <= 255

Request Body

Exactly one file part and an optional retention_days part with a single number. Duplicate or unknown parts are rejected.

multipart/form-data
  1. body

The file to upload and, optionally, how long to keep it.

file*file

The original file. Text files must be UTF-8.

Formatbinary
retention_days?RetentionDays

How 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.

Range1 <= value <= 90

Response Body

The 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
  1. response

An uploaded file. Its content never changes.

id*FileId

The file's ID. Use it in files when you create an analysis.

Match^file_[A-Za-z0-9_-]+$
mode*Mode

Whether this is a test or a live file, decided by the key that uploaded it.

Value in"test""live"
bytes*NonnegativeInteger

The size of the uploaded file in bytes.

Range0 <= value
expires_at*DateTime

When the file is deleted automatically.

Formatdate-time
Example Request
curl -X POST 'https://api.aircredit.de/partner/v1/files' \  -H 'Idempotency-Key: 5f0c8e2a-6b1d-4c3e-9a7f-2d4b8c1e0a93' \  -F 'file=@payslip.pdf'
Example Response
{  "id": "file_8f2a",  "mode": "live",  "bytes": 182044,  "expires_at": "2026-11-06T10:00:00Z"}

Get a file preview

GET
/v1/files/{id}/preview

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.

  • 200 with the PDF once the file is ready.
  • 409 preview_not_ready with Retry-After while AirCredit is still preparing the file, or while its preview may still be stored.
  • 404 preview_unavailable for 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.

Authorization

BearerAuth
headerAuthorizationBearer <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.

Path Parameters

id*string

The ID of the file.

Match^file_[A-Za-z0-9_-]+$

Header Parameters

x-request-id?string

Your 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.

Length1 <= length <= 128

Response Body

The preview PDF, whose pages are the pages that page citations count.

response?PreviewPdfapplication/pdf

The bytes of the preview PDF.

Formatbinary
Example Request
curl -X GET 'https://api.aircredit.de/partner/v1/files/file_8f2a/preview'
Example Response
"string"

Delete a file

DELETE
/v1/files/{id}

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.

Authorization

BearerAuth
headerAuthorizationBearer <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.

Path Parameters

id*string

The ID of the file.

Match^file_[A-Za-z0-9_-]+$

Header Parameters

x-request-id?string

Your 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.

Length1 <= length <= 128

Response Body

The deletion was recorded. The response has no body.

Example Request
curl -X DELETE 'https://api.aircredit.de/partner/v1/files/file_8f2a'
Example Response
Empty