# Android: upload with HTTP Shortcuts

How to set up HTTP Shortcuts on Android to upload to hematite from the share sheet and copy each link: make a key, then one shortcut with a header and a file.

On Android, [HTTP Shortcuts](https://http-shortcuts.rmy.ch), a free app, uploads to hematite what you share with it: share a screenshot or a photo, choose **hematite**, and the link is on your clipboard. You set it up once, with an upload key from hematite. Do it all on the phone, so the key is on its clipboard when you need it.

## Make a key

1. **Open Uploaders.** On the phone, sign in to hematite and open [Settings → Uploaders](https://hematite.gg/settings/uploaders).
2. **Get a key.** Press **Get key** beside **Android**, then **Make key**.
3. **Copy it.** Press **Copy**. It's shown only this once; if you lose it, remove it and make another.

## Set up the shortcut

In HTTP Shortcuts, press **+**, choose **Regular HTTP Shortcut**, then **Create from scratch**:

1. **Name and address.** Name it `hematite`. Set the method to **POST** and the URL to `https://api.hematite.gg/v1/images`.
2. **The key.** Under **Request Headers**, press **Add Header**: **Header** `Authorization`, and paste your key as its **Value**.
3. **The file.** Under **Request Body / Parameters**, set **Request Body Type** to **Parameters (form-data)**. Add a parameter with **Parameter Type** **File**, **Parameter Name** `file`, and **File Data Source** **Open File Picker**. Then add a text parameter named `p` with `http-shortcuts`.
4. **Copy the link.** Under **Scripting**, in **Run on Success**, put:

   ```js
   copyToClipboard(JSON.parse(response.body).data.shareUrl);
   showToast("Link copied");
   ```

5. **Quiet on success.** Under **Response Handling**, choose **Show nothing (run silently)** for a success, so only the toast shows.
6. **Save it.** Under **Trigger & Execution Settings**, **Allow receiving files from share dialog** is on already: leave it so.

Now share a screenshot or a photo and choose **HTTP Shortcuts**, then **hematite**. When it's up, a toast says the link is copied. Run from the app's list instead, it asks you to pick a file.

> **Warning: The shortcut holds your key**
>
> Anyone with the key can upload to your account until it expires or you remove
> it. An export of your shortcuts holds it too, so keep exports to yourself. If
> it gets out, remove the key and make a new one.

## How its uploads come out

- **They take your [upload settings](https://hematite.gg/settings/upload):** who can see them, when they delete themselves, how they're compressed. The link follows your [link settings](https://hematite.gg/docs/guides/share-links).
- **PNG, JPEG, GIF and WebP,** up to 16 MB. Some phones save photos as HEIF: hematite refuses those, so share a screenshot or a JPEG, or set the camera to JPEG.

## When it fails

HTTP Shortcuts shows hematite's answer. Its `message` says why:

| It says                                    | What it means                                           | What to do                                   |
| ------------------------------------------ | ------------------------------------------------------- | -------------------------------------------- |
| Authentication is required for this route. | The key is wrong, expired or removed                    | Make a new key and paste it into the header  |
| Storage limit reached                      | Your plan's storage is full                             | Delete something, or see [pricing](https://hematite.gg/pricing) |
| Request validation failed.                 | The file is over 16 MB, or isn't PNG, JPEG, GIF or WebP | Share a screenshot or a JPEG                 |

## Your key

It lasts 90 days and counts toward your ten upload tokens. It's listed as **HTTP Shortcuts** on [Settings → Uploaders](https://hematite.gg/settings/uploaders) and in [Settings → Security](https://hematite.gg/settings/security). Remove it in either place and the shortcut stops uploading. To go on, make a new key and paste it into the **Authorization** header. On an iPhone, [a Shortcut](https://hematite.gg/docs/uploaders/iphone) does the same.
