Products and files
Upload file
/ v1 / files Stores a file that buyers get, as content of a product or a lesson: for example a PDF, ZIP, video, audio or image. For images on a sales page, use POST /v1/images or put a URL into images.
There are two ways:
- Upload with PUT (preferred, up to 5 GB). Send
file_nameandsize_byteswithouturl. The answer has anupload_url. Send the bytes there with HTTP PUT, for example with curl, then callPOST /v1/files/{file_id}/finish. - Copy from a URL (up to 10 MB). Send
url, and Tentary copies the file from the public https URL at once. No finish step is needed. Use this only if you cannot send a PUT.
Larger files without PUT: the account owner uploads them in the Tentary app.
Then add the file to a content block of PATCH /v1/products/{product_id}, POST /v1/courses/{course_id}/lessons or PATCH /v1/lessons/{lesson_id}, for example {"type": "video", "file_id": ...}.
- Block types
image,videoandaudioshow the file in a player. Typefilegives a download, also for a video or an image. kindin the answer is the block type that fits the file.- Videos in a video block are converted for streaming. This takes some minutes.
See File uploads.
Authorization
-
Authorizationstring header requiredBearer tnt_…· A personal API key (tnt_...). Create it in the Tentary app on the page AI & API. Introduction
Body application/json
-
urlstringPublic https URL of the file (at most 10 MB).
max length
2048 -
file_namestringName with extension, like "Workbook.pdf". With url: optional (default from the URL).
max length
250 -
size_bytesintegerWithout url: the exact file size.
min
1max5368709120
Response
Fields of the answer with status 200. Errors always have the same format, see Errors.
Without url: the upload_url for the PUT. With url: the stored file.
Variant 1 of 2
-
file_idintegerCall finish_upload with it after the PUT.
-
upload_urlstring<uri>Send the bytes here with HTTP PUT, without extra headers.
-
methodstringThe HTTP method for the upload.
Allowed values:
PUT -
expires_in_secondsintegerThe upload_url works this long.
-
next_stepstringWhat to do next (PUT, then finish_upload).
Variant 2 of 2
-
file_idintegerUse it in a content block.
-
namestringThe name.
-
file_typestringFile extension, like pdf.
-
kindstringThe content block type that fits the file.
Allowed values:
imagevideoaudiofile -
size_bytesintegerFile size in bytes.