{
    "documentation_version": 1,
    "base_url": "https://c7dev.com",
    "instructions_url": "https://c7dev.com/api_instructions",
    "selection": {
        "method": "GET",
        "parameter": "api",
        "required": false,
        "description": "Omit api for the full suite, or use an endpoint name for its instructions only.",
        "example_url": "https://c7dev.com/api_instructions?api=media_api"
    },
    "instructions": [
        "Choose an endpoint by its description, then use its documented HTTP method and parameter location.",
        "URL-encode GET query values. Preserve identifiers such as VAT numbers and registration codes as strings.",
        "For JSON APIs, require HTTP success and result=true before using returned data. Read error_message on failure.",
        "Do not fabricate missing data or treat null as zero or false. Warnings may indicate incomplete or older data.",
        "Do not blindly retry invalid input or access errors. Temporary service failures may be retried with bounded backoff.",
        "Responses prohibit browser caching. Inspect cached, timestamps and X-API-Version when those fields are available."
    ],
    "authentication": {
        "documentation": "Public; no token is required to read these instructions.",
        "restricted_endpoints": "Supply credentials provided by the API operator when access control requires them.",
        "token_locations": [
            "Authorization: Bearer YOUR_ACCESS_TOKEN",
            "X-Access-Token: YOUR_ACCESS_TOKEN",
            "access_token query or form parameter"
        ],
        "domain": "Send domain as a query or form parameter when the client token is restricted to registered domains. Access may also be restricted by IP.",
        "ai_generate": "Requires both access_token and domain in the form body."
    },
    "json_response_envelope": {
        "result": "boolean; request succeeded",
        "error": "boolean; request failed",
        "error_message": "string; empty on success",
        "server_time": "integer; Unix timestamp in seconds"
    },
    "errors": {
        "400": "Missing or invalid input.",
        "403": "Access denied; check token, registered domain and IP permissions.",
        "404": "Unknown API selected for instructions.",
        "405": "Unsupported method for the instructions endpoint.",
        "500": "Processing failed.",
        "503": "Service temporarily unavailable."
    },
    "apis": [
        {
            "name": "ai_generate",
            "method": "POST",
            "path": "/ai_generate",
            "description": "Authenticated translation, structured text generation, multi-turn chat generation and document reading endpoint.",
            "instructions_url": "https://c7dev.com/api_instructions?api=ai_generate",
            "request": {
                "parameter_location": "form_body",
                "parameters": {
                    "access_token": {
                        "type": "string",
                        "required": true,
                        "description": "Client token supplied by the API operator; required in the form body for this endpoint."
                    },
                    "domain": {
                        "type": "string",
                        "required": true,
                        "description": "Domain registered for the client token."
                    },
                    "action": {
                        "type": "string",
                        "required": true,
                        "description": "Requested operation.",
                        "enum": [
                            "translation",
                            "ai_translation",
                            "text_generation",
                            "chat_generation",
                            "document_generation"
                        ]
                    },
                    "complexity": {
                        "type": "string",
                        "required": false,
                        "description": "Generation complexity.",
                        "default": "simple",
                        "enum": [
                            "simple",
                            "advanced"
                        ]
                    },
                    "prompt": {
                        "type": "string",
                        "required": false,
                        "description": "Prompt for text_generation or document_generation."
                    },
                    "turns": {
                        "type": "array",
                        "required": false,
                        "description": "Conversation turns for chat_generation; send turns[0][role] and turns[0][text], then subsequent indexes.",
                        "items": {
                            "role": {
                                "enum": [
                                    "user",
                                    "model"
                                ]
                            },
                            "text": {
                                "type": "string"
                            }
                        }
                    },
                    "translate_values": {
                        "type": "array",
                        "required": false,
                        "description": "Key/value pairs for translation or ai_translation; send translate_values[title], translate_values[description], etc."
                    },
                    "translate_to": {
                        "type": "array",
                        "required": false,
                        "description": "Target language codes for translation; send as translate_to[]."
                    },
                    "file": {
                        "type": "file",
                        "required": false,
                        "description": "Required multipart upload for document_generation: PDF, JPEG, PNG or WEBP."
                    },
                    "response_schema": {
                        "type": "string",
                        "required": false,
                        "description": "Optional JSON-encoded response schema for document_generation."
                    }
                },
                "content_types": [
                    "application/x-www-form-urlencoded",
                    "multipart/form-data"
                ],
                "required_by_action": {
                    "translation": [
                        "translate_values",
                        "translate_to"
                    ],
                    "ai_translation": [
                        "translate_values",
                        "translate_to"
                    ],
                    "text_generation": [
                        "prompt"
                    ],
                    "chat_generation": [
                        "turns"
                    ],
                    "document_generation": [
                        "prompt",
                        "file"
                    ]
                }
            },
            "response": {
                "format": "application/json",
                "response_fields": [
                    "response",
                    "api_http_code"
                ],
                "headers": {
                    "X-API-Version": "ai_generate_v1"
                }
            },
            "details": {
                "Actions": "translation, ai_translation, text_generation, chat_generation, document_generation",
                "Complexity": "simple (default) or advanced",
                "Translation payload": "translate_values plus translate_to[]",
                "Generation payload": "prompt for text_generation; turns[] for chat_generation",
                "Document payload": "prompt plus an uploaded file; optional response_schema as a JSON string. PDF, JPEG, PNG and WEBP uploads use multipart/form-data",
                "Returns": "response plus API HTTP status metadata"
            },
            "notes": [
                "Use application/x-www-form-urlencoded for ordinary actions and multipart/form-data for document uploads.",
                "Pass action-specific fields in the body. A raw application/json body is not parsed as form input.",
                "A bearer header does not replace this endpoint's required access_token form field."
            ],
            "examples": [
                {
                    "method": "POST",
                    "url": "https://c7dev.com/ai_generate",
                    "body": {
                        "access_token": "YOUR_ACCESS_TOKEN",
                        "domain": "YOUR_REGISTERED_DOMAIN",
                        "action": "text_generation",
                        "prompt": "Return a JSON object with a short product description.",
                        "complexity": "simple"
                    }
                }
            ]
        }
    ],
    "result": true,
    "error": false,
    "error_message": "",
    "server_time": 1791673221
}