Everything you need to generate Reddit OAuth tokens with a single API call.
Three steps to your first Reddit token:
POST /v1/token with your key to get a Reddit OAuth token# Step 1: Get a Reddit token from ThoughtLab
curl -X POST https://thoughtlab.cloud/v1/token \
-H "Authorization: Bearer sk_live_your_key_here"
# Response: {"ok":true,"token":"eyJhbG...","expires_in":86400}
# Step 2: Use that token with Reddit's API
curl https://oauth.reddit.com/r/programming/new \
-H "Authorization: bearer eyJhbG..."
Every request to the ThoughtLab API requires your API key as a Bearer token:
Authorization: Bearer sk_live_your_key_here
Your key starts with sk_live_ followed by 32 characters. Keep it secret — anyone with your key can use your account.
Generate a Reddit OAuth bearer token. Each token is valid for 24 hours and provides full read access to Reddit's API.
{
"ok": true,
"token": "eyJhbGci...",
"expires_in": 86400
}
curl -X POST https://thoughtlab.cloud/v1/token \
-H "Authorization: Bearer sk_live_your_key_here"
$ch = curl_init('https://thoughtlab.cloud/v1/token');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer sk_live_your_key_here'
],
]);
$data = json_decode(curl_exec($ch), true);
$token = $data['token'];
curl_close($ch);
// Now use $token with Reddit's API
$ch = curl_init('https://oauth.reddit.com/r/programming/new');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: bearer $token"],
]);
$posts = json_decode(curl_exec($ch), true);
curl_close($ch);
import requests
# Get token from ThoughtLab
r = requests.post(
'https://thoughtlab.cloud/v1/token',
headers={'Authorization': 'Bearer sk_live_your_key_here'}
)
token = r.json()['token']
# Use token with Reddit's API
posts = requests.get(
'https://oauth.reddit.com/r/programming/new',
headers={'Authorization': f'bearer {token}'}
).json()
// Get token from ThoughtLab
const res = await fetch('https://thoughtlab.cloud/v1/token', {
method: 'POST',
headers: { 'Authorization': 'Bearer sk_live_your_key_here' }
});
const { token } = await res.json();
// Use token with Reddit's API
const posts = await fetch('https://oauth.reddit.com/r/programming/new', {
headers: { 'Authorization': `bearer ${token}` }
}).then(r => r.json());
Check your API key's status and see how many tokens you've used today.
{
"ok": true,
"status": "active",
"expires_at": "2027-04-06 00:00:00",
"usage": {
"tokens_today": 1,
"tokens_this_hour": 0,
"limit_per_hour": 2,
"limit_per_day": 3
}
}
Replace your API key with a new one. Your old key stops working immediately. Limited to once per 24 hours.
{
"ok": true,
"api_key": "sk_live_new_key_here",
"message": "Key rotated — your old key is now invalid"
}
| Limit | Amount |
|---|---|
| Per hour | 2 tokens |
| Per day | 3 tokens |
| Key rotation | Once per 24 hours |
Each token lasts 24 hours, so 3 per day is more than enough for normal use. When rate limited, the response includes a Retry-After: 60 header.
The token you receive is a standard Reddit OAuth bearer token. Use it in the Authorization header when calling Reddit's API:
Authorization: bearer eyJhbGci...
The token provides read access to Reddit's OAuth API. Common endpoints:
| Reddit Endpoint | Description |
|---|---|
/r/{subreddit}/new | New posts in a subreddit |
/r/{subreddit}/hot | Hot posts in a subreddit |
/user/{username}/about | User profile info |
/user/{username}/overview | User's posts and comments |
/user/{username}/submitted | User's posts only |
/user/{username}/comments | User's comments only |
All Reddit API requests go to https://oauth.reddit.com (not www.reddit.com).
| HTTP | Code | Meaning |
|---|---|---|
| 401 | MISSING_KEY | No Authorization header or malformed key |
| 401 | INVALID_KEY | Key does not exist |
| 401 | KEY_REVOKED | Key has been permanently revoked |
| 402 | LICENSE_SUSPENDED | Payment failed — update billing info |
| 402 | LICENSE_EXPIRED | License has expired |
| 429 | RATE_LIMITED | Exceeded hourly or daily token limit |
| 429 | ROTATE_COOLDOWN | Key already rotated in the last 24 hours |
| 502 | TOKEN_GENERATION_FAILED | Reddit upstream error — retry shortly |
All errors follow this format:
{
"ok": false,
"error": "Human-readable message",
"code": "ERROR_CODE"
}
Ready to start generating tokens?
Get Your API Key