API Documentation
Programmatic access to Vortex Code. Create and retrieve pastes via REST API.
API Endpoints
All endpoints require no authentication. Rate limiting may apply.
POST
/api/submit
Create a new paste. Returns the paste ID and URLs.
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| filename | String | Yes | Name of the file (e.g., "script.js", "data.txt") |
| content | String | Yes | The text content to store |
Example Request
fetch('/api/submit', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
filename: 'example.txt',
content: 'Hello, World!'
})
})
Example Response
{
"success": true,
"id": "abc123def",
"message": "Paste created successfully",
"url": "https://vortex-code.vercel.app/view/abc123def",
"rawUrl": "https://vortex-code.vercel.app/api/get/abc123def"
}
GET
/api/get/:id
Retrieve a paste by ID. Returns raw text content.
URL Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | String | Yes | The paste ID from creation response |
Example Request
fetch('/api/get/abc123def')
.then(response => response.text())
.then(data => console.log(data));
Example Response
Hello, World!
Response headers include X-Filename with the original filename.
Error Responses
Standard error format for all endpoints
{
"error": "Error message description"
}
| Status Code | Description |
|---|---|
| 400 | Bad Request - Missing or invalid parameters |
| 404 | Not Found - Paste ID doesn't exist |
| 405 | Method Not Allowed - Wrong HTTP method |
| 500 | Internal Server Error - Server-side issue |
Bot Integration Example
How to create pastes programmatically
// Python example using requests
import requests
import json
def create_paste(filename, content):
url = "https://vortex-code.vercel.app/api/submit"
data = {
"filename": filename,
"content": content
}
response = requests.post(url, json=data)
return response.json()
# Usage
result = create_paste("bot-log.txt", "Bot started at 2024-01-01")
print(result['url'])