Documentation

API Reference

Authentication

Learn how to authenticate with the Titlize API using API tokens.

3 min read

All API requests to Titlize require authentication using an API token. This guide explains how to create and use API tokens.

Creating an API Token#

  1. Log in to your Titlize dashboard (opens in new tab)
  2. Navigate to Settings > API Tokens
  3. Click Create New Token
  4. Give your token a descriptive name (e.g., "Production Website")
  5. Copy and securely store the token - it won't be shown again

Important: Your API token is displayed only once when created. Store it securely in environment variables or a secrets manager.

Using Your API Token#

Include your API token in the Authorization header of every request:

Bash
1curl -X POST https://api.titlize.com/generate \
2 -H "Authorization: Bearer your_api_token_here" \
3 -F "image=@photo.jpg" \
4 -F "title=Hello World"

JavaScript Example#

JavaScript
1const response = await fetch('https://api.titlize.com/generate', {
2 method: 'POST',
3 headers: {
4 'Authorization': `Bearer ${process.env.IMAGE_TITLER_API_TOKEN}`,
5 },
6 body: formData,
7});

Python Example#

Python
1import requests
2
3headers = {
4 'Authorization': f'Bearer {api_token}'
5}
6
7response = requests.post(
8 'https://api.titlize.com/generate',
9 headers=headers,
10 files={'image': open('photo.jpg', 'rb')},
11 data={'title': 'Hello World'}
12)

Token Security#

Best Practices#

  • Never commit tokens to version control - Use environment variables instead
  • Use separate tokens for different environments - Create distinct tokens for development, staging, and production
  • Rotate tokens periodically - Delete old tokens and create new ones regularly
  • Monitor usage - Check your dashboard for unusual activity

Environment Variables#

Store your API token in environment variables:

Bash
1# .env.local (don't commit this file!)
2IMAGE_TITLER_API_TOKEN=your_api_token_here

Then access it in your code:

JavaScript
1// Node.js
2const token = process.env.IMAGE_TITLER_API_TOKEN;
Python
1# Python
2import os
3token = os.environ.get('IMAGE_TITLER_API_TOKEN')

Rate Limits#

API rate limits vary by subscription tier:

TierRequests/MonthRequests/Minute
Free105
Starter10010
Pro50030
EnterpriseUnlimited100

When you exceed your rate limit, the API returns a 429 Too Many Requests response:

JSON
1{
2 "error": "Rate limit exceeded",
3 "message": "You have exceeded your monthly quota",
4 "retryAfter": 3600
5}

Error Handling#

Invalid Token#

JSON
1{
2 "error": "Unauthorized",
3 "message": "Invalid or expired API token"
4}

Solution: Check that your token is correct and hasn't been revoked.

Missing Token#

JSON
1{
2 "error": "Unauthorized",
3 "message": "Authorization header is required"
4}

Solution: Include the Authorization: Bearer <token> header.

Revoking Tokens#

To revoke an API token:

  1. Go to Settings > API Tokens in your dashboard
  2. Find the token you want to revoke
  3. Click the Delete button
  4. Confirm the deletion

Revoked tokens immediately stop working. Any requests using that token will receive a 401 Unauthorized response.

Next Steps#