temp.my.id
API documentation
Upload file ke temp.my.id dari script atau command line menggunakan scoped API token.
Private API: tidak ada anonymous upload. Token dibuat admin, owner-scoped, dan hanya ditampilkan satu kali.
Quick start
- Login ke member area menggunakan username dan password.
- Buka bagian CLI API tokens pada Admin.
- Buat token dengan scope minimal yang diperlukan, lalu simpan token yang tampil satu kali.
- Set token sebagai environment variable dan kirim melalui header
Authorization: Bearer ....
export TEMP_API_TOKEN="tm_REPLACE_WITH_TOKEN"
printf "hello from CLI\n" > contoh.txt
curl --fail-with-body --silent --show-error \
-X POST \
-H "Authorization: Bearer ${TEMP_API_TOKEN}" \
-F "file=@./contoh.txt;type=text/plain" \
-F "expire=86400" \
https://temp.my.id/api/v1/uploadToken dan scope
upload— upload file.metadata— membaca metadata dan download file milik owner.upload,metadata— kedua operasi.
Token dapat dibuat tanpa expiry atau dengan expiry 1, 7, 30, atau 90 hari. Admin dapat rotate atau revoke token kapan saja. Token user A tidak dapat mengakses file user B.
Upload satu atau beberapa file
curl --fail-with-body --silent --show-error \
-X POST \
-H "Authorization: Bearer ${TEMP_API_TOKEN}" \
-F "file=@./file-1.txt" \
-F "expire=86400" \
https://temp.my.id/api/v1/uploadUntuk batch, ulangi field file[]:
curl --fail-with-body --silent --show-error \
-X POST \
-H "Authorization: Bearer ${TEMP_API_TOKEN}" \
-F "file[]=@./file-1.txt" \
-F "file[]=@./file-2.pdf;type=application/pdf" \
-F "expire=86400" \
https://temp.my.id/api/v1/uploadLimit aktif: 100 MB per file, 300 MB per batch, 20 file per batch, maksimal 60 upload per jam per user. Pilihan expiry: 15 menit, 1 jam, 6 jam, 24 jam, atau 48 jam.
Response sukses
{
"status": "success",
"data": {
"id": "<file-token>",
"download_url": "https://temp.my.id/?download=<file-token>",
"filename": "contoh.txt",
"size": 123,
"expires_at": "2026-09-17T10:00:00+00:00"
}
}Metadata dan download
Gunakan token dengan scope metadata:
curl --fail-with-body --silent --show-error \
-H "Authorization: Bearer ${TEMP_API_TOKEN}" \
https://temp.my.id/api/v1/file/<file-token>
curl --fail-with-body --silent --show-error \
-H "Authorization: Bearer ${TEMP_API_TOKEN}" \
-o hasil-download.bin \
https://temp.my.id/?download=<file-token>HTTP status dan error code
| HTTP | Code | Arti |
|---|---|---|
| 401 | INVALID_API_TOKEN | Token salah, expired, atau revoked. |
| 403 | INSUFFICIENT_SCOPE | Scope token tidak cukup. |
| 404 | NOT_FOUND | File tidak ada, expired, atau bukan milik owner. |
| 413 | FILE_TOO_LARGEBATCH_TOO_LARGE | Limit ukuran atau jumlah terlampaui. |
| 422 | VALIDATION_ERROREXPIRE_OUT_OF_RANGE | Input tidak valid. |
| 429 | RATE_LIMITED | Batas upload per jam tercapai. |
Keamanan token
- Jangan masukkan token ke source code, Git, URL, nama file, atau log.
- Simpan token di secret manager atau environment variable.
- Gunakan satu token per script/host dan scope paling minimal.
- Jika token bocor, revoke segera lalu buat token baru.
- Jangan gunakan
set -xketika environment token aktif.