Quickstart
This guide will help you make your first API call to JustAI in just 5 minutes.
Prerequisites
Section titled “Prerequisites”Before you begin, you’ll need:
- At least one template created in the Console.
Step 1: Get Your API Key
Section titled “Step 1: Get Your API Key”- Log in to the JustAI Console.
- Navigate to Settings → API Keys.
- Click Create New API Key.
- Copy your new API key (you won’t be able to see it again!).
Step 2: Get Your Organization Slug
Section titled “Step 2: Get Your Organization Slug”Your organization slug is your company identifier, usually your company name in lowercase (e.g., your-company). If you’re unsure, ask us.
Step 3: Find a Template ID
Section titled “Step 3: Find a Template ID”- In the Console, go to Templates.
- Click on any template.
- Copy the Template ID from the URL or template details (e.g.,
console.justwords.ai/templates/c2cb96ff/overview->c2cb96ff).
Step 4: Make Your First Request
Section titled “Step 4: Make Your First Request”Choose your preferred programming language and run this code:
curl -X POST https://worker.justwords.ai/api/generate/your-org \ -H "X-Api-Key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "template_id": "your_template_id", "user_id": "user_123" }'Replace:
your-orgwith your organization slugyour_api_key_herewith your actual API keyyour_template_idwith a template ID from your account
const response = await fetch( 'https://worker.justwords.ai/api/generate/your-org', { method: 'POST', headers: { 'X-Api-Key': 'your_api_key_here', 'Content-Type': 'application/json', }, body: JSON.stringify({ template_id: 'your_template_id', user_id: 'user_123', }), });
const data = await response.json();console.log(data);import requests
url = "https://worker.justwords.ai/api/generate/your-org"headers = { "X-Api-Key": "your_api_key_here", "Content-Type": "application/json"}payload = { "template_id": "your_template_id", "user_id": "user_123"}
response = requests.post(url, json=payload, headers=headers)data = response.json()print(data)const https = require('https');
const data = JSON.stringify({ template_id: 'your_template_id', user_id: 'user_123',});
const options = { hostname: 'worker.justwords.ai', port: 443, path: '/api/generate/your-org', method: 'POST', headers: { 'X-Api-Key': 'your_api_key_here', 'Content-Type': 'application/json', 'Content-Length': data.length, },};
const req = https.request(options, (res) => { let body = ''; res.on('data', (chunk) => (body += chunk)); res.on('end', () => { console.log(JSON.parse(body)); });});
req.on('error', (error) => console.error(error));req.write(data);req.end();Step 5: Understand the Response
Section titled “Step 5: Understand the Response”You should receive a JSON response like this:
{ "copy": { "id": "variant_abc123", "vars": { "subject": "Welcome to our platform!", "body": "We're excited to have you join us.", "preheader": "Get started in minutes" } }}What this means:
copy.id: The unique identifier for the selected variant.copy.vars: The template variables (subject, body, etc.) personalized for this user.
You can use these values in your email, push notification, or wherever you need personalized content.
Next Steps
Section titled “Next Steps”Now that you’ve made your first API call, explore more features:
- Generate Endpoint - Learn about all available parameters.
- Platform Docs - Understand templates, variants, and auto-tune.