---
title: "Log Request"
method: POST
path: "/log-request"
tags: ["request"]
---

# Log Request

`POST /log-request`

## Request body

- LogRequest — Request body for custom logging. Chat message content must be an array of content blocks, not a plain string.
  - `provider` string, required
  - `model` string, required
  - `input` union, required
    - CompletionPrompt
      - `content` union[], required
        - union
          - TextContent
            - `type` 'text'
            - `text` string, required
            - `id` string, nullable
            - `annotations` union[], nullable — Citations and references within the text (web citations, file citations, map citations, container file citations).
              - …
            - `thought_signature` string, nullable
          - ThinkingContent
            - `signature` string, nullable
            - `type` 'thinking'
            - `thinking` string, required
            - `id` string, nullable
          - CodeContent — Code content block (e.g. from code execution tools).
            - `type` 'code'
            - `code` string, required
            - `id` string, nullable
            - `container_id` string, nullable
          - ImageContent
            - `type` 'image_url'
            - `image_url` ImageURL, required
              - …
            - `image_variable` string, nullable
          - MediaContent
            - `type` 'media'
            - `media` Media, required
              - …
          - MediaVariable
            - `type` 'media_variable'
            - `name` string, required — Name of the media variable
          - OutputMediaContent — LLM-generated media output (e.g. from image generation tools).
            - `type` 'output_media'
            - `id` string, nullable
            - `url` string, required
            - `mime_type` string
            - `media_type` 'image' | 'video' | 'audio'
            - `provider_metadata` object, nullable
          - ServerToolUseContent — Server-side tool use block (e.g. web search, code execution).
            - `type` 'server_tool_use'
            - `id` string, required
            - `name` string, required
            - `input` object
          - WebSearchToolResultContent — Results from a web search tool invocation.
            - `type` 'web_search_tool_result'
            - `tool_use_id` string, required
            - `content` WebSearchResult[]
              - …
          - CodeExecutionResultContent — Result from a code execution tool.
            - `type` 'code_execution_result'
            - `output` string, required
            - `outcome` string
          - McpListToolsContent — MCP list tools response block.
            - `type` 'mcp_list_tools'
            - `id` string, nullable
            - `server_label` string
            - `tools` object[]
              - …
            - `error` union
              - …
          - McpCallContent — MCP tool call block.
            - `type` 'mcp_call'
            - `id` string, nullable
            - `name` string
            - `server_label` string
            - `arguments` string
            - `output` string, nullable
            - `error` union
              - …
            - `approval_request_id` string, nullable
          - McpApprovalRequestContent — MCP tool approval request block.
            - `type` 'mcp_approval_request'
            - `id` string, nullable
            - `name` string
            - `arguments` string
            - `server_label` string
          - McpApprovalResponseContent — MCP tool approval response block.
            - `type` 'mcp_approval_response'
            - `approval_request_id` string, required
            - `approve` boolean, required
          - BashCodeExecutionToolResultContent — Result from bash code execution tool.
            - `type` 'bash_code_execution_tool_result'
            - `tool_use_id` string, required
            - `content` object
          - TextEditorCodeExecutionToolResultContent — Result from text editor code execution tool.
            - `type` 'text_editor_code_execution_tool_result'
            - `tool_use_id` string, required
            - `content` object
          - ShellCallContent — Shell tool call block.
            - `type` 'shell_call'
            - `id` string, nullable
            - `call_id` string, nullable
            - `action` object
            - `status` string, nullable
          - ShellCallOutputContent — Shell tool output block.
            - `type` 'shell_call_output'
            - `id` string, nullable
            - `call_id` string, nullable
            - `output` object[]
              - …
            - `status` string, nullable
          - ApplyPatchCallContent — Apply patch tool call block.
            - `type` 'apply_patch_call'
            - `id` string, nullable
            - `call_id` string, nullable
            - `operation` object
            - `status` string, nullable
          - ApplyPatchCallOutputContent — Apply patch tool output block.
            - `type` 'apply_patch_call_output'
            - `id` string, nullable
            - `call_id` string, nullable
            - `output` string, nullable
            - `status` string, nullable
      - `input_variables` string[]
      - `template_format` 'f-string' | 'jinja2'
      - `type` 'completion'
    - ChatPrompt
      - `messages` union[], required
        - union
          - SystemMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], required
              - …
            - `role` 'system'
            - `name` string, nullable
          - UserMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], required
              - …
            - `role` 'user'
            - `name` string, nullable
          - AssistantMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], nullable
              - …
            - `role` 'assistant'
            - `function_call` FunctionCall
              - …
            - `name` string, nullable
            - `tool_calls` ToolCall[], nullable
              - …
          - FunctionMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], nullable
              - …
            - `role` 'function'
            - `name` string, required
          - ToolMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], required
              - …
            - `role` 'tool'
            - `tool_call_id` string, required
            - `name` string, nullable
          - PlaceholderMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], nullable
              - …
            - `raw_request_display_role` string
            - `role` 'placeholder'
            - `name` string, required
          - DeveloperMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], required
              - …
            - `role` 'developer'
            - `name` string, nullable
      - `functions` Function[], nullable
        - `name` string, required
        - `description` string
        - `strict` boolean — Whether to enable strict schema validation for the function parameters.
        - `parameters` object
      - `tools` Tool[], nullable
        - union
          - FunctionTool — A custom function tool definition.
            - `type` 'function'
            - `function` Function, required
              - …
          - BuiltInTool — A provider-native built-in tool (e.g. web search, code interpreter, bash).
            - `id` string, required
            - `name` string, required
            - `description` string, required
            - `provider` string, required
            - `type` 'web_search' | 'file_search' | 'code_interpreter' | 'image_generation' | 'google_maps' | 'url_context' | 'mcp' | 'bash' | 'shell' | 'apply_patch' | 'text_editor', required
            - `config` object, required — Provider-specific tool configuration. Structure varies by provider and tool type.
      - `function_call` union
        - string
        - MessageFunctionCall
          - `name` string, required
      - `tool_choice` union
        - string
        - ChatToolChoice
          - `type` 'function'
          - `function` MessageFunctionCall, required
            - `name` string, required
      - `type` 'chat'
      - `input_variables` string[]
  - `output` union, required
    - CompletionPrompt
      - `content` union[], required
        - union
          - TextContent
            - `type` 'text'
            - `text` string, required
            - `id` string, nullable
            - `annotations` union[], nullable — Citations and references within the text (web citations, file citations, map citations, container file citations).
              - …
            - `thought_signature` string, nullable
          - ThinkingContent
            - `signature` string, nullable
            - `type` 'thinking'
            - `thinking` string, required
            - `id` string, nullable
          - CodeContent — Code content block (e.g. from code execution tools).
            - `type` 'code'
            - `code` string, required
            - `id` string, nullable
            - `container_id` string, nullable
          - ImageContent
            - `type` 'image_url'
            - `image_url` ImageURL, required
              - …
            - `image_variable` string, nullable
          - MediaContent
            - `type` 'media'
            - `media` Media, required
              - …
          - MediaVariable
            - `type` 'media_variable'
            - `name` string, required — Name of the media variable
          - OutputMediaContent — LLM-generated media output (e.g. from image generation tools).
            - `type` 'output_media'
            - `id` string, nullable
            - `url` string, required
            - `mime_type` string
            - `media_type` 'image' | 'video' | 'audio'
            - `provider_metadata` object, nullable
          - ServerToolUseContent — Server-side tool use block (e.g. web search, code execution).
            - `type` 'server_tool_use'
            - `id` string, required
            - `name` string, required
            - `input` object
          - WebSearchToolResultContent — Results from a web search tool invocation.
            - `type` 'web_search_tool_result'
            - `tool_use_id` string, required
            - `content` WebSearchResult[]
              - …
          - CodeExecutionResultContent — Result from a code execution tool.
            - `type` 'code_execution_result'
            - `output` string, required
            - `outcome` string
          - McpListToolsContent — MCP list tools response block.
            - `type` 'mcp_list_tools'
            - `id` string, nullable
            - `server_label` string
            - `tools` object[]
              - …
            - `error` union
              - …
          - McpCallContent — MCP tool call block.
            - `type` 'mcp_call'
            - `id` string, nullable
            - `name` string
            - `server_label` string
            - `arguments` string
            - `output` string, nullable
            - `error` union
              - …
            - `approval_request_id` string, nullable
          - McpApprovalRequestContent — MCP tool approval request block.
            - `type` 'mcp_approval_request'
            - `id` string, nullable
            - `name` string
            - `arguments` string
            - `server_label` string
          - McpApprovalResponseContent — MCP tool approval response block.
            - `type` 'mcp_approval_response'
            - `approval_request_id` string, required
            - `approve` boolean, required
          - BashCodeExecutionToolResultContent — Result from bash code execution tool.
            - `type` 'bash_code_execution_tool_result'
            - `tool_use_id` string, required
            - `content` object
          - TextEditorCodeExecutionToolResultContent — Result from text editor code execution tool.
            - `type` 'text_editor_code_execution_tool_result'
            - `tool_use_id` string, required
            - `content` object
          - ShellCallContent — Shell tool call block.
            - `type` 'shell_call'
            - `id` string, nullable
            - `call_id` string, nullable
            - `action` object
            - `status` string, nullable
          - ShellCallOutputContent — Shell tool output block.
            - `type` 'shell_call_output'
            - `id` string, nullable
            - `call_id` string, nullable
            - `output` object[]
              - …
            - `status` string, nullable
          - ApplyPatchCallContent — Apply patch tool call block.
            - `type` 'apply_patch_call'
            - `id` string, nullable
            - `call_id` string, nullable
            - `operation` object
            - `status` string, nullable
          - ApplyPatchCallOutputContent — Apply patch tool output block.
            - `type` 'apply_patch_call_output'
            - `id` string, nullable
            - `call_id` string, nullable
            - `output` string, nullable
            - `status` string, nullable
      - `input_variables` string[]
      - `template_format` 'f-string' | 'jinja2'
      - `type` 'completion'
    - ChatPrompt
      - `messages` union[], required
        - union
          - SystemMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], required
              - …
            - `role` 'system'
            - `name` string, nullable
          - UserMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], required
              - …
            - `role` 'user'
            - `name` string, nullable
          - AssistantMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], nullable
              - …
            - `role` 'assistant'
            - `function_call` FunctionCall
              - …
            - `name` string, nullable
            - `tool_calls` ToolCall[], nullable
              - …
          - FunctionMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], nullable
              - …
            - `role` 'function'
            - `name` string, required
          - ToolMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], required
              - …
            - `role` 'tool'
            - `tool_call_id` string, required
            - `name` string, nullable
          - PlaceholderMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], nullable
              - …
            - `raw_request_display_role` string
            - `role` 'placeholder'
            - `name` string, required
          - DeveloperMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], required
              - …
            - `role` 'developer'
            - `name` string, nullable
      - `functions` Function[], nullable
        - `name` string, required
        - `description` string
        - `strict` boolean — Whether to enable strict schema validation for the function parameters.
        - `parameters` object
      - `tools` Tool[], nullable
        - union
          - FunctionTool — A custom function tool definition.
            - `type` 'function'
            - `function` Function, required
              - …
          - BuiltInTool — A provider-native built-in tool (e.g. web search, code interpreter, bash).
            - `id` string, required
            - `name` string, required
            - `description` string, required
            - `provider` string, required
            - `type` 'web_search' | 'file_search' | 'code_interpreter' | 'image_generation' | 'google_maps' | 'url_context' | 'mcp' | 'bash' | 'shell' | 'apply_patch' | 'text_editor', required
            - `config` object, required — Provider-specific tool configuration. Structure varies by provider and tool type.
      - `function_call` union
        - string
        - MessageFunctionCall
          - `name` string, required
      - `tool_choice` union
        - string
        - ChatToolChoice
          - `type` 'function'
          - `function` MessageFunctionCall, required
            - `name` string, required
      - `type` 'chat'
      - `input_variables` string[]
  - `request_start_time` string, date-time, required
  - `request_end_time` string, date-time, required
  - `parameters` object — Model parameters including temperature, max_tokens, etc. Can also include structured output configuration via response_format.json_schema. See documentation for structured output examples.
  - `tags` string[]
  - `metadata` object — Custom key-value pairs for tracking additional request information. Keys are limited to 1024 characters.
  - `prompt_name` string, nullable
  - `prompt_id` integer, nullable — The ID of the prompt template used for this request. This is useful for tracking which prompt was used in the request.
  - `prompt_version_number` integer, nullable
  - `prompt_input_variables` object
  - `input_tokens` integer
  - `output_tokens` integer
  - `price` number
  - `function_name` string
  - `score` integer
  - `api_type` string, nullable
  - `status` 'SUCCESS' | 'WARNING' | 'ERROR' — Request status. | Value | Description | |-------|-------------| | `SUCCESS` | Request completed successfully (default) | | `WARNING` | Request succeeded but had issues (e.g., retries, degraded response) | | `ERROR` | Request failed |
  - `error_type` 'PROVIDER_TIMEOUT' | 'PROVIDER_QUOTA_LIMIT' | 'PROVIDER_RATE_LIMIT' | 'PROVIDER_PARTIAL_RESPONSE' | 'PROVIDER_AUTH_ERROR' | 'PROVIDER_ERROR' | 'TEMPLATE_RENDER_ERROR' | 'VARIABLE_MISSING_OR_EMPTY' | 'UNKNOWN_ERROR', nullable — Categorized error type. | Value | Description | Allowed Statuses | |-------|-------------|------------------| | `PROVIDER_RATE_LIMIT` | Rate limit hit on provider API | WARNING, ERROR | | `PROVIDER_QUOTA_LIMIT` | Account quota or spending limit exceeded | WARNING, ERROR | | `PROVIDER_PARTIAL_RESPONSE` | Provider returned a successful response, but the saved output may be incomplete, filtered, blocked, malformed, or otherwise partial | WARNING | | `VARIABLE_MISSING_OR_EMPTY` | Required template variable was missing or empty | WARNING | | `PROVIDER_TIMEOUT` | Request timed out | ERROR | | `PROVIDER_AUTH_ERROR` | Authentication failed with provider | ERROR | | `PROVIDER_ERROR` | General provider-side error | ERROR | | `TEMPLATE_RENDER_ERROR` | Failed to render prompt template | ERROR | | `UNKNOWN_ERROR` | Uncategorized error | WARNING, ERROR |
  - `error_message` string, nullable — Detailed error message describing what went wrong. Maximum 1024 characters.

