Documentation Generator

Description

This API endpoint allows authenticated users to interact with an Assistant that can creates a Documentation of for a given App Name/Description. Users must provide an API key and a message to receive AI-generated Documentation responses.

Endpoint

POST /wp-json/apicloud/v1/api_services/openai_assistant/documentation-generator

You need to be logged in to view your API key.

Headers

Header NameValueDescription
Authorization

You need to be logged in to view your API key.

Your API Key

Request Parameters

Parameter NameTypeRequiredDescription
message_contentstring✅ YesThe Documentation or Description of the App

Example Request (cURL)

curl -X POST "/wp-json/apicloud/v1/api_services/openai_assistant/documentation-generator" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
         "message_content": "App Documentation"
     }'

Example Successful Response

{
    "thread_id": "thread_aYv6lwxKFvnqN2M9KeRGFM96",
    "run_status": "completed",
    "assistant_reply": "App Documentation",
    "usage_log": {
        "success": true,
        "message": "AI service usage deducted successfully!",
        "service_id": XXX,
        "api_service_info": "Documentation Generator",
        "deducted_points": 1,
        "remaining_balance": 1234567
    }
}

How It Works

  1. Authentication:
    • The request must include a valid API key in the Authorization header.
  2. Processing the Request:
    • Creates a new thread for structured conversation.
    • Sends the user message to the specified Assistant.
    • Runs the Assistant and waits for completion (polling every 2 seconds).
    • Retrieves the Assistant’s response.

Error Responses

HTTP CodeError MessageDescription
401Missing API KeyThe request does not include an API key.
401Invalid API KeyThe API key provided does not match any user.
500Thread creation failedUnable to create a new thread.
500Run failedThe Assistant run did not complete successfully.

Additional Notes

  • API usage is logged, and points are deducted from the user’s balance.