Image hosting
API keys
An API key lets your own program upload images without anyone being signed in: a game server, a Discord bot, a script.
Create a key #
- In the Portal, open Image hosting and scroll to API keys.
- Give the key a name that says where it will be used, such as "My FiveM server".
- Enter your password and press Create key.
- Copy the key and store it where your program can read it.
Important
The key is shown once. We keep only a scrambled copy, so we cannot show it to you again. If you lose it, revoke it and create a new one.
A key starts with eh_. You can have up to ten, so each server or bot can have its own.
Use a key #
Send it in the Authorization header of your upload:
curl -X POST https://eruptedhosting.com/api/v1/images \
-H "Authorization: Bearer YOUR_KEY" \
-F "[email protected]"
The answer contains the image's permanent link:
{
"url": "https://cdn.eruptedhosting.com/images/8f3c2a91d7e44c2b9f0a1b2c3d4e5f60.png",
"id": 42
}
Everything else a key can do is in the API reference.
Keep keys safe #
A key can upload to your storage and delete your images. It cannot do anything else on your account.
- Keep a key on your server. Do not put it in anything players or visitors download, because they can read it there.
- Use a different key for each place, so you can revoke one without breaking the others.
- Do not post a key in Discord, a screenshot or a public code repository.
Revoke a key #
On the Image hosting page, press Revoke beside the key. It stops working immediately. Images uploaded with it are not affected.
The list also shows when each key was last used, which helps you spot one that is no longer needed.