Generate an article
curl --request POST \
--url https://api.thealmanac.ai/api/v1/articles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"linkedin_id": "jane-doe"
}
'import requests
url = "https://api.thealmanac.ai/api/v1/articles"
payload = { "linkedin_id": "jane-doe" }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({linkedin_id: 'jane-doe'})
};
fetch('https://api.thealmanac.ai/api/v1/articles', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.thealmanac.ai/api/v1/articles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'linkedin_id' => 'jane-doe'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.thealmanac.ai/api/v1/articles"
payload := strings.NewReader("{\n \"linkedin_id\": \"jane-doe\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.thealmanac.ai/api/v1/articles")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"linkedin_id\": \"jane-doe\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.thealmanac.ai/api/v1/articles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"linkedin_id\": \"jane-doe\"\n}"
response = http.request(request)
puts response.read_body{
"article": {
"article_id": "<string>",
"title": "<string>",
"content": "<string>",
"sources": [
{
"id": 123,
"title": "<string>",
"url": "<string>",
"publication": "<string>",
"excerpt": "<string>"
}
],
"infobox": {},
"current_version": 1,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"credits_charged": 1
}{
"job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"linkedin_id": "jane-doe",
"status": "queued",
"credits_charged": 100,
"article": {
"article_id": "<string>",
"title": "<string>",
"content": "<string>",
"sources": [
{
"id": 123,
"title": "<string>",
"url": "<string>",
"publication": "<string>",
"excerpt": "<string>"
}
],
"infobox": {},
"current_version": 1,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"error": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}API reference
Generate an article
If an article already exists, returns it for 1 credit (200). Otherwise reserves 100 credits and starts generation (202). Poll the job for the included result. Failed or cancelled jobs are refunded. Replays of the same idempotency key return the original operation without another charge.
POST
/
api
/
v1
/
articles
Generate an article
curl --request POST \
--url https://api.thealmanac.ai/api/v1/articles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"linkedin_id": "jane-doe"
}
'import requests
url = "https://api.thealmanac.ai/api/v1/articles"
payload = { "linkedin_id": "jane-doe" }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({linkedin_id: 'jane-doe'})
};
fetch('https://api.thealmanac.ai/api/v1/articles', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.thealmanac.ai/api/v1/articles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'linkedin_id' => 'jane-doe'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.thealmanac.ai/api/v1/articles"
payload := strings.NewReader("{\n \"linkedin_id\": \"jane-doe\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.thealmanac.ai/api/v1/articles")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"linkedin_id\": \"jane-doe\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.thealmanac.ai/api/v1/articles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"linkedin_id\": \"jane-doe\"\n}"
response = http.request(request)
puts response.read_body{
"article": {
"article_id": "<string>",
"title": "<string>",
"content": "<string>",
"sources": [
{
"id": 123,
"title": "<string>",
"url": "<string>",
"publication": "<string>",
"excerpt": "<string>"
}
],
"infobox": {},
"current_version": 1,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"credits_charged": 1
}{
"job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"linkedin_id": "jane-doe",
"status": "queued",
"credits_charged": 100,
"article": {
"article_id": "<string>",
"title": "<string>",
"content": "<string>",
"sources": [
{
"id": 123,
"title": "<string>",
"url": "<string>",
"publication": "<string>",
"excerpt": "<string>"
}
],
"infobox": {},
"current_version": 1,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"error": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Authorizations
Your customer API key (alm_…). Keep it on your server.
Headers
A unique value for this operation. Reuse it when retrying the same request to avoid duplicate charges.
Required string length:
1 - 200Body
application/json
Required string length:
1 - 200Example:
"jane-doe"