Skip to main content

How to Get an API Key

A simple guide to finding, copying, generating, and regenerating your X02 API key for developer scripts, bots, and ShareX integrations.

By X02 Team · · Tutorial, API, Developer Tools, Security, Beginners

An API Key is a unique secret token that identifies your X02 account when uploading files outside of your web browser. You need an API key if you want to:

This guide covers how to get your API key from the dashboard, how to generate one programmatically, and how to use it securely.

[!TIP] Quick Navigation:


Part 1: The Easy Guide (For Everyone)

Every registered X02 user automatically gets a personal API key. You can find and copy it in less than 10 seconds.

Architecture Diagram

Step-by-Step: Copying Your API Key

Where to Go Direct Link Action
Dashboard Settings API Keys Open Dashboard Settings Click Copy API Key
  1. Log in to your account at x02.me.
  2. Open your Dashboard and navigate to Settings.
  3. Scroll to the API Keys section.
  4. Click the Copy button next to your key.

Your API key is now copied to your clipboard and ready to paste into ShareX or your custom scripts.


How to Regenerate Your API Key

If you accidentally exposed your API key on a public GitHub repository or livestream, you should regenerate it immediately:

  1. Go to Dashboard Settings API Keys.
  2. Click Regenerate API Key.
  3. Confirm the prompt.

[!IMPORTANT] Regenerating your API key immediately invalidates the old key. Be sure to update your ShareX profile, .env files, and CI/CD secrets with your new token.


Part 2: The Developer & Power User Guide


1. Using Your API Key in HTTP Requests

To authenticate requests to the X02 API, provide your key in the x-api-key header (or as a Bearer token in the Authorization header):

cURL Example:

curl -X POST "https://x02.me/api/upload" \
  -H "x-api-key: YOUR_X02_API_KEY" \
  -F "[email protected]"

Node.js / TypeScript Example:

const response = await fetch("https://x02.me/api/upload", {
  method: "POST",
  headers: {
    "x-api-key": process.env.X02_API_KEY!,
    "Accept": "application/json",
  },
  body: formData,
});

Python Example:

import os
import requests

headers = {
    "x-api-key": os.getenv("X02_API_KEY"),
    "Accept": "application/json"
}

with open("report.pdf", "rb") as f:
    response = requests.post("https://x02.me/api/upload", headers=headers, files={"file": f})

print(response.json())

2. Generating a Key Programmatically via API

If you are building an automated provisioning tool, you can request an API key programmatically:

curl -X POST "https://x02.me/api/keys/generate"

JSON Response:

{
  "success": true,
  "data": {
    "apiKey": "x02_k928fa8bc910283...",
    "limits": {
      "dailyLimit": 50,
      "hourlyLimit": 20
    }
  }
}

3. Generating Folder-Specific API Keys

If you want an API key that automatically routes all uploaded files into a specific folder:

curl -X POST "https://x02.me/api/user/folders/FOLDER_ID/key" \
  -H "x-api-key: YOUR_PRIMARY_API_KEY"

Any upload sent with this key will land straight inside the designated folder without requiring extra folder parameters.


Security Best Practices

Rule Why It Matters
Never commit keys to Git Use .env files and add .env to your .gitignore to prevent secret leaks.
Use GitHub Secrets in CI/CD Add your key under Repository Settings Secrets and variables Actions as X02_API_KEY.
Regenerate Leaked Keys Immediately If a key is exposed publicly, click Regenerate in your dashboard to revoke access instantly.

Next Steps & Related Tutorials

What to learn next Guide Link
Use your API key to connect ShareX How to Integrate ShareX with X02
Upload files using cURL, the REST API, or MCP How to Upload Files to X02
Create dedicated upload keys for folders How to Organize Files with Folders
Swap uploaded files via API How to Replace a File Without Changing Its Link

Read this article on X02