# Upload image

`POST https://api.tentary.com/v1/images`

Source: https://tentary.com/en/help/api/upload-image/
Area: Products and files
MCP tool: `upload_image`. Changes data at once.

---

Uploads an image from your disk for a sales page, course, module, email or landing page: PNG, JPG, GIF or WebP, at most 10 MB.

1. Send `file_name` and `size_bytes`. The answer has an `upload_url`.
2. Send the bytes there with HTTP PUT.
3. Call [`POST /v1/images/{upload_id}/finish`](https://tentary.com/en/help/api/finish-image/) with the `upload_id`.

An image that is already at a public URL needs no upload: put the URL into `images` directly. For files that buyers get, use [`POST /v1/files`](https://tentary.com/en/help/api/upload-file/).

## Authorization

`Authorization: Bearer <API key>`

A personal API key (tnt_...). Create it in the Tentary app on the page AI & API.

## Request body

- `file_name` (string, required): Name with extension, like "cover.png". Limits: maxLength 250.
- `size_bytes` (integer, required): The exact file size. Limits: min 1, max 10485760.

## Response

- `upload_id` (string): Call finish_image 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. Allowed values: `PUT`.
- `expires_in_seconds` (integer): The upload_url works this long.
- `next_step` (string): What to do next (PUT, then finish_image).

## Example request

```bash
curl -X POST "https://api.tentary.com/v1/images" \
  -H "Authorization: Bearer $TENTARY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "file_name": "cover.png",
  "size_bytes": 68
}'
```

## Example response

```json
{
  "upload_id": "2c83c3215660ad75ee567ef4fa2d6289.png",
  "upload_url": "https://tentary-files.s3.eu-central-1.amazonaws.com/image-uploads/7/2c83c3215660ad75ee567ef4fa2d6289.png?X-Amz-Expires=1200&X-Amz-Signature=3f9a2c71e0b4",
  "method": "PUT",
  "expires_in_seconds": 1200,
  "next_step": "Send the image bytes with HTTP PUT to upload_url (no extra headers), for example: curl -T <file> \"<upload_url>\". Then call finish_image with upload_id."
}
```
