Skip to main content

Overview

The Generated Content API provides access to content generated through Junis AI agents using Replicate models. This includes images, videos, audio files, and 3D models (GLB format).
Content Generation: Content is generated through AI agents that use the replicate_generate tool. This API provides read-only access to view and retry generated content.

Authentication

All endpoints require API key authentication with specific scopes:
EndpointRequired Scope
GET /contentcontent:read
GET /content/{id}content:read
POST /content/{id}/retrycontent:retry
Default Scopes: The content:read and content:retry scopes are not enabled by default when creating API keys. You must explicitly enable these scopes during key creation.
Include your API key in the X-API-Key header:
X-API-Key: jns_live_YOUR_API_KEY_HERE
See Authentication for details.

Content Types

Generated content is categorized into the following types:
TypeDescriptionExample Models
imageStatic images (PNG, JPG, WebP)SDXL, Flux, Stable Diffusion
videoVideo files (MP4, WebM)Runway Gen-3, AnimateDiff
audioAudio files (MP3, WAV)MusicGen, Bark
glb3D models (GLB format)Point-E, Shap-E
otherOther content typesVarious

Content Status

Content goes through the following status lifecycle:
StatusDescription
pendingGeneration request received, waiting to be processed
processingContent is being generated by Replicate
completedGeneration successful, content available
failedGeneration failed (can be retried)

List Content

Retrieve a paginated list of generated content for your organization.

Endpoint

GET https://api.junis.ai/api/external/content

Query Parameters

ParameterTypeRequiredDescription
pageintegerNoPage number (default: 1, min: 1)
page_sizeintegerNoItems per page (default: 20, max: 100)
content_typestringNoFilter by type: image, video, audio, glb, other
statusstringNoFilter by status: pending, processing, completed, failed

Request Example

cURL
curl -X GET "https://api.junis.ai/api/external/content?page=1&page_size=10&status=completed" \
  -H "X-API-Key: jns_live_YOUR_API_KEY_HERE"
Python
import requests

response = requests.get(
    "https://api.junis.ai/api/external/content",
    headers={"X-API-Key": "jns_live_YOUR_API_KEY_HERE"},
    params={
        "page": 1,
        "page_size": 10,
        "status": "completed"
    }
)
print(response.json())

Response

Status Code: 200 OK
{
  "items": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "content_type": "image",
      "status": "completed",
      "prompt": "A serene mountain landscape at sunset",
      "replicate_version": "stability-ai/sdxl",
      "output_url": "https://replicate.delivery/...",
      "storage_url": "https://objectstorage.kr-central-2.kakaocloud.com/...",
      "error_message": null,
      "processing_time_ms": 12500,
      "credit_cost": 0.05,
      "created_at": "2025-12-06T10:30:00Z",
      "completed_at": "2025-12-06T10:30:12Z"
    }
  ],
  "total": 42,
  "page": 1,
  "page_size": 10,
  "has_more": true
}

Response Fields

FieldTypeDescription
itemsarrayList of content items
totalintegerTotal number of items matching the filter
pageintegerCurrent page number
page_sizeintegerNumber of items per page
has_morebooleanWhether more pages are available

Content Item Fields

FieldTypeDescription
idstringUnique content ID (UUID)
content_typestringType of content (image, video, audio, glb, other). null until generation completes.
statusstringCurrent status
promptstringGeneration prompt (may be truncated in list view)
replicate_versionstringReplicate model version used
output_urlstringDirect URL to generated content (Replicate CDN)
storage_urlstringPermanent URL (Kakao Cloud storage)
error_messagestringError description if failed
processing_time_msintegerGeneration time in milliseconds
credit_costnumberCredit cost for this generation (6 decimal places)
created_atstringCreation timestamp (ISO 8601)
completed_atstringCompletion timestamp (ISO 8601)

Get Content Detail

Retrieve detailed information about a specific content item.

Endpoint

GET https://api.junis.ai/api/external/content/{content_id}

Path Parameters

ParameterTypeRequiredDescription
content_idstringYesContent ID (UUID format)

Request Example

cURL
curl -X GET "https://api.junis.ai/api/external/content/550e8400-e29b-41d4-a716-446655440000" \
  -H "X-API-Key: jns_live_YOUR_API_KEY_HERE"

Response

