Integrations overview
Integrations are apps, plugins and bots that upload to your Chevereto website from somewhere else: your desktop, the command line, a chat app or another website. You upload from the tool you already use and get back the links, without opening your Chevereto website.
How integrations work
Most integrations talk to your Chevereto website through its API, a web address made for programs instead of people. Each Chevereto website has an upload API at its address followed by /api/1/upload, for example https://mysite.com/api/1/upload.
When you upload with an integration:
- The integration sends the file and your API key to the upload API
- Your website checks the key to know who is uploading, and saves the file to that account
- Your website replies with the details of the upload, including its links
- The integration shows you the links, or copies them to the clipboard
The upload works the same as if you used the website: it shows in your account and follows the same rules for formats, file size and moderation.
What you need
To set up an integration you need two things:
| You need | Where to get it |
|---|---|
| Your API key | In Settings > API |
| Your website address | The address you open in your browser, for example https://mysite.com |
Some integrations ask for the full upload URL (https://mysite.com/api/1/upload), others ask only for the website address and add /api/1/upload for themselves. Each integration guide tells you which one to use.
API not available?
If you don't see API in your settings, the website administrator has disabled the user API and integrations that need an API key won't work on that website.
What you can set on uploads
Besides the file, the API accepts options for each upload. Integrations decide which of these they let you set, so not every option is available in every integration.
| Option | Description |
|---|---|
album_id | Album where the upload goes. Must be one of your albums |
title | Title of the upload. Taken from the file metadata when not set |
description | Description of the upload. Taken from the file metadata when not set |
tags | Tags, separated by commas |
category_id | Category of the upload |
width | Resize the image to this width, keeping its proportions |
expiration | Delete the upload after a time, for example PT5M (5 minutes) or P3D (3 days) |
nsfw | 1 to flag the upload as not safe for work |
TIP
The album ID is the last part of the album URL, after the dot. For https://mysite.com/album/vacation.AbCd the album ID is AbCd.
What you get back
The API replies in one of three ways. Integrations pick the one they need, and some let you choose:
| Format | Reply |
|---|---|
json | All the details of the upload: links, size, thumbnails, delete link and more |
txt | Only the direct link to the file |
redirect | Sends you to the page of the upload on your website |
Integrations without an API key
The Popup Upload Plugin works differently. It doesn't use your API key: it opens the upload box of your Chevereto website in a popup on another website, and uploads as whoever is signed in on your Chevereto website, or as a guest if the website allows guest uploads.
Keep your API key safe
Your API key works like a password for uploads: anyone who has it can upload files to your account.
- Don't share your key or post it in forums, chats or screenshots
- Don't save it in code that you publish, such as a public Git repository
- For bots that other people can reach, like the Telegram Bot, limit who can use the bot
If you think your key was exposed, regenerate it. The old key stops working right away, so update every integration with the new key.
Troubleshooting
| Problem | What to do |
|---|---|
| This API key format is no longer supported | Your key is from before Chevereto 4.4. Regenerate it |
| The key is rejected after it worked before | The key was regenerated. Copy the new key to the integration |
| Nothing is uploaded or the address isn't found | Check the website address: use https://, and add or remove /api/1/upload as the guide says |
| The file is rejected | Check that the website accepts the format and size of the file |
| The upload doesn't go to the album | Check the album ID and that the album is yours |
For developers
Build your own integration
Any program that can send a web request can upload to Chevereto. Send a POST request to /api/1/upload with the file in the source field and the user's API key in the X-API-Key header:
curl --fail-with-body -X POST \
-H "X-API-Key: YOUR_API_KEY" \
-F "source=@image.jpeg" \
-F "format=json" \
https://mysite.com/api/1/uploadThe JSON reply carries the links in image.url (direct), image.url_viewer (page) and image.delete_url (delete). The Authorization and File upload docs list every parameter and the full reply.
A few tips:
- Ask users for their website address and API key, never ship a key in your code
- Prefer the
X-API-Keyheader over thekeyparameter, so the key doesn't end up in URLs and logs - Tell users that regenerating their key stops your integration until they enter the new one
To change Chevereto itself, for example with your own routes, theme or translations, see the developer documentation.
Made an integration? Send a pull request to the user manual repository with a guide for it in the integrations folder.
