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://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://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://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://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://fucksornot.com/api/uploads?page= 1 & limit = 10
Step 5: Vote on Content
Vote on an upload:
curl -X POST https://fucksornot.com/api/vote \
-H "Cookie: auth-token=YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"uploadId": "upload-uuid-here",
"vote": "fucks"
}'
This endpoint, like most session-based endpoints, authenticates using the auth-token cookie that’s set automatically when you log in via a browser. For non-browser clients, pass the same JWT returned by the login response as a cookie value, as shown above.
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://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
Authentication Learn more about authentication options
Uploads Understand upload types and options
Voting Learn about the voting system
API Reference Explore all endpoints