## Response `201`

Successful Response

- LogRequestResponse
  - `id` integer, required
  - `prompt_version` PromptVersion, required
    - `prompt_template` union, required — The prompt content, either chat or completion.
      - CompletionPrompt
        - `content` union[], required
          - union
            - TextContent
              - …
            - ThinkingContent
              - …
            - CodeContent — Code content block (e.g. from code execution tools).
              - …
            - ImageContent
              - …
            - MediaContent
              - …
            - MediaVariable
              - …
            - OutputMediaContent — LLM-generated media output (e.g. from image generation tools).
              - …
            - ServerToolUseContent — Server-side tool use block (e.g. web search, code execution).
              - …
            - WebSearchToolResultContent — Results from a web search tool invocation.
              - …
            - CodeExecutionResultContent — Result from a code execution tool.
              - …
            - McpListToolsContent — MCP list tools response block.
              - …
            - McpCallContent — MCP tool call block.
              - …
            - McpApprovalRequestContent — MCP tool approval request block.
              - …
            - McpApprovalResponseContent — MCP tool approval response block.
              - …
            - BashCodeExecutionToolResultContent — Result from bash code execution tool.
              - …
            - TextEditorCodeExecutionToolResultContent — Result from text editor code execution tool.
              - …
            - ShellCallContent — Shell tool call block.
              - …
            - ShellCallOutputContent — Shell tool output block.
              - …
            - ApplyPatchCallContent — Apply patch tool call block.
              - …
            - ApplyPatchCallOutputContent — Apply patch tool output block.
              - …
        - `input_variables` string[]
        - `template_format` 'f-string' | 'jinja2'
        - `type` 'completion'
      - ChatPrompt
        - `messages` union[], required
          - union
            - SystemMessage
              - …
            - UserMessage
              - …
            - AssistantMessage
              - …
            - FunctionMessage
              - …
            - ToolMessage
              - …
            - PlaceholderMessage
              - …
            - DeveloperMessage
              - …
        - `functions` Function[], nullable
          - `name` string, required
          - `description` string
          - `strict` boolean — Whether to enable strict schema validation for the function parameters.
          - `parameters` object
        - `tools` Tool[], nullable
          - union
            - FunctionTool — A custom function tool definition.
              - …
            - BuiltInTool — A provider-native built-in tool (e.g. web search, code interpreter, bash).
              - …
        - `function_call` union
          - string
          - MessageFunctionCall
            - `name` string, required
        - `tool_choice` union
          - string
          - ChatToolChoice
            - `type` 'function'
            - `function` MessageFunctionCall, required
              - …
        - `type` 'chat'
        - `input_variables` string[]
    - `commit_message` string, nullable — Message describing the changes in this version. Maximum 72 characters.
    - `metadata` Metadata — Metadata associated with the prompt blueprint. Supports additional custom fields beyond the model field.
      - `model` Model
        - `provider` string, required — The LLM provider (e.g. openai, anthropic, google, openai.azure, vertexai, mistral, cohere, amazon.bedrock, huggingface).
        - `model_config_display_name` string, nullable — Optional display name for the model configuration.
        - `base_model` string, nullable — The base model name (e.g. for fine-tuned models).
        - `name` string, required — The model name (e.g. gpt-4o, claude-sonnet-4-20250514).
        - `parameters` object — Model parameters (e.g. temperature, max_tokens, top_p).
        - `display_params` object — Display-friendly parameter values shown in the UI.
        - `api_type` string, nullable — The API type (e.g. chat.completions, responses, images). Used to select the correct API endpoint for the provider.
  - `status` 'SUCCESS' | 'WARNING' | 'ERROR' — Request status indicating success, warning, or error.
  - `error_type` string, nullable — Categorized error type if status is WARNING or ERROR.
  - `error_message` string, nullable — Detailed error message if status is WARNING or ERROR.

## Other responses

- `400` — Bad Request
- `401` — Unauthorized - missing or invalid API key.
- `404` — Not found - requested resource does not exist or is not accessible.
- `422` — Validation error - request parameters or body are invalid.

---

[API](https://skmtc.dev/promptlayer/apis/promptlayer-api.md) · [All operations](https://skmtc.dev/promptlayer/apis/promptlayer-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/promptlayer/promptlayer-api/revisions/a23093a0a506/schema)
