Getting Started
This guide will help you make your first API call to FoN.
Step 1: Create an Account
Before using the API, you need a FoN account. Register at fucksornot.com or use the API:
curl -X POST https://api.fucksornot.com/api/auth \
-H "Content-Type: application/json" \
-d '{
"action": "register",
"email": "you@example.com",
"username": "yourname",
"password": "SecurePassword123!"
}'
Step 2: Generate an API Token
For programmatic access, generate an API token. First, log in:
curl -X POST https://api.fucksornot.com/api/auth \
-H "Content-Type: application/json" \
-d '{
"action": "login",
"email": "you@example.com",
"password": "SecurePassword123!"
}'
Save the JWT token from the response, then generate an API token:
curl -X POST https://api.fucksornot.com/api/auth/tokens/generate \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "My Script"}'
Save your API token securely. It’s only shown once and cannot be retrieved later.
Step 3: Make Your First Upload
Upload an image using your API token:
curl -X POST https://api.fucksornot.com/api/v1/upload \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "upload_type=image" \
-F "description=Check out this cool thing" \
-F "tags=gadget,tech" \
-F "file=@/path/to/image.jpg"
Step 4: Browse Content
List recent uploads (no authentication required):
curl https://api.fucksornot.com/api/uploads?page=1&limit=10
Step 5: Vote on Content
Vote on an upload:
curl -X POST https://api.fucksornot.com/api/vote \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"uploadId": "upload-uuid-here",
"vote": "fucks"
}'
Code Examples
const fetch = require('node-fetch');
const FormData = require('form-data');
const fs = require('fs');
const API_TOKEN = 'your_api_token';
// Upload an image
async function uploadImage(filePath, description) {
const form = new FormData();
form.append('upload_type', 'image');
form.append('description', description);
form.append('file', fs.createReadStream(filePath));
const response = await fetch('https://api.fucksornot.com/api/v1/upload', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_TOKEN}`
},
body: form
});
return response.json();
}
uploadImage('./cool-thing.jpg', 'Check this out!')
.then(console.log);
Next Steps