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"
}
CodeMeaning
200OK
400Bad request — invalid parameters
401Unauthorized — missing or invalid token
403Forbidden — you don't have access to this resource
404Not found
429Rate limit exceeded
500Internal server error

Rate Limits

PlanRequests / minuteUploads / hourMax file size
Guest2010Unlimited
Free account60100Unlimited
Premium300UnlimitedUnlimited

Rate limit headers are included in every response: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset.

Upload Files

POST /upload Upload one or more 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

FieldTypeRequiredDescription
filefilerequiredThe file(s) to upload. Repeat for multiple files.
folderIdstringoptionalUpload into an existing folder (account required).
folderNamestringoptionalCreate 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

GET /content/{contentId} Get folder or file metadata

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

ParameterDescription
contentIdThe folder code (e.g. xK9mN2) or file ID

Query parameters

ParameterTypeDescription
passwordstringRequired 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

GET /files/{fileId} Get metadata for a single file

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

DELETE /content/{contentId} Delete a file or folder

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

GET /account/me Get account information
{
  "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

v1.4.0Jan 2025
Added webhook support for Premium accounts. Added md5 field to file objects.
v1.3.0Oct 2024
Increased guest rate limits. Added folderName parameter to upload endpoint.
v1.2.0Jun 2024
Signed download links now expire after 1 hour (previously 15 minutes).
v1.0.0Jan 2024
Initial public API release.