Was du brauchst

Bevor du Anfragen sendest, brauchst du:

  1. Einen Ocoya API-Schlüssel
  2. Eine Brand-ID
  3. Social-Profile-IDs, wenn du Posts erstellen oder planen möchtest

API-Schlüssel erhalten

Erstelle oder kopiere einen API-Schlüssel in deinen Ocoya API-Einstellungen.

Create API key

API-Schlüssel sind für die Nutzung auf dem Server bestimmt. Setze sie nicht in JavaScript im Browser, mobilen Apps oder öffentlichen Repositories ein.

Base URL

Alle REST API-Beispiele verwenden:

https://www.app.ocoya.com/api/_public/v1

Deine erste Anfrage senden

Am schnellsten prüfst du deinen API-Schlüssel, indem du /me aufrufst.

curl -X GET "https://www.app.ocoya.com/api/_public/v1/me" \
  -H "X-API-Key: YOUR_API_KEY"

Wenn der Schlüssel gültig ist, gibt die API deinen User-Kontext zurück.

{
  "id": "clx354swx0006ghoatnjknv98",
  "name": "Ocoya Support",
  "email": "support@ocoya.com"
}

Typischer Publishing-Flow

1

Brands auflisten

Rufe GET /brands auf und wähle die Brand, von der du posten möchtest.

2

Social-Profile verbinden

Wenn die Brand noch keine verbundenen Profile hat, rufe POST /social-profiles/connection-url auf und öffne die zurückgegebene url in einem Browser.

3

Social-Profile auflisten

Rufe GET /social-profiles?brandId=BRAND_ID auf, um verbundene Profil-IDs zu finden.

4

Optionalen Kontext auflösen

Rufe GET /hashtag-libraries?brandId=BRAND_ID auf, wenn ein AI-Entwurf gespeicherten Hashtag-Kontext verwenden soll.

5

Einen Entwurf oder geplanten Post erstellen

Rufe POST /post?brandId=BRAND_ID mit Caption, Media-URLs, Ziel-Social-Profile-IDs und optionalem scheduledAt auf.

6

Einen AI-Entwurf erstellen

Rufe POST /post/ai?brandId=BRAND_ID mit einem Prompt auf, wenn Ocoya zuerst die Caption generieren soll.

7

Eine AI-Kampagne erstellen

Rufe POST /campaigns?brandId=BRAND_ID auf, um die Generierung einer Multi-Post-Kampagne zu starten und eine sofortige GENERATING-Antwort zu erhalten.

8

Posts verwalten

Verwende GET /post, PATCH /post/{postId} und DELETE /post/{postId}, um Posts zu prüfen, neu zu planen oder zu entfernen.

Einen Post erstellen

Verwende scheduledAt, wenn du einen geplanten Post möchtest. Lass es weg, wenn du einen Entwurf möchtest.

curl -X POST "https://www.app.ocoya.com/api/_public/v1/post?brandId=BRAND_ID" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "caption": "Launching our summer campaign today.",
    "mediaUrls": ["https://example.com/image.jpg"],
    "socialProfileIds": ["SOCIAL_PROFILE_ID"],
    "scheduledAt": "2026-07-01T09:00:00Z"
  }'

Ein Social-Profil verbinden

Verwende POST /social-profiles/connection-url, wenn du eine Browser-URL brauchst, um ein neues Social-Profil zu verbinden.

curl -X POST "https://www.app.ocoya.com/api/_public/v1/social-profiles/connection-url?brandId=BRAND_ID" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"provider":"instagram"}'

Öffne die zurückgegebene url, während du bei Ocoya eingeloggt bist.

Einen AI-Entwurf erstellen

Verwende POST /post/ai, wenn Ocoya die Caption aus einem Prompt generieren soll, bevor der Entwurf angelegt wird.

Verwende hashtagLibraryId und referenceDesignIds, wenn der Entwurf eine gespeicherte Hashtag-Library oder Studio-Template-Kontext verwenden soll.

curl -X POST "https://www.app.ocoya.com/api/_public/v1/post/ai?brandId=BRAND_ID" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Write a friendly launch post for our new analytics dashboard.",
    "tone": "friendly",
    "postLength": "medium",
    "socialProfileIds": ["SOCIAL_PROFILE_ID"],
    "hashtagLibraryId": "HASHTAG_LIBRARY_ID",
    "generateImage": true,
    "referenceUrls": ["https://example.com/reference.png"],
    "referenceDesignIds": ["STUDIO_DESIGN_ID"]
  }'

Eine AI-Kampagne erstellen

Verwende POST /campaigns, wenn Ocoya im Hintergrund eine Multi-Post-Kampagne generieren soll.

Die Antwort kommt sofort mit Status GENERATING. Verwende hashtagLibraryId, wenn die Kampagne eine gespeicherte Hashtag-Library nutzen soll.

curl -X POST "https://www.app.ocoya.com/api/_public/v1/campaigns?brandId=BRAND_ID" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Summer launch campaign for our ecommerce analytics dashboard, aimed at marketing teams already using spreadsheets. Confident, practical tone.",
    "goal": "launch",
    "duration": 10,
    "count": 6,
    "postLength": "medium",
    "hashtagLibraryId": "HASHTAG_LIBRARY_ID",
    "socialProfileIds": ["SOCIAL_PROFILE_ID"],
    "generateMedia": true
  }'

MCP vs REST API

Verwende die REST API für Backend-Systeme, die bereits genau wissen, was sie tun sollen.

Verwende MCP, wenn du möchtest, dass AI-Clients wie Claude, Codex oder ChatGPT Ocoya-Tools entdecken und aufrufen, nachdem der User den OAuth-Zugriff freigegeben hat.