Suggest subject lines
POST /ai/subject-lines
Subject lines for an email you describe. Nothing is saved.
Body
subjectstringThe current subject, if any.
htmlstringThe HTML body, up to 100,000 characters.
textstringThe plain-text body, up to 100,000 characters.
audiencestringWho the email is for, up to 2,000 characters.
1 more field (template_id)
template_idstringOne of the team's templates, recorded as what the request was about. The content still comes from this body.
Request
curl -X POST "https://api.rasket.com/ai/subject-lines" \
-H "Authorization: Bearer $RASKET_API_KEY" \
-H "User-Agent: acme-billing/1.0" \
-H "Content-Type: application/json" \
-d '{
"subject": "Our November update",
"text": "Three new features and a price freeze.",
"audience": "Customers on the Pro plan"
}'const response = await fetch("https://api.rasket.com/ai/subject-lines", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RASKET_API_KEY}`,
"User-Agent": "acme-billing/1.0",
"Content-Type": "application/json",
},
body: JSON.stringify({
subject: "Our November update",
text: "Three new features and a price freeze.",
audience: "Customers on the Pro plan"
}),
});
const data = await response.json();import os
import requests
response = requests.post(
"https://api.rasket.com/ai/subject-lines",
headers={
"Authorization": f"Bearer {os.environ['RASKET_API_KEY']}",
"User-Agent": "acme-billing/1.0",
},
json={
"subject": "Our November update",
"text": "Three new features and a price freeze.",
"audience": "Customers on the Pro plan"
},
)
print(response.json())Response 200
{
"object": "ai_subject_suggestions",
"suggestions": ["Three new features, and your price stays put", "November: what's new on your Pro plan"],
"credits_remaining": 87,
"credits": {
"limit": 100,
"used": 13,
"remaining": 87
}
}- Refused in this order: AI assist not configured for the account is
503 service_unavailableand costs nothing, AI assist off for the team is403 invalid_permission, the month's credits spent is422 validation_error, and more than 10 AI requests a minute is429 rate_limit_exceeded. - An accepted request spends one credit.