Authentication Header
All API requests must include your API key in thex-api-key header.
x-api-key: your_api_key_here
Example Request
curl -X POST "https://apolloai.lol/v1/generation/prompt" \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Hello world"
}'
import requests
url = "https://apolloai.lol/v1/generation/prompt"
headers = {
"x-api-key": "your_api_key_here",
"Content-Type": "application/json"
}
data = {
"prompt": "Hello world"
}
response = requests.post(url, headers=headers, json=data)
print(response.text)
const url = "https://apolloai.lol/v1/generation/prompt";
const headers = {
"x-api-key": "your_api_key_here",
"Content-Type": "application/json"
};
const body = JSON.stringify({
prompt: "Hello world"
});
fetch(url, { method: "POST", headers, body })
.then(response => response.text())
.then(console.log);
package main
import (
"bytes"
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://apolloai.lol/v1/generation/prompt"
var jsonStr = []byte(`{"prompt":"Hello world"}`)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr))
req.Header.Set("x-api-key", "your_api_key_here")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
public class Main {
public static void main(String[] args) throws Exception {
String url = "https://apolloai.lol/v1/generation/prompt";
String json = "{\"prompt\":\"Hello world\"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("x-api-key", "your_api_key_here")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
client.sendAsync(request, BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(System.out::println)
.join();
}
}
require 'uri'
require 'net/http'
require 'json'
url = URI("https://apolloai.lol/v1/generation/prompt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = "your_api_key_here"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"prompt": "Hello world"
})
response = http.request(request)
puts response.read_body
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://apolloai.lol/v1/generation/prompt");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: your_api_key_here");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "{\"prompt\":\"Hello world\"}";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
return 0;
}
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let res = client.post("https://apolloai.lol/v1/generation/prompt")
.header("x-api-key", "your_api_key_here")
.header("Content-Type", "application/json")
.json(&json!({
"prompt": "Hello world"
}))
.send()
.await?;
let body = res.text().await?;
println!("{}", body);
Ok(())
}
Response Codes
| Status Code | Description |
|---|---|
| 401 | Unauthorized: API key is missing or invalid. |
| 403 | Forbidden: API key is valid but does not have permission for the requested resource (e.g. tier restrictions). |