Status Code: 200 OK
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "organization_id": "org-abc123",
  "user_id": "user-xyz789",
  "content_type": "image",
  "status": "completed",
  "prompt": "A serene mountain landscape at sunset with dramatic clouds and golden light reflecting off a calm lake in the foreground",
  "replicate_version": "stability-ai/sdxl",
  "replicate_prediction_id": "xyz123abc456",
  "replicate_input": {
    "prompt": "A serene mountain landscape at sunset...",
    "negative_prompt": "blurry, low quality",
    "width": 1024,
    "height": 1024,
    "num_inference_steps": 50
  },
  "output_url": "https://replicate.delivery/...",
  "storage_path": "generation/image/550e8400_20251206_103000.png",
  "storage_url": "https://objectstorage.kr-central-2.kakaocloud.com/...",
  "error_message": null,
  "retry_count": 0,
  "max_retries": 3,
  "credit_cost": 0.05,
  "processing_time_ms": 12500,
  "created_at": "2025-12-06T10:30:00Z",
  "started_at": "2025-12-06T10:30:01Z",
  "completed_at": "2025-12-06T10:30:12Z"
}

Additional Detail Fields

FieldTypeDescription
organization_idstringOrganization that owns this content
user_idstringUser who initiated the generation
replicate_prediction_idstringReplicate’s internal prediction ID
replicate_inputobjectFull input parameters sent to Replicate
storage_pathstringPath in cloud storage bucket
retry_countintegerNumber of retry attempts made
max_retriesintegerMaximum allowed retries (default: 3)
started_atstringProcessing start timestamp

Retry Failed Content

Retry a failed content generation. This re-queues the generation with the original parameters.

Endpoint

POST https://api.junis.ai/api/external/content/{content_id}/retry

Path Parameters

ParameterTypeRequiredDescription
content_idstringYesContent ID of failed generation (UUID format)

Prerequisites

  • Content must have status failed
  • retry_count must be less than max_retries (default: 3)

Request Example

cURL
curl -X POST "https://api.junis.ai/api/external/content/550e8400-e29b-41d4-a716-446655440000/retry" \
  -H "X-API-Key: jns_live_YOUR_API_KEY_HERE"
Python
import requests

response = requests.post(
    "https://api.junis.ai/api/external/content/550e8400-e29b-41d4-a716-446655440000/retry",
    headers={"X-API-Key": "jns_live_YOUR_API_KEY_HERE"}
)
print(response.json())

Response

Status Code: 200 OK
{
  "success": true,
  "message": "Content generation retry queued (attempt 1/3)",
  "generation_id": "550e8400-e29b-41d4-a716-446655440000"
}

Response Fields

FieldTypeDescription
successbooleanWhether retry was queued successfully
messagestringHuman-readable status message
generation_idstringContent ID being retried

Error Responses

Common Errors

400 Bad Request - Invalid Filter
{
  "detail": "Invalid content_type 'unknown'. Must be one of: ['image', 'video', 'audio', 'glb', 'other']"
}
400 Bad Request - Cannot Retry
{
  "detail": "Cannot retry content with status 'completed'. Only failed content can be retried."
}
400 Bad Request - Max Retries Reached
{
  "detail": "Maximum retry attempts (3) reached for this content."
}
403 Forbidden - Insufficient Scopes
{
  "error": "insufficient_scopes",
  "message": "API key does not have required permissions",
  "required_scopes": ["content:read"],
  "missing_scopes": ["content:read"],
  "available_scopes": ["orchestrator:invoke", "sessions:read"]
}
404 Not Found
{
  "detail": "Content not found: 550e8400-e29b-41d4-a716-446655440000"
}

Best Practices

When content is in pending or processing status, poll the detail endpoint to check for completion:
import time
import requests

def wait_for_content(content_id, api_key, timeout=300, interval=5):
    """Poll until content is completed or failed."""
    start = time.time()
    while time.time() - start < timeout:
        response = requests.get(
            f"https://api.junis.ai/api/external/content/{content_id}",
            headers={"X-API-Key": api_key}
        )
        data = response.json()

        if data["status"] == "completed":
            return data
        elif data["status"] == "failed":
            raise Exception(f"Generation failed: {data.get('error_message')}")

        time.sleep(interval)

    raise TimeoutError("Content generation timed out")
Use content type filters to retrieve specific types of generated content:
# Get only images
curl "https://api.junis.ai/api/external/content?content_type=image"

# Get only videos
curl "https://api.junis.ai/api/external/content?content_type=video"

# Get failed content for monitoring
curl "https://api.junis.ai/api/external/content?status=failed"
Generated content has two URLs:
  • output_url: Replicate’s CDN URL (may expire)
  • storage_url: Permanent Kakao Cloud storage URL
Always prefer storage_url for persistent access to content.
The credit_cost field shows the credit deducted for each generation. Use this for:
  • Billing reconciliation
  • Usage monitoring
  • Cost optimization
Note: Credit costs support 6 decimal places for precision.