API Reference
The GoFile REST API lets you upload, manage, and share files programmatically. All endpoints return JSON.
Introduction
Base URL:
https://api.gofile.my/v1
All requests and responses use JSON. File uploads use multipart/form-data. Timestamps are ISO 8601 UTC strings.
Authentication
Authenticate by passing your API token in the Authorization header:
Authorization: Bearer YOUR_API_TOKEN
Retrieve your token from Account → API Token in the dashboard. Guest uploads (no account) are allowed for certain endpoints but have reduced rate limits and shorter file retention.
Keep your token secret. Treat it like a password — anyone with your token can read, upload, and delete files in your account.
Errors
GoFile uses conventional HTTP status codes. The response body always contains a status field:
{
"status": "error",
"message": "Unauthorized — invalid or missing API token",
"code": "ERR_UNAUTHORIZED"
}
| Code | Meaning |
|---|---|
| 200 | OK |
| 400 | Bad request — invalid parameters |
| 401 | Unauthorized — missing or invalid token |
| 403 | Forbidden — you don't have access to this resource |
| 404 | Not found |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
Rate Limits
| Plan | Requests / minute | Uploads / hour | Max file size |
|---|---|---|---|
| Guest | 20 | 10 | Unlimited |
| Free account | 60 | 100 | Unlimited |
| Premium | 300 | Unlimited | Unlimited |
Rate limit headers are included in every response: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset.
Upload Files
Upload files as multipart/form-data. Multiple files can be included in a single request. If authenticated, files are added to your account.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| file | file | required | The file(s) to upload. Repeat for multiple files. |
| folderId | string | optional | Upload into an existing folder (account required). |
| folderName | string | optional | Create a new folder with this name and upload into it. |
Response
{
"status": "ok",
"data": {
"folderId": "abc123",
"folderCode": "xK9mN2",
"files": [
{
"fileId": "f7e2a891-...",
"name": "report.pdf",
"size": 1048576,
"md5": "d8e8fca2dc0f896fd7cb4cb0031ba249",
"mimeType": "application/pdf",
"downloadPage": "https://gofile.my/d/xK9mN2"
}
]
}
}
Example
curl -X POST https://api.gofile.my/v1/upload \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "file=@report.pdf"
import requests
with open("report.pdf", "rb") as f:
r = requests.post(
"https://api.gofile.my/v1/upload",
headers={"Authorization": "Bearer YOUR_TOKEN"},
files={"file": f},
)
print(r.json())
const form = new FormData();
form.append("file", fileBlob, "report.pdf");
const res = await fetch("https://api.gofile.my/v1/upload", {
method: "POST",
headers: { Authorization: "Bearer YOUR_TOKEN" },
body: form,
});
const data = await res.json();
console.log(data.data.folderCode);
Get Content
Returns metadata for a folder or file. Folders include a list of child contents. Password-protected folders require an additional password query parameter.
Path parameters
| Parameter | Description |
|---|---|
| contentId | The folder code (e.g. xK9mN2) or file ID |
Query parameters
| Parameter | Type | Description |
|---|---|---|
| password | string | Required if content is password-protected |
Response
{
"status": "ok",
"data": {
"id": "xK9mN2",
"type": "folder",
"name": "My Folder",
"public": true,
"createTime": 1706745600,
"childs": [
{
"id": "f7e2a891-...",
"type": "file",
"name": "report.pdf",
"size": 1048576,
"mimeType": "application/pdf",
"downloadCount": 42,
"link": "https://cdn.gofile.my/f7e2a891-.../report.pdf"
}
]
}
}
Get File Info
Returns metadata and a direct download link for a specific file. The download link is signed and expires after 1 hour.
{
"status": "ok",
"data": {
"id": "f7e2a891-...",
"name": "report.pdf",
"size": 1048576,
"mimeType": "application/pdf",
"md5": "d8e8fca2dc0f896fd7cb4cb0031ba249",
"downloadCount": 42,
"createTime": 1706745600,
"expireTime": 1707523200,
"link": "https://cdn.gofile.my/f7e2a891-.../report.pdf?token=..."
}
}
Delete Content
Permanently deletes a file or folder (and all its contents). This action is irreversible. Requires authentication — you must own the content.
Response
{ "status": "ok" }
Warning: Deleting a folder deletes all files inside it. This cannot be undone.
Account
{
"status": "ok",
"data": {
"id": "usr_9f2e...",
"email": "john@example.com",
"tier": "premium",
"storageUsed": 5368709120,
"storageLimit": null,
"rootFolder": "root_abc123",
"createdAt": "2024-01-15T10:30:00Z"
}
}
SDKs & Libraries
Community-maintained SDKs:
- Python: pip install gofile-sdk
- JavaScript/Node: npm install gofile-js
- Go: go get github.com/gofileio/gofile-go
SDKs are community projects and not officially maintained by GoFile. Please report issues in their respective repositories.
Webhooks
Premium accounts can register a webhook URL to receive events when files in your account are downloaded or deleted. Configure webhooks in Account → Webhooks.
Payload
{
"event": "file.downloaded",
"fileId": "f7e2a891-...",
"fileName": "report.pdf",
"downloadIp": "1.2.3.x",
"timestamp": "2025-01-30T14:22:01Z"
}
Changelog
Added webhook support for Premium accounts. Added md5 field to file objects.
Increased guest rate limits. Added folderName parameter to upload endpoint.
Signed download links now expire after 1 hour (previously 15 minutes).
Initial public API release.