Zum Inhalt springen

API-Schnellstart

Die ANKK Public API ist eine RESTful API, die die programmatische Verwaltung Ihrer kanalübergreifenden Social-Media-Aktivitäten mit einem einzelnen markenbezogenen API-Schlüssel (spk_...) ermöglicht.


  • Basis-URL: https://api.ankk.app
  • Swagger / Interaktive Dokumentation: https://api.ankk.app/v1/docs
  • OpenAPI JSON-Spezifikation: https://api.ankk.app/v1/openapi.json

Health-Check-Endpunkte erfordern keine Authentifizierungs-Header.

Terminal-Fenster
curl https://api.ankk.app/v1/health
{
"service": "api-public",
"status": "ok"
}

Navigieren Sie in der Web-App (https://app.ankk.app) zu Brand-Einstellungen → API-Keys, um einen Key zu generieren, und exportieren Sie ihn dann:

Terminal-Fenster
export ANKK_API_KEY='spk_live_xxxxxxxxxxxxxxxx'

Überprüfen Sie Ihren Brand-Status und listen Sie verbundene SNS-Konten auf, um Ziel-connection_ids zu erhalten.

Terminal-Fenster
# 1. Inspect brand details
curl https://api.ankk.app/v1/brand \
-H "Authorization: Bearer $ANKK_API_KEY"
# 2. List connected SNS accounts
curl https://api.ankk.app/v1/brand/connections \
-H "Authorization: Bearer $ANKK_API_KEY"
const API_KEY = process.env.ANKK_API_KEY!;
const BASE_URL = 'https://api.ankk.app/v1';
const res = await fetch(`${BASE_URL}/brand/connections`, {
headers: {
'Authorization': `Bearer ${API_KEY}`,
},
});
const { items: connections } = await res.json();
console.log('Connected accounts:', connections);
const targetConnectionId = connections[0]?.id;
import os
import requests
API_KEY = os.environ['ANKK_API_KEY']
BASE_URL = 'https://api.ankk.app/v1'
headers = {'Authorization': f'Bearer {API_KEY}'}
response = requests.get(f'{BASE_URL}/brand/connections', headers=headers)
connections = response.json().get('items', [])
print(f'Connected accounts: {connections}')
target_connection_id = connections[0]['id']

Übermitteln Sie eine Veröffentlichungsanfrage mit einem clientseitig generierten idempotency_key, um doppelte Ausführungen zu vermeiden.

Terminal-Fenster
curl -X POST "https://api.ankk.app/v1/brand/contents" \
-H "Authorization: Bearer $ANKK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"connection_id": "conn_01jm8x9k2example",
"idempotency_key": "my-first-post-001",
"text": "Hello World from ANKK Public API! 🚀"
}'
const publishRes = await fetch(`${BASE_URL}/brand/contents`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
connection_id: targetConnectionId,
idempotency_key: `post-${Date.now()}`,
text: 'Hello World from TypeScript! 🚀',
}),
});
const result = await publishRes.json();
console.log('Publish accepted (HTTP 202):', result);
import time
payload = {
'connection_id': target_connection_id,
'idempotency_key': f'post-{int(time.time())}',
'text': 'Hello World from Python! 🚀',
}
publish_res = requests.post(
f'{BASE_URL}/brand/contents',
headers={**headers, 'Content-Type': 'application/json'},
json=payload,
)
print('Publish outcome:', publish_res.json())

Eine erfolgreiche Anfrage gibt HTTP 202 Accepted und eine content_id zurück. Überprüfen Sie den Zustellungsstatus über:

Terminal-Fenster
curl https://api.ankk.app/v1/brand/contents/<content_id> \
-H "Authorization: Bearer $ANKK_API_KEY"