Deutsch DE
API-Referenz
API-Referenz

Produkte und Dateien

Upload file

POST / 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:

  1. Upload with PUT (preferred, up to 5 GB). Send file_name and size_bytes without url. The answer has an upload_url. Send the bytes there with HTTP PUT, for example with curl, then call POST /v1/files/{file_id}/finish.
  2. 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, video and audio show the file in a player. Type file gives a download, also for a video or an image.
  • kind in 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.

Ändert sofort MCP-Werkzeug upload_file

Autorisierung

  • Authorization string Header erforderlich

    Bearer tnt_… · A personal API key (tnt_...). Create it in the Tentary app on the page AI & API. Einführung

Body application/json

  • url string

    Public https URL of the file (at most 10 MB).

    max. Länge 2048

  • file_name string

    Name with extension, like "Workbook.pdf". With url: optional (default from the URL).

    max. Länge 250

  • size_bytes integer

    Without url: the exact file size.

    min. 1 max. 5368709120

Antwort

Felder der Antwort mit Status 200. Fehler haben immer dasselbe Format, siehe Fehler.

Without url: the upload_url for the PUT. With url: the stored file.

Variante 1 von 2

  • file_id integer

    Call finish_upload with it after the PUT.

  • upload_url string<uri>

    Send the bytes here with HTTP PUT, without extra headers.

  • method string

    The HTTP method for the upload.

    Mögliche Werte: PUT

  • expires_in_seconds integer

    The upload_url works this long.

  • next_step string

    What to do next (PUT, then finish_upload).

Variante 2 von 2

  • file_id integer

    Use it in a content block.

  • name string

    The name.

  • file_type string

    File extension, like pdf.

  • kind string

    The content block type that fits the file.

    Mögliche Werte: imagevideoaudiofile

  • size_bytes integer

    File size in bytes.

Tippe, um zu suchen.