Back to Dashboard

API Documentation

Integrate Lunox directly into your workflow.

Authentication

Authenticate your requests by adding the x-api-key header. You can generate API Keys in the Settings page.

x-api-key: sk_lx_...

Upload Methods

Option 1: CLI / Raw Upload

Best for scripts and automation.

# Upload a file
curl -X POST https://lunox.io/api/paste \
  -H "Content-Type: text/plain" \
  -H "x-api-key: YOUR_KEY" \
  --data-binary @filename.txt
Option 2: JSON Payload

For customizing metadata (title, lang, etc).

curl -X POST https://lunox.io/api/paste \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_KEY" \
  -d '{
    "title": "My Script",
    "content": "print(\"Hello\")",
    "language": "python"
  }'

JSON Parameters

FieldTypeDescription
contentstringRequired. The code/text content (Max 1MB).
titlestringOptional. Title of the paste.
languagestringe.g., javascript, python, markdown.
visibilityenumPUBLIC, UNLISTED, PRIVATE.
expiresInenumnever, 1h, 24h, 7d.
collectionIdstringCollection ID to organize this paste.
isEncryptedbooleanSet to true if content is encrypted client-side.
contributorsstring[]Array of usernames to add as editor contributors.
Contributor Management

Allow other users to edit your paste by adding them as contributors.

Add Contributor

# POST /api/paste/[id]/contributors
curl -X POST https://lunox.io/api/paste/PASTE_ID/contributors \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_KEY" \
  -d '{ "username": "friend_username" }'

Remove Contributor

# DELETE /api/paste/[id]/contributors?userId=USER_ID
curl -X DELETE "https://lunox.io/api/paste/PASTE_ID/contributors?userId=USER_ID" \
  -H "x-api-key: YOUR_KEY"
Client-Side Encryption

You can encrypt pastes on your machine before sending them to the server. The server will store the encrypted blob and never see the original content. Viewers will need the key (via URL hash) to decrypt it in the browser.

Example (Node.js)

const CryptoJS = require("crypto-js");
const axios = require("axios");

// 1. Generate a random 32-char hex key
const key = CryptoJS.lib.WordArray.random(16).toString();

// 2. Encrypt your content
const content = "Secret Message";
const encrypted = CryptoJS.AES.encrypt(content, key).toString();

// 3. Send to API
axios.post("https://lunox.io/api/paste", {
  content: encrypted,
  isEncrypted: true,
  title: "Encrypted Paste",
  language: "text"
}, {
  headers: { "x-api-key": "YOUR_KEY" }
}).then(res => {
  // 4. Construct Shareable URL with Key Hash
  console.log(`Link: https://lunox.io/p/${res.data.id}#${key}`);
});