> ## Documentation Index
> Fetch the complete documentation index at: https://docs.llmide.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Submit diagnosis data

> Submits external diagnosis session data (including input/output, timing, and additional fields) to the backend diagnosis table and generates API call logs



## OpenAPI

````yaml api-reference/openapi.json post /v1/prompts
openapi: 3.1.0
info:
  title: Prompt Management API
  description: >-
    API for managing and retrieving prompt configurations with deployment and
    workspace information
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.llmide.app
    description: Production API server
security:
  - bearerAuth: []
paths:
  /v1/prompts:
    post:
      tags:
        - Diagnosis
      summary: Submit diagnosis data
      description: >-
        Submits external diagnosis session data (including input/output, timing,
        and additional fields) to the backend diagnosis table and generates API
        call logs
      operationId: submitDiagnosisData
      parameters:
        - name: deployId
          in: query
          description: >-
            The target deployment ID. Must belong to the current API key's
            workspace and be in active state
          required: true
          schema:
            type: string
            example: dep_12345
      requestBody:
        required: true
        description: Diagnosis session data to be recorded
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DiagnosisRequest'
      responses:
        '201':
          description: Diagnosis data recorded successfully
          headers:
            X-RateLimit-Limit:
              description: The rate limit ceiling for the workspace
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                The number of requests remaining in the current rate limit
                window
              schema:
                type: integer
            X-RateLimit-Used:
              description: The number of requests used in the current rate limit window
              schema:
                type: integer
            X-RateLimit-Reset:
              description: The time when the rate limit resets (Unix timestamp)
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DiagnosisResponse'
        '400':
          description: >-
            Bad request - missing required fields, invalid deployId, empty
            content, or invalid timestamp format
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - missing, invalid, or expired authorization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found - deploy not found, inactive, or not accessible
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded - monthly quota exhausted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-codeSamples:
        - lang: curl
          source: >-
            curl -X POST
            "https://api.llmide.app/v1/diagnosis?deployId=dep_12345" \
              -H "Authorization: Bearer sk_live_xxx" \
              -H "Content-Type: application/json" \
              -d '{
                "sessionId": "sess_789",
                "status": 0,
                "content": {
                  "input": "Prompt variables: {...}",
                  "output": "LLM reply content"
                },
                "latency": 2450,
                "startAt": 1720780800000,
                "endAt": 1720780802450,
                "additional_properties": {
                  "trace_id": "trc_abc",
                  "token_usage": { "prompt_tokens": 200, "completion_tokens": 150 }
                }
              }'
        - lang: python
          source: |-
            import requests
            import json

            headers = {
                'Authorization': 'Bearer sk_live_xxx',
                'Content-Type': 'application/json'
            }

            params = {
                'deployId': 'dep_12345'
            }

            data = {
                'sessionId': 'sess_789',
                'status': 0,
                'content': {
                    'input': 'Prompt variables: {...}',
                    'output': 'LLM reply content'
                },
                'latency': 2450,
                'startAt': 1720780800000,
                'endAt': 1720780802450,
                'additional_properties': {
                    'trace_id': 'trc_abc',
                    'token_usage': {'prompt_tokens': 200, 'completion_tokens': 150}
                }
            }

            response = requests.post(
                'https://api.llmide.app/v1/diagnosis',
                headers=headers,
                params=params,
                data=json.dumps(data)
            )
            print(response.json())
        - lang: javascript
          source: >-
            const response = await
            fetch('https://api.llmide.app/v1/diagnosis?deployId=dep_12345', {
              method: 'POST',
              headers: {
                'Authorization': 'Bearer sk_live_xxx',
                'Content-Type': 'application/json'
              },
              body: JSON.stringify({
                sessionId: 'sess_789',
                status: 0,
                content: {
                  input: 'Prompt variables: {...}',
                  output: 'LLM reply content'
                },
                latency: 2450,
                startAt: 1720780800000,
                endAt: 1720780802450,
                additional_properties: {
                  trace_id: 'trc_abc',
                  token_usage: { prompt_tokens: 200, completion_tokens: 150 }
                }
              })
            });


            const data = await response.json();

            console.log(data);
components:
  schemas:
    DiagnosisRequest:
      type: object
      required:
        - sessionId
        - status
        - content
      properties:
        sessionId:
          type: string
          description: External diagnosis session identifier
          example: sess_789
        status:
          type: integer
          description: Business-defined status code, stored as integer
          example: 0
        content:
          $ref: '#/components/schemas/DiagnosisContent'
        latency:
          type: number
          description: Call latency in milliseconds
          minimum: 0
          example: 2450
        startAt:
          type: integer
          description: Session start time, UNIX millisecond timestamp, must be non-negative
          minimum: 0
          example: 1720780800000
        endAt:
          type: integer
          description: Session end time, UNIX millisecond timestamp, must be non-negative
          minimum: 0
          example: 1720780802450
        additional_properties:
          type: object
          description: Arbitrary JSON structure for additional information, stored as-is
          example:
            trace_id: trc_abc
            token_usage:
              prompt_tokens: 200
              completion_tokens: 150
          additionalProperties: true
    DiagnosisResponse:
      type: object
      required:
        - id
        - status
        - message
      properties:
        id:
          type: string
          description: Newly created diagnosis record ID
          example: diag_abc123
        status:
          type: string
          description: Fixed value 'success'
          enum:
            - success
          example: success
        message:
          type: string
          description: Success message
          example: Diagnosis data recorded successfully
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Error message
          examples:
            - Missing or invalid deployId parameter
            - Missing or invalid authorization header
            - No API key provided
            - Invalid API key
            - Deploy not found or not accessible
            - Internal server error
    RateLimitErrorResponse:
      type: object
      required:
        - error
        - details
      properties:
        error:
          type: string
          description: Rate limit error message
          example: Rate limit exceeded
        details:
          type: object
          properties:
            limit:
              type: integer
              description: Monthly rate limit
            used:
              type: integer
              description: Requests used this month
            resetTime:
              type: integer
              description: Unix timestamp when the limit resets
            upgradeUrl:
              type: string
              nullable: true
              description: Optional upgrade link
    DiagnosisContent:
      type: object
      description: >-
        Session input/output content. At least one of input or output must be
        provided
      properties:
        input:
          type: string
          description: Session input text
          example: 'Prompt variables: {...}'
        output:
          type: string
          description: Session output text
          example: LLM reply content
      anyOf:
        - required:
            - input
        - required:
            - output
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````