{
  "openapi": "3.0.0",
  "info": { "version": "1.0.0", "title": "Langtail prompt endpoint" },
  "components": { "schemas": {}, "parameters": {} },
  "paths": {
    "/v2/threads": {
      "get": {
        "description": "Get a list of threads within your project.",
        "servers": [{ "url": "https://api.langtail.com" }],
        "parameters": [
          {
            "schema": { "type": "string", "example": "<LANGTAIL_API_KEY>" },
            "required": true,
            "description": "Your Langtail API Key",
            "name": "X-API-Key",
            "in": "header"
          },
          {
            "schema": {
              "type": "number",
              "nullable": true
            },
            "name": "limit",
            "in": "query",
            "description": "The maximum number of threads to return. Default is 100."
          },
          {
            "schema": {
              "type": "string",
              "nullable": true
            },
            "name": "after",
            "in": "query",
            "description": "A cursor for use in pagination. 'after' is a thread ID that defines your place in the list. For instance, if you make a list request and receive 100 threads, ending with thread 'xyz', your subsequent call can include after='xyz' in order to fetch the next page of the list. Pagination works the same as in the OpenAI API https://platform.openai.com/docs/api-reference/assistants/listAssistants."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": ["list"]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "The unique identifier for the thread."
                          },
                          "createdAt": {
                            "type": "integer",
                            "description": "The Unix timestamp (in seconds) of when the thread was created."
                          },
                          "projectId": {
                            "type": "string",
                            "description": "The ID of the project this thread belongs to."
                          },
                          "createLog": {
                            "type": "object",
                            "description": "A log created by the first message that creates the thread.",
                            "nullable": true,
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "The unique identifier for the log."
                              },
                              "url": {
                                "type": "string",
                                "description": "The URL of the request."
                              },
                              "stream": {
                                "type": "boolean",
                                "description": "Indicates if the request was streamed."
                              },
                              "metadata": {
                                "type": "string",
                                "description": "Additional metadata associated with the log."
                              },
                              "promptId": {
                                "type": "string",
                                "description": "The ID of the prompt used."
                              },
                              "threadId": {
                                "type": "string",
                                "nullable": true,
                                "description": "The ID of the associated thread, if any."
                              },
                              "assistant": {
                                "type": "boolean",
                                "description": "Indicates if an assistant was used."
                              },
                              "projectId": {
                                "type": "string",
                                "description": "The ID of the project."
                              },
                              "requestIP": {
                                "type": "string",
                                "description": "The IP address of the request."
                              },
                              "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "description": "The timestamp when the request started."
                              },
                              "variables": {
                                "type": "string",
                                "description": "Variables used in the request."
                              },
                              "parameters": {
                                "type": "string",
                                "description": "Parameters used in the request."
                              },
                              "promptSlug": {
                                "type": "string",
                                "description": "The slug of the prompt used."
                              },
                              "doNotRecord": {
                                "type": "boolean",
                                "description": "Indicates if the request should not be recorded."
                              },
                              "environment": {
                                "type": "string",
                                "description": "The environment in which the request was made."
                              },
                              "openAIKeyId": {
                                "type": "string",
                                "description": "The ID of the OpenAI key used."
                              },
                              "projectSlug": {
                                "type": "string",
                                "description": "The slug of the project."
                              },
                              "requestData": {
                                "type": "string",
                                "description": "Data associated with the request."
                              },
                              "deploymentId": {
                                "type": "string",
                                "description": "The ID of the deployment."
                              },
                              "organizationId": {
                                "type": "string",
                                "description": "The ID of the organization."
                              },
                              "projectAPIKeyId": {
                                "type": "string",
                                "description": "The ID of the project API key."
                              },
                              "organizationSlug": {
                                "type": "string",
                                "description": "The slug of the organization."
                              },
                              "deploymentVersion": {
                                "type": "string",
                                "nullable": true,
                                "description": "The version of the deployment, if applicable."
                              },
                              "promptHistoryHash": {
                                "type": "string",
                                "description": "A hash of the prompt history."
                              },
                              "openAIOrganization": {
                                "type": "string",
                                "nullable": true,
                                "description": "The OpenAI organization, if applicable."
                              }
                            }
                          },
                          "metadata": {
                            "type": "object",
                            "description": "A set of key-value pairs that can be attached to the thread. This can be used to store additional information about the thread to facilitate filtering or organization.",
                            "example": {
                              "user_id": "user_123",
                              "conversation_topic": "product_inquiry",
                              "priority": "high"
                            },
                            "nullable": true
                          }
                        }
                      }
                    },
                    "first_id": {
                      "type": "string",
                      "description": "The ID of the first thread in the list, or null if the list is empty.",
                      "nullable": true
                    },
                    "last_id": {
                      "type": "string",
                      "description": "The ID of the last thread in the list, or null if the list is empty.",
                      "nullable": true
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether there are more threads available after this batch."
                    }
                  },
                  "required": ["object", "data", "has_more"]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": ["Unauthorized"]
                    },
                    "message": {
                      "type": "string",
                      "example": "Invalid API key"
                    }
                  },
                  "required": ["error", "message"]
                }
              }
            }
          }
        }
      },
      "post": {
        "description": "Create a new thread. This endpoint allows you to initialize a conversation thread, optionally providing metadata or an initial log.",
        "servers": [{ "url": "https://api.langtail.com" }],
        "parameters": [
          {
            "schema": { "type": "string", "example": "<LANGTAIL_API_KEY>" },
            "required": true,
            "description": "Your Langtail API Key",
            "name": "X-API-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "metadata": {
                    "type": "object",
                    "description": "A set of key-value pairs that can be attached to the thread. This can be used to store additional information about the thread to facilitate filtering or organization.",
                    "example": {
                      "user_id": "user_123",
                      "conversation_topic": "product_inquiry",
                      "priority": "high"
                    }
                  },
                  "createLog": {
                    "type": "object",
                    "description": "A log object that can be passed to create an initial log for the thread."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully created thread",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The unique identifier for the created thread."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "The timestamp when the thread was created."
                    },
                    "projectId": {
                      "type": "string",
                      "description": "The ID of the project this thread belongs to."
                    },
                    "metadata": {
                      "type": "object",
                      "description": "The metadata associated with the thread, if provided.",
                      "nullable": true
                    },
                    "deletedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "The timestamp when the thread was deleted, if applicable.",
                      "nullable": true
                    },
                    "createLog": {
                      "type": "object",
                      "description": "The log created by the first message that creates the thread.",
                      "nullable": true
                    }
                  },
                  "required": ["id", "createdAt", "projectId"]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Invalid request body"
                        }
                      }
                    }
                  },
                  "required": ["error"]
                }
              }
            }
          }
        }
      }
    },
    "/v2/threads/{threadId}": {
      "get": {
        "description": "Retrieves a thread by its ID.",
        "servers": [{ "url": "https://api.langtail.com" }],
        "parameters": [
          {
            "schema": { "type": "string", "example": "<LANGTAIL_API_KEY>" },
            "required": true,
            "description": "Your Langtail API Key",
            "name": "X-API-Key",
            "in": "header"
          },
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "description": "The ID of the thread to retrieve.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The unique identifier for the thread."
                    },
                    "createdAt": {
                      "type": "integer",
                      "description": "The Unix timestamp (in seconds) of when the thread was created."
                    },
                    "projectId": {
                      "type": "string",
                      "description": "The ID of the project this thread belongs to."
                    },
                    "deletedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "The timestamp when the thread was deleted, if applicable.",
                      "nullable": true
                    },
                    "createLog": {
                      "type": "object",
                      "description": "A log created by the first message that creates the thread.",
                      "nullable": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "The unique identifier for the log."
                        },
                        "url": {
                          "type": "string",
                          "description": "The URL of the request."
                        },
                        "stream": {
                          "type": "boolean",
                          "description": "Indicates if the request was streamed."
                        },
                        "metadata": {
                          "type": "string",
                          "description": "Additional metadata associated with the log."
                        },
                        "promptId": {
                          "type": "string",
                          "description": "The ID of the prompt used."
                        },
                        "threadId": {
                          "type": "string",
                          "nullable": true,
                          "description": "The ID of the associated thread, if any."
                        },
                        "assistant": {
                          "type": "boolean",
                          "description": "Indicates if an assistant was used."
                        },
                        "projectId": {
                          "type": "string",
                          "description": "The ID of the project."
                        },
                        "requestIP": {
                          "type": "string",
                          "description": "The IP address of the request."
                        },
                        "startedAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "The timestamp when the request started."
                        },
                        "variables": {
                          "type": "string",
                          "description": "Variables used in the request."
                        },
                        "parameters": {
                          "type": "string",
                          "description": "Parameters used in the request."
                        },
                        "promptSlug": {
                          "type": "string",
                          "description": "The slug of the prompt used."
                        },
                        "doNotRecord": {
                          "type": "boolean",
                          "description": "Indicates if the request should not be recorded."
                        },
                        "environment": {
                          "type": "string",
                          "description": "The environment in which the request was made."
                        },
                        "openAIKeyId": {
                          "type": "string",
                          "description": "The ID of the OpenAI key used."
                        },
                        "projectSlug": {
                          "type": "string",
                          "description": "The slug of the project."
                        },
                        "requestData": {
                          "type": "string",
                          "description": "Data associated with the request."
                        },
                        "deploymentId": {
                          "type": "string",
                          "description": "The ID of the deployment."
                        },
                        "organizationId": {
                          "type": "string",
                          "description": "The ID of the organization."
                        },
                        "projectAPIKeyId": {
                          "type": "string",
                          "description": "The ID of the project API key."
                        },
                        "organizationSlug": {
                          "type": "string",
                          "description": "The slug of the organization."
                        },
                        "deploymentVersion": {
                          "type": "string",
                          "nullable": true,
                          "description": "The version of the deployment, if applicable."
                        },
                        "promptHistoryHash": {
                          "type": "string",
                          "description": "A hash of the prompt history."
                        },
                        "openAIOrganization": {
                          "type": "string",
                          "nullable": true,
                          "description": "The OpenAI organization, if applicable."
                        }
                      }
                    },
                    "metadata": {
                      "type": "object",
                      "description": "A set of key-value pairs that can be attached to the thread. This can be used to store additional information about the thread to facilitate filtering or organization.",
                      "example": {
                        "user_id": "user_123",
                        "conversation_topic": "product_inquiry",
                        "priority": "high"
                      },
                      "nullable": true
                    }
                  },
                  "required": ["id", "createdAt", "projectId"]
                }
              }
            }
          },
          "404": {
            "description": "Thread not found or not in the project",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Thread not found"
                        }
                      }
                    }
                  },
                  "required": ["error"]
                }
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes a thread by its ID.",
        "servers": [{ "url": "https://api.langtail.com" }],
        "parameters": [
          {
            "schema": { "type": "string", "example": "<LANGTAIL_API_KEY>" },
            "required": true,
            "description": "Your Langtail API Key",
            "name": "X-API-Key",
            "in": "header"
          },
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "description": "The ID of the thread to delete.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully deleted thread",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The unique identifier of the deleted thread."
                    },
                    "object": {
                      "type": "string",
                      "description": "The object type, which is always 'thread.deleted' for this response.",
                      "example": "thread.deleted"
                    },
                    "deleted": {
                      "type": "boolean",
                      "description": "Indicates that the thread was successfully deleted.",
                      "example": true
                    }
                  },
                  "required": ["id", "object", "deleted"]
                }
              }
            }
          },
          "404": {
            "description": "Thread not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Thread not found"
                        }
                      }
                    }
                  },
                  "required": ["error"]
                }
              }
            }
          }
        }
      },
      "post": {
        "description": "Updates a thread's metadata by its ID.",
        "servers": [{ "url": "https://api.langtail.com" }],
        "parameters": [
          {
            "schema": { "type": "string", "example": "<LANGTAIL_API_KEY>" },
            "required": true,
            "description": "Your Langtail API Key",
            "name": "X-API-Key",
            "in": "header"
          },
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "description": "The ID of the thread to update.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "metadata": {
                    "type": "object",
                    "description": "A set of key-value pairs that can be attached to the thread. This can be used to store additional information about the thread to facilitate filtering or organization. Note that the new metadata provided will completely overwrite any existing metadata for the thread.",
                    "example": {
                      "user_id": "user_123",
                      "conversation_topic": "product_inquiry",
                      "priority": "high"
                    }
                  }
                },
                "required": ["metadata"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully updated thread",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The unique identifier for the thread."
                    },
                    "createdAt": {
                      "type": "integer",
                      "description": "The Unix timestamp (in seconds) of when the thread was created."
                    },
                    "projectId": {
                      "type": "string",
                      "description": "The ID of the project this thread belongs to."
                    },
                    "createLog": {
                      "type": "object",
                      "description": "A log created by the first message that creates the thread.",
                      "nullable": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "The unique identifier for the log."
                        },
                        "url": {
                          "type": "string",
                          "description": "The URL of the request."
                        },
                        "stream": {
                          "type": "boolean",
                          "description": "Indicates if the request was streamed."
                        },
                        "metadata": {
                          "type": "string",
                          "description": "Additional metadata associated with the log."
                        },
                        "promptId": {
                          "type": "string",
                          "description": "The ID of the prompt used."
                        },
                        "threadId": {
                          "type": "string",
                          "nullable": true,
                          "description": "The ID of the associated thread, if any."
                        },
                        "assistant": {
                          "type": "boolean",
                          "description": "Indicates if an assistant was used."
                        },
                        "projectId": {
                          "type": "string",
                          "description": "The ID of the project."
                        },
                        "requestIP": {
                          "type": "string",
                          "description": "The IP address of the request."
                        },
                        "startedAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "The timestamp when the request started."
                        },
                        "variables": {
                          "type": "string",
                          "description": "Variables used in the request."
                        },
                        "parameters": {
                          "type": "string",
                          "description": "Parameters used in the request."
                        },
                        "promptSlug": {
                          "type": "string",
                          "description": "The slug of the prompt used."
                        },
                        "doNotRecord": {
                          "type": "boolean",
                          "description": "Indicates if the request should not be recorded."
                        },
                        "environment": {
                          "type": "string",
                          "description": "The environment in which the request was made."
                        },
                        "openAIKeyId": {
                          "type": "string",
                          "description": "The ID of the OpenAI key used."
                        },
                        "projectSlug": {
                          "type": "string",
                          "description": "The slug of the project."
                        },
                        "requestData": {
                          "type": "string",
                          "description": "Data associated with the request."
                        },
                        "deploymentId": {
                          "type": "string",
                          "description": "The ID of the deployment."
                        },
                        "organizationId": {
                          "type": "string",
                          "description": "The ID of the organization."
                        },
                        "projectAPIKeyId": {
                          "type": "string",
                          "description": "The ID of the project API key."
                        },
                        "organizationSlug": {
                          "type": "string",
                          "description": "The slug of the organization."
                        },
                        "deploymentVersion": {
                          "type": "string",
                          "nullable": true,
                          "description": "The version of the deployment, if applicable."
                        },
                        "promptHistoryHash": {
                          "type": "string",
                          "description": "A hash of the prompt history."
                        },
                        "openAIOrganization": {
                          "type": "string",
                          "nullable": true,
                          "description": "The OpenAI organization, if applicable."
                        }
                      }
                    },
                    "metadata": {
                      "type": "object",
                      "description": "The updated set of key-value pairs attached to the thread.",
                      "example": {
                        "user_id": "user_123",
                        "conversation_topic": "product_inquiry",
                        "priority": "high"
                      }
                    }
                  },
                  "required": ["id", "createdAt", "projectId", "metadata"]
                }
              }
            }
          },
          "400": {
            "description": "Metadata is required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Metadata is required"
                        }
                      }
                    }
                  },
                  "required": ["error"]
                }
              }
            }
          },
          "404": {
            "description": "Thread not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Thread not found"
                        }
                      }
                    }
                  },
                  "required": ["error"]
                }
              }
            }
          }
        }
      }
    },
    "/v2/threads/{threadId}/messages": {
      "get": {
        "description": "Retrieves a list of messages for a specific thread.",
        "servers": [{ "url": "https://api.langtail.com" }],
        "parameters": [
          {
            "schema": { "type": "string", "example": "<LANGTAIL_API_KEY>" },
            "required": true,
            "description": "Your Langtail API Key",
            "name": "X-API-Key",
            "in": "header"
          },
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "description": "The ID of the thread to retrieve messages from.",
            "schema": {
              "type": "string"
            }
          },
          {
            "schema": {
              "type": "number",
              "nullable": true
            },
            "name": "limit",
            "in": "query",
            "description": "The maximum number of threads to return. Default is 100."
          },
          {
            "schema": {
              "type": "string",
              "nullable": true
            },
            "name": "after",
            "in": "query",
            "description": "A cursor for use in pagination. 'after' is a thread ID that defines your place in the list. For instance, if you make a list request and receive 100 threads, ending with thread 'xyz', your subsequent call can include after='xyz' in order to fetch the next page of the list. Pagination works the same as in the OpenAI API https://platform.openai.com/docs/api-reference/assistants/listAssistants."
          },

          {
            "schema": {
              "type": "string",
              "nullable": true,
              "default": "asc",
              "enum": ["asc", "desc"]
            },
            "name": "order",
            "in": "query",
            "description": "The order of the messages. Default is 'asc' (oldest first). Use 'desc' for newest first."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": ["list"],
                      "description": "The object type, which is always 'list' for a list of messages."
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "The unique identifier for the message."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "description": "The timestamp when the message was created."
                          },
                          "threadId": {
                            "type": "string",
                            "description": "The ID of the thread this message belongs to."
                          },
                          "content": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "role": {
                                  "type": "string",
                                  "enum": [
                                    "assistant",
                                    "user",
                                    "system",
                                    "function",
                                    "tool"
                                  ]
                                },
                                "content": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "description": "Text content",
                                      "nullable": false
                                    },
                                    {
                                      "type": "array",
                                      "description": "Mix of text and images.",
                                      "items": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "enum": ["text"]
                                              },
                                              "text": { "type": "string" }
                                            },
                                            "required": ["type", "text"]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "enum": ["image_url"]
                                              },
                                              "image_url": {
                                                "type": "object",
                                                "properties": {
                                                  "url": { "type": "string" },
                                                  "detail": {
                                                    "type": "string",
                                                    "enum": [
                                                      "auto",
                                                      "low",
                                                      "high"
                                                    ],
                                                    "default": "auto"
                                                  }
                                                },
                                                "required": ["url", "detail"]
                                              }
                                            },
                                            "required": ["type", "image_url"]
                                          }
                                        ]
                                      }
                                    },
                                    {
                                      "nullable": true,
                                      "description": "Can be omited if there is a `function_call` or `tool_calls`"
                                    }
                                  ]
                                },
                                "function_call": {
                                  "type": "object",
                                  "properties": {
                                    "name": { "type": "string" },
                                    "arguments": { "type": "string" }
                                  },
                                  "required": ["name", "arguments"]
                                },
                                "tool_calls": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "id": { "type": "string" },
                                      "type": {
                                        "type": "string",
                                        "enum": ["function"]
                                      },
                                      "function": {
                                        "type": "object",
                                        "properties": {
                                          "name": { "type": "string" },
                                          "arguments": { "type": "string" }
                                        },
                                        "required": ["name", "arguments"]
                                      }
                                    },
                                    "required": ["id", "type", "function"]
                                  }
                                },
                                "tool_choice": {
                                  "anyOf": [
                                    { "type": "string", "enum": ["auto"] },
                                    { "type": "string", "enum": ["none"] },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": ["function"]
                                        },
                                        "function": {
                                          "type": "object",
                                          "properties": {
                                            "name": { "type": "string" }
                                          },
                                          "required": ["name"]
                                        }
                                      },
                                      "required": ["type", "function"]
                                    }
                                  ]
                                },
                                "tool_call_id": { "type": "string" }
                              },
                              "required": ["role", "content"]
                            },
                            "description": "Additional messages. These will be appended to the Prompt Template.",
                            "example": [{ "role": "user", "content": "Hello" }]
                          },
                          "requestLogId": {
                            "type": "string",
                            "nullable": true,
                            "description": "The ID of the associated request log, if available."
                          },
                          "metadata": {
                            "type": "object",
                            "nullable": true,
                            "description": "A set of key-value pairs that can be attached to the message."
                          }
                        },
                        "required": ["id", "createdAt", "threadId"]
                      }
                    },
                    "first_id": {
                      "type": "string",
                      "description": "The ID of the first thread in the list, or null if the list is empty.",
                      "nullable": true
                    },
                    "last_id": {
                      "type": "string",
                      "description": "The ID of the last thread in the list, or null if the list is empty.",
                      "nullable": true
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether there are more threads available after this batch."
                    }
                  },
                  "required": ["data", "has_more"]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Invalid request parameters"
                        }
                      }
                    }
                  },
                  "required": ["error"]
                }
              }
            }
          },
          "404": {
            "description": "Thread not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Thread not found"
                        }
                      }
                    }
                  },
                  "required": ["error"]
                }
              }
            }
          }
        }
      },
      "post": {
        "description": "Create a new message in a thread.",
        "servers": [{ "url": "https://api.langtail.com" }],
        "parameters": [
          {
            "schema": { "type": "string", "example": "<LANGTAIL_API_KEY>" },
            "required": true,
            "description": "Your Langtail API Key",
            "name": "X-API-Key",
            "in": "header"
          },
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "description": "The ID of the thread.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "object",
                    "description": "Message that will be added to the thread.",
                    "properties": {
                      "role": {
                        "type": "string",
                        "enum": [
                          "assistant",
                          "user",
                          "system",
                          "function",
                          "tool"
                        ]
                      },
                      "name": { "type": "string" },
                      "content": {
                        "anyOf": [
                          {
                            "type": "string",
                            "description": "Text content",
                            "nullable": false
                          },
                          {
                            "type": "array",
                            "description": "Mix of text and images.",
                            "items": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "enum": ["text"]
                                    },
                                    "text": { "type": "string" }
                                  },
                                  "required": ["type", "text"]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "enum": ["image_url"]
                                    },
                                    "image_url": {
                                      "type": "object",
                                      "properties": {
                                        "url": { "type": "string" },
                                        "detail": {
                                          "type": "string",
                                          "enum": ["auto", "low", "high"],
                                          "default": "auto"
                                        }
                                      },
                                      "required": ["url", "detail"]
                                    }
                                  },
                                  "required": ["type", "image_url"]
                                }
                              ]
                            }
                          },
                          {
                            "nullable": true,
                            "description": "Can be omited if there is a `function_call` or `tool_calls`"
                          }
                        ]
                      },
                      "function_call": {
                        "type": "object",
                        "properties": {
                          "name": { "type": "string" },
                          "arguments": { "type": "string" }
                        },
                        "required": ["name", "arguments"]
                      },
                      "tool_calls": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": { "type": "string" },
                            "type": {
                              "type": "string",
                              "enum": ["function"]
                            },
                            "function": {
                              "type": "object",
                              "properties": {
                                "name": { "type": "string" },
                                "arguments": { "type": "string" }
                              },
                              "required": ["name", "arguments"]
                            }
                          },
                          "required": ["id", "type", "function"]
                        }
                      },
                      "tool_choice": {
                        "anyOf": [
                          { "type": "string", "enum": ["auto"] },
                          { "type": "string", "enum": ["none"] },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": ["function"]
                              },
                              "function": {
                                "type": "object",
                                "properties": {
                                  "name": { "type": "string" }
                                },
                                "required": ["name"]
                              }
                            },
                            "required": ["type", "function"]
                          }
                        ]
                      },
                      "tool_call_id": { "type": "string" }
                    },
                    "required": ["role", "content"]
                  },
                  "metadata": {
                    "type": "object",
                    "description": "A set of key-value pairs that can be attached to the message.",
                    "example": {
                      "user_id": "user_123",
                      "conversation_topic": "product_inquiry",
                      "priority": "high"
                    }
                  }
                },
                "required": ["message"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The unique identifier for the message."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "The timestamp when the message was created."
                    },
                    "threadId": {
                      "type": "string",
                      "description": "The ID of the thread this message belongs to."
                    },
                    "content": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "role": {
                            "type": "string",
                            "enum": [
                              "assistant",
                              "user",
                              "system",
                              "function",
                              "tool"
                            ]
                          },
                          "content": {
                            "anyOf": [
                              {
                                "type": "string",
                                "description": "Text content",
                                "nullable": false
                              },
                              {
                                "type": "array",
                                "description": "Mix of text and images.",
                                "items": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": ["text"]
                                        },
                                        "text": { "type": "string" }
                                      },
                                      "required": ["type", "text"]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": ["image_url"]
                                        },
                                        "image_url": {
                                          "type": "object",
                                          "properties": {
                                            "url": { "type": "string" },
                                            "detail": {
                                              "type": "string",
                                              "enum": ["auto", "low", "high"],
                                              "default": "auto"
                                            }
                                          },
                                          "required": ["url", "detail"]
                                        }
                                      },
                                      "required": ["type", "image_url"]
                                    }
                                  ]
                                }
                              },
                              {
                                "nullable": true,
                                "description": "Can be omited if there is a `function_call` or `tool_calls`"
                              }
                            ]
                          },
                          "function_call": {
                            "type": "object",
                            "properties": {
                              "name": { "type": "string" },
                              "arguments": { "type": "string" }
                            },
                            "required": ["name", "arguments"]
                          },
                          "tool_calls": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": { "type": "string" },
                                "type": {
                                  "type": "string",
                                  "enum": ["function"]
                                },
                                "function": {
                                  "type": "object",
                                  "properties": {
                                    "name": { "type": "string" },
                                    "arguments": { "type": "string" }
                                  },
                                  "required": ["name", "arguments"]
                                }
                              },
                              "required": ["id", "type", "function"]
                            }
                          },
                          "tool_choice": {
                            "anyOf": [
                              { "type": "string", "enum": ["auto"] },
                              { "type": "string", "enum": ["none"] },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": ["function"]
                                  },
                                  "function": {
                                    "type": "object",
                                    "properties": {
                                      "name": { "type": "string" }
                                    },
                                    "required": ["name"]
                                  }
                                },
                                "required": ["type", "function"]
                              }
                            ]
                          },
                          "tool_call_id": { "type": "string" }
                        },
                        "required": ["role", "content"]
                      },
                      "description": "Additional messages. These will be appended to the Prompt Template.",
                      "example": [{ "role": "user", "content": "Hello" }]
                    },
                    "metadata": {
                      "type": "object",
                      "description": "A key-value store for additional metadata associated with the message.",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true
                    },
                    "requestLog": {
                      "type": "object",
                      "description": "Information about the request log, if available.",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "The unique identifier for the request log."
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "The timestamp when the request log was created."
                        },
                        "request": {
                          "type": "object",
                          "description": "Details of the request made."
                        },
                        "response": {
                          "type": "object",
                          "description": "Details of the response received."
                        }
                      },
                      "nullable": true
                    },
                    "requestLogId": {
                      "type": "string",
                      "description": "The unique identifier for the request log, if available.",
                      "nullable": true
                    }
                  },
                  "required": ["id", "createdAt", "threadId"]
                }
              }
            }
          
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Invalid request parameters"
                        }
                      }
                    }
                  },
                  "required": ["error"]
                }
              }
            }
          },
          "404": {
            "description": "Thread not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Thread not found"
                        }
                      }
                    }
                  },
                  "required": ["error"]
                }
              }
            }
          }
        }
      }
    },
    "/v2/threads/{threadId}/messages/{messageId}": {
      "get": {
        "description": "Retrieves a specific message from a thread.",
        "servers": [{ "url": "https://api.langtail.com" }],
        "parameters": [
          {
            "schema": { "type": "string", "example": "<LANGTAIL_API_KEY>" },
            "required": true,
            "description": "Your Langtail API Key",
            "name": "X-API-Key",
            "in": "header"
          },
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "description": "The ID of the thread containing the message.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "messageId",
            "in": "path",
            "required": true,
            "description": "The ID of the message to retrieve.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The unique identifier for the message."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "The timestamp when the message was created."
                    },
                    "threadId": {
                      "type": "string",
                      "description": "The ID of the thread this message belongs to."
                    },
                    "content": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "role": {
                            "type": "string",
                            "enum": [
                              "assistant",
                              "user",
                              "system",
                              "function",
                              "tool"
                            ]
                          },
                          "content": {
                            "anyOf": [
                              {
                                "type": "string",
                                "description": "Text content",
                                "nullable": false
                              },
                              {
                                "type": "array",
                                "description": "Mix of text and images.",
                                "items": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": ["text"]
                                        },
                                        "text": { "type": "string" }
                                      },
                                      "required": ["type", "text"]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": ["image_url"]
                                        },
                                        "image_url": {
                                          "type": "object",
                                          "properties": {
                                            "url": { "type": "string" },
                                            "detail": {
                                              "type": "string",
                                              "enum": ["auto", "low", "high"],
                                              "default": "auto"
                                            }
                                          },
                                          "required": ["url", "detail"]
                                        }
                                      },
                                      "required": ["type", "image_url"]
                                    }
                                  ]
                                }
                              },
                              {
                                "nullable": true,
                                "description": "Can be omited if there is a `function_call` or `tool_calls`"
                              }
                            ]
                          },
                          "function_call": {
                            "type": "object",
                            "properties": {
                              "name": { "type": "string" },
                              "arguments": { "type": "string" }
                            },
                            "required": ["name", "arguments"]
                          },
                          "tool_calls": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": { "type": "string" },
                                "type": {
                                  "type": "string",
                                  "enum": ["function"]
                                },
                                "function": {
                                  "type": "object",
                                  "properties": {
                                    "name": { "type": "string" },
                                    "arguments": { "type": "string" }
                                  },
                                  "required": ["name", "arguments"]
                                }
                              },
                              "required": ["id", "type", "function"]
                            }
                          },
                          "tool_choice": {
                            "anyOf": [
                              { "type": "string", "enum": ["auto"] },
                              { "type": "string", "enum": ["none"] },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": ["function"]
                                  },
                                  "function": {
                                    "type": "object",
                                    "properties": {
                                      "name": { "type": "string" }
                                    },
                                    "required": ["name"]
                                  }
                                },
                                "required": ["type", "function"]
                              }
                            ]
                          },
                          "tool_call_id": { "type": "string" }
                        },
                        "required": ["role", "content"]
                      },
                      "description": "Additional messages. These will be appended to the Prompt Template.",
                      "example": [{ "role": "user", "content": "Hello" }]
                    },
                    "metadata": {
                      "type": "object",
                      "description": "A key-value store for additional metadata associated with the message.",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true
                    },
                    "requestLog": {
                      "type": "object",
                      "description": "Information about the request log, if available.",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "The unique identifier for the request log."
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "The timestamp when the request log was created."
                        },
                        "request": {
                          "type": "object",
                          "description": "Details of the request made."
                        },
                        "response": {
                          "type": "object",
                          "description": "Details of the response received."
                        }
                      },
                      "nullable": true
                    },
                    "requestLogId": {
                      "type": "string",
                      "description": "The unique identifier for the request log, if available.",
                      "nullable": true
                    }
                  },
                  "required": ["id", "createdAt", "threadId"]
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Thread not found, message not in thread, or message does not exist"
                        }
                      }
                    }
                  },
                  "required": ["error"]
                }
              }
            }
          }
        }
      },
      "post": {
        "description": "Updates the metadata of a specific message within a thread.",
        "servers": [{ "url": "https://api.langtail.com" }],
        "parameters": [
          {
            "schema": { "type": "string", "example": "<LANGTAIL_API_KEY>" },
            "required": true,
            "description": "Your Langtail API Key",
            "name": "X-API-Key",
            "in": "header"
          },
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "description": "The ID of the thread containing the message.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "messageId",
            "in": "path",
            "required": true,
            "description": "The ID of the message to update.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "metadata": {
                    "type": "object",
                    "description": "Set of key-value pairs that you can attach to the message. This can be useful for storing additional information about the message in a structured format.",
                    "example": { "my_key": "my key value" }
                  }
                },
                "required": ["metadata"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The unique identifier for the message."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "The timestamp when the message was created."
                    },
                    "deletedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "The timestamp when the message was deleted.",
                      "nullable": true
                    },
                    "threadId": {
                      "type": "string",
                      "description": "The ID of the thread this message belongs to."
                    },
                    "content": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "role": {
                            "type": "string",
                            "enum": [
                              "assistant",
                              "user",
                              "system",
                              "function",
                              "tool"
                            ]
                          },
                          "content": {
                            "anyOf": [
                              {
                                "type": "string",
                                "description": "Text content",
                                "nullable": false
                              },
                              {
                                "type": "array",
                                "description": "Mix of text and images.",
                                "items": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": ["text"]
                                        },
                                        "text": { "type": "string" }
                                      },
                                      "required": ["type", "text"]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": ["image_url"]
                                        },
                                        "image_url": {
                                          "type": "object",
                                          "properties": {
                                            "url": { "type": "string" },
                                            "detail": {
                                              "type": "string",
                                              "enum": ["auto", "low", "high"],
                                              "default": "auto"
                                            }
                                          },
                                          "required": ["url", "detail"]
                                        }
                                      },
                                      "required": ["type", "image_url"]
                                    }
                                  ]
                                }
                              },
                              {
                                "nullable": true,
                                "description": "Can be omited if there is a `function_call` or `tool_calls`"
                              }
                            ]
                          },
                          "function_call": {
                            "type": "object",
                            "properties": {
                              "name": { "type": "string" },
                              "arguments": { "type": "string" }
                            },
                            "required": ["name", "arguments"]
                          },
                          "tool_calls": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": { "type": "string" },
                                "type": {
                                  "type": "string",
                                  "enum": ["function"]
                                },
                                "function": {
                                  "type": "object",
                                  "properties": {
                                    "name": { "type": "string" },
                                    "arguments": { "type": "string" }
                                  },
                                  "required": ["name", "arguments"]
                                }
                              },
                              "required": ["id", "type", "function"]
                            }
                          },
                          "tool_choice": {
                            "anyOf": [
                              { "type": "string", "enum": ["auto"] },
                              { "type": "string", "enum": ["none"] },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": ["function"]
                                  },
                                  "function": {
                                    "type": "object",
                                    "properties": {
                                      "name": { "type": "string" }
                                    },
                                    "required": ["name"]
                                  }
                                },
                                "required": ["type", "function"]
                              }
                            ]
                          },
                          "tool_call_id": { "type": "string" }
                        },
                        "required": ["role", "content"]
                      },
                      "description": "Additional messages. These will be appended to the Prompt Template.",
                      "example": [{ "role": "user", "content": "Hello" }]
                    },
                    "metadata": {
                      "type": "object",
                      "description": "A set of key-value pairs that can be attached to the message.",
                      "nullable": true,
                      "example": { "my_key": "my key value" }
                    },
                    "requestLogId": {
                      "type": "string",
                      "nullable": true,
                      "description": "The ID of the associated request log, if available."
                    }
                  },
                  "required": ["id", "createdAt", "threadId", "metadata"]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Metadata is required"
                        }
                      }
                    }
                  },
                  "required": ["error"]
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Message not found"
                        }
                      }
                    }
                  },
                  "required": ["error"]
                }
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes a message by its ID.",
        "servers": [{ "url": "https://api.langtail.com" }],
        "parameters": [
          {
            "schema": { "type": "string", "example": "<LANGTAIL_API_KEY>" },
            "required": true,
            "description": "Your Langtail API Key",
            "name": "X-API-Key",
            "in": "header"
          },
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "description": "The ID of the thread containing the message.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "messageId",
            "in": "path",
            "required": true,
            "description": "The ID of the message to retrieve.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully deleted message",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The unique identifier of the deleted message."
                    },
                    "object": {
                      "type": "string",
                      "description": "The object type, which is always 'thread.message.deleted' for this response.",
                      "example": "thread.message.deleted"
                    },
                    "deleted": {
                      "type": "boolean",
                      "description": "Indicates that the message was successfully deleted.",
                      "example": true
                    }
                  },
                  "required": ["id", "object", "deleted"]
                }
              }
            }
          },
          "404": {
            "description": "Message not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Message not found or does not belong to the proper thread/project"
                        }
                      }
                    }
                  },
                  "required": ["error"]
                }
              }
            }
          }
        }
      }
    },
    "/{workspace}/{project}/{prompt}/{environment}": {
      "post": {
        "description": "Get completion for stored prompt. The response format is the same as [OpenAI Chat completion response](https://platform.openai.com/docs/api-reference/chat/object).",
        "servers": [{ "url": "https://api.langtail.com" }],
        "parameters": [
          {
            "schema": { "type": "string", "example": "<LANGTAIL_API_KEY>" },
            "required": true,
            "description": "Your Langtail API Key",
            "name": "X-API-Key",
            "in": "header"
          },
          {
            "schema": { "type": "string", "example": "workspace" },
            "required": true,
            "description": "Your workspace URL slug",
            "name": "workspace",
            "in": "path"
          },
          {
            "schema": { "type": "string", "example": "project" },
            "required": true,
            "description": "Your project URL slug",
            "name": "project",
            "in": "path"
          },
          {
            "schema": { "type": "string", "example": "prompt" },
            "required": true,
            "description": "Your prompt URL slug",
            "name": "prompt",
            "in": "path"
          },
          {
            "schema": { "type": "string", "example": "production" },
            "required": true,
            "description": "Your environment URL slug",
            "name": "environment",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "variables": {
                    "type": "object",
                    "description": "A mapping of variable names to their values. Will be injected in your saved prompt template.",
                    "additionalProperties": {
                      "anyOf": [{ "type": "string" }]
                    },
                    "example": { "variableName": "Your Value" }
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "assistant",
                            "user",
                            "system",
                            "function",
                            "tool"
                          ]
                        },
                        "name": { "type": "string" },
                        "content": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "Text content",
                              "nullable": false
                            },
                            {
                              "type": "array",
                              "description": "Mix of text and images.",
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "enum": ["text"]
                                      },
                                      "text": { "type": "string" }
                                    },
                                    "required": ["type", "text"]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "enum": ["image_url"]
                                      },
                                      "image_url": {
                                        "type": "object",
                                        "properties": {
                                          "url": { "type": "string" },
                                          "detail": {
                                            "type": "string",
                                            "enum": ["auto", "low", "high"],
                                            "default": "auto"
                                          }
                                        },
                                        "required": ["url", "detail"]
                                      }
                                    },
                                    "required": ["type", "image_url"]
                                  }
                                ]
                              }
                            },
                            {
                              "nullable": true,
                              "description": "Can be omited if there is a `function_call` or `tool_calls`"
                            }
                          ]
                        },
                        "function_call": {
                          "type": "object",
                          "properties": {
                            "name": { "type": "string" },
                            "arguments": { "type": "string" }
                          },
                          "required": ["name", "arguments"]
                        },
                        "tool_calls": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": { "type": "string" },
                              "type": {
                                "type": "string",
                                "enum": ["function"]
                              },
                              "function": {
                                "type": "object",
                                "properties": {
                                  "name": { "type": "string" },
                                  "arguments": { "type": "string" }
                                },
                                "required": ["name", "arguments"]
                              }
                            },
                            "required": ["id", "type", "function"]
                          }
                        },
                        "tool_choice": {
                          "anyOf": [
                            { "type": "string", "enum": ["auto"] },
                            { "type": "string", "enum": ["none"] },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": ["function"]
                                },
                                "function": {
                                  "type": "object",
                                  "properties": {
                                    "name": { "type": "string" }
                                  },
                                  "required": ["name"]
                                }
                              },
                              "required": ["type", "function"]
                            }
                          ]
                        },
                        "tool_call_id": { "type": "string" }
                      },
                      "required": ["role", "content"]
                    },
                    "description": "Additional messages. These will be appended to the Prompt Template.",
                    "example": [{ "role": "user", "content": "Hello" }]
                  },
                  "stream": { "type": "boolean", "example": false },
                  "model": {
                    "type": "string",
                    "description": "Overrides the model of deployed prompt."
                  },
                  "max_tokens": {
                    "type": "number",
                    "description": "Overrides the max tokens of deployed prompt. The maximum number of tokens that can be generated in the completion."
                  },
                  "temperature": {
                    "type": "number",
                    "description": "Overrides the temperature of deployed prompt. What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic."
                  },
                  "top_p": {
                    "type": "number",
                    "description": "Overrides the top_p of deployed prompt. An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both."
                  },
                  "presence_penalty": {
                    "type": "number",
                    "description": "Overrides the presence_penalty of deployed prompt."
                  },
                  "frequency_penalty": {
                    "type": "number",
                    "description": "Overrides the frequency_penalty of deployed prompt."
                  },
                  "template": {
                    "description": "Overrides the stored template messages with custom template messages.",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "assistant",
                            "user",
                            "system",
                            "function",
                            "tool"
                          ]
                        },
                        "name": { "type": "string" },
                        "content": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "Text content",
                              "nullable": false
                            },
                            {
                              "type": "array",
                              "description": "Mix of text and images.",
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "enum": ["text"]
                                      },
                                      "text": { "type": "string" }
                                    },
                                    "required": ["type", "text"]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "enum": ["image_url"]
                                      },
                                      "image_url": {
                                        "type": "object",
                                        "properties": {
                                          "url": { "type": "string" },
                                          "detail": {
                                            "type": "string",
                                            "enum": ["auto", "low", "high"],
                                            "default": "auto"
                                          }
                                        },
                                        "required": ["url", "detail"]
                                      }
                                    },
                                    "required": ["type", "image_url"]
                                  }
                                ]
                              }
                            },
                            {
                              "nullable": true,
                              "description": "Can be omited if there is a `function_call` or `tool_calls`"
                            }
                          ]
                        },
                        "function_call": {
                          "type": "object",
                          "properties": {
                            "name": { "type": "string" },
                            "arguments": { "type": "string" }
                          },
                          "required": ["name", "arguments"]
                        },
                        "tool_calls": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": { "type": "string" },
                              "type": {
                                "type": "string",
                                "enum": ["function"]
                              },
                              "function": {
                                "type": "object",
                                "properties": {
                                  "name": { "type": "string" },
                                  "arguments": { "type": "string" }
                                },
                                "required": ["name", "arguments"]
                              }
                            },
                            "required": ["id", "type", "function"]
                          }
                        },
                        "tool_choice": {
                          "anyOf": [
                            { "type": "string", "enum": ["auto"] },
                            { "type": "string", "enum": ["none"] },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": ["function"]
                                },
                                "function": {
                                  "type": "object",
                                  "properties": {
                                    "name": { "type": "string" }
                                  },
                                  "required": ["name"]
                                }
                              },
                              "required": ["type", "function"]
                            }
                          ]
                        },
                        "tool_call_id": { "type": "string" }
                      },
                      "required": ["role", "content"]
                    }
                  },
                  "tool_choice": {
                    "description": "Overrides the tool choice of deployed prompt.",
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": ["auto", "required", "none"]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": { "type": "string", "enum": ["function"] },
                          "function": {
                            "type": "object",
                            "properties": { "name": { "type": "string" } },
                            "required": ["name"]
                          }
                        },
                        "required": ["type", "function"]
                      }
                    ]
                  },
                  "response_format": {
                    "description": "Overrides the response format of deployed prompt.",
                    "type": "object",
                    "properties": {
                      "type": { "type": "string", "enum": ["json_object"] }
                    },
                    "required": ["type"]
                  },
                  "user": {
                    "type": "string",
                    "description": "A unique identifier representing your end-user",
                    "example": "user_123"
                  },
                  "doNotRecord": {
                    "type": "boolean",
                    "description": "If true, potentially sensitive data like the prompt and response will not be recorded in the logs",
                    "example": false
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {
                      "anyOf": [{ "type": "string" }, { "type": "number" }]
                    },
                    "description": "Additional custom data that will be stored for this request",
                    "example": { "my_identifier": "my-custom-ID" }
                  },
                  "seed": {
                    "type": "number",
                    "description": "A seed is used  to generate reproducible results",
                    "example": 123
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Chat completion response from OpenAI - see https://platform.openai.com/docs/api-reference/chat/object for more details.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A unique identifier for the chat completion."
                    },
                    "object": {
                      "type": "string",
                      "description": "The object type, which is always `chat.completion`."
                    },
                    "created": {
                      "type": "number",
                      "description": "The Unix timestamp (in seconds) of when the chat completion was created."
                    },
                    "model": {
                      "type": "string",
                      "description": "The model used for the chat completion."
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "number",
                            "description": "The index of the choice in the list of choices.",
                            "x-internal-comment": "Using enum as example: 0 was ignored",
                            "enum": [0]
                          },
                          "message": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string",
                                "enum": ["assistant"],
                                "description": "The role of the author of this message."
                              },
                              "content": {
                                "type": "string",
                                "nullable": true,
                                "example": "I'm sorry, but I'm not able to fulfill this request."
                              }
                            },
                            "required": ["role", "content"]
                          },
                          "finish_reason": {
                            "type": "string",
                            "enum": [
                              "stop",
                              "length",
                              "tool_calls",
                              "content_filter",
                              "function_call"
                            ],
                            "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, `content_filter` if content was omitted due to a flag from our content filters, `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function."
                          }
                        },
                        "required": ["index", "message", "finish_reason"]
                      },
                      "description": "A list of chat completion choices. Can be more than one if `n` is greater than 1."
                    }
                  },
                  "required": ["id", "object", "created", "model", "choices"]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request bodys",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": ["Invalid request body"]
                    },
                    "issues": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "enum": ["unrecognized_keys", "invalid_type"]
                          },
                          "keys": {
                            "type": "array",
                            "items": { "type": "string" }
                          },
                          "path": {
                            "type": "array",
                            "items": { "type": "string" }
                          },
                          "message": { "type": "string" }
                        },
                        "required": ["code", "keys", "path", "message"]
                      }
                    }
                  },
                  "required": ["error", "issues"],
                  "example": {
                    "error": "Invalid request body",
                    "issues": [
                      {
                        "code": "unrecognized_keys",
                        "keys": ["unknown_variable"],
                        "path": ["variables"],
                        "message": "Unrecognized key(s) in object: 'unknown_variable'"
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/{workspace}/{project}/{assistant}/{environment}": {
      "post": {
        "description": "Get completion for a stored assistant. This endpoint invokes the assistant and returns its response. It uses chat completions on the backend and maintains OpenAI-compatible format. Assistants are stateful AI agents that can leverage various model providers and tools, access persistent conversation threads, and execute multiple tools in parallel.",
        "servers": [{ "url": "https://api.langtail.com" }],
        "parameters": [
          {
            "schema": { "type": "string", "example": "<LANGTAIL_API_KEY>" },
            "required": true,
            "description": "Your Langtail API Key",
            "name": "X-API-Key",
            "in": "header"
          },
          {
            "schema": { "type": "string", "example": "workspace" },
            "required": true,
            "description": "Your workspace URL slug",
            "name": "workspace",
            "in": "path"
          },
          {
            "schema": { "type": "string", "example": "project" },
            "required": true,
            "description": "Your project URL slug",
            "name": "project",
            "in": "path"
          },
          {
            "schema": { "type": "string", "example": "assistant" },
            "required": true,
            "description": "Your assistant URL slug",
            "name": "assistant",
            "in": "path"
          },
          {
            "schema": { "type": "string", "example": "production" },
            "required": true,
            "description": "Your environment URL slug",
            "name": "environment",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "threadId": {
                    "type": "string",
                    "description": "A unique identifier for the thread. If not provided, a new thread will be created.",
                    "example": "thread_123"
                  },
                  "variables": {
                    "type": "object",
                    "description": "A mapping of variable names to their values. Will be injected in your saved assistant template.",
                    "additionalProperties": {
                      "anyOf": [{ "type": "string" }]
                    },
                    "example": { "variableName": "Your Value" }
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "assistant",
                            "user",
                            "system",
                            "function",
                            "tool"
                          ]
                        },
                        "name": { "type": "string" },
                        "content": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "Text content",
                              "nullable": false
                            },
                            {
                              "type": "array",
                              "description": "Mix of text and images.",
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "enum": ["text"]
                                      },
                                      "text": { "type": "string" }
                                    },
                                    "required": ["type", "text"]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "enum": ["image_url"]
                                      },
                                      "image_url": {
                                        "type": "object",
                                        "properties": {
                                          "url": { "type": "string" },
                                          "detail": {
                                            "type": "string",
                                            "enum": ["auto", "low", "high"],
                                            "default": "auto"
                                          }
                                        },
                                        "required": ["url", "detail"]
                                      }
                                    },
                                    "required": ["type", "image_url"]
                                  }
                                ]
                              }
                            },
                            {
                              "nullable": true,
                              "description": "Can be omited if there is a `function_call` or `tool_calls`"
                            }
                          ]
                        },
                        "function_call": {
                          "type": "object",
                          "properties": {
                            "name": { "type": "string" },
                            "arguments": { "type": "string" }
                          },
                          "required": ["name", "arguments"]
                        },
                        "tool_calls": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": { "type": "string" },
                              "type": {
                                "type": "string",
                                "enum": ["function"]
                              },
                              "function": {
                                "type": "object",
                                "properties": {
                                  "name": { "type": "string" },
                                  "arguments": { "type": "string" }
                                },
                                "required": ["name", "arguments"]
                              }
                            },
                            "required": ["id", "type", "function"]
                          }
                        },
                        "tool_choice": {
                          "anyOf": [
                            { "type": "string", "enum": ["auto"] },
                            { "type": "string", "enum": ["none"] },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": ["function"]
                                },
                                "function": {
                                  "type": "object",
                                  "properties": {
                                    "name": { "type": "string" }
                                  },
                                  "required": ["name"]
                                }
                              },
                              "required": ["type", "function"]
                            }
                          ]
                        },
                        "tool_call_id": { "type": "string" }
                      },
                      "required": ["role", "content"]
                    },
                    "description": "Additional messages. These will be appended to the Thread.",
                    "example": [{ "role": "user", "content": "Hello" }]
                  },
                  "stream": { "type": "boolean", "example": false },
                  "model": {
                    "type": "string",
                    "description": "Overrides the model of deployed assistant."
                  },
                  "max_tokens": {
                    "type": "number",
                    "description": "Overrides the max tokens of deployed assistant. The maximum number of tokens that can be generated in the completion."
                  },
                  "temperature": {
                    "type": "number",
                    "description": "Overrides the temperature of deployed assistant. What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic."
                  },
                  "top_p": {
                    "type": "number",
                    "description": "Overrides the top_p of deployed assistant. An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both."
                  },
                  "presence_penalty": {
                    "type": "number",
                    "description": "Overrides the presence_penalty of deployed assistant."
                  },
                  "frequency_penalty": {
                    "type": "number",
                    "description": "Overrides the frequency_penalty of deployed assistant."
                  },
                  "template": {
                    "description": "Overrides the stored template messages with custom template messages.",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "assistant",
                            "user",
                            "system",
                            "function",
                            "tool"
                          ]
                        },
                        "name": { "type": "string" },
                        "content": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "Text content",
                              "nullable": false
                            },
                            {
                              "type": "array",
                              "description": "Mix of text and images.",
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "enum": ["text"]
                                      },
                                      "text": { "type": "string" }
                                    },
                                    "required": ["type", "text"]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "enum": ["image_url"]
                                      },
                                      "image_url": {
                                        "type": "object",
                                        "properties": {
                                          "url": { "type": "string" },
                                          "detail": {
                                            "type": "string",
                                            "enum": ["auto", "low", "high"],
                                            "default": "auto"
                                          }
                                        },
                                        "required": ["url", "detail"]
                                      }
                                    },
                                    "required": ["type", "image_url"]
                                  }
                                ]
                              }
                            },
                            {
                              "nullable": true,
                              "description": "Can be omited if there is a `function_call` or `tool_calls`"
                            }
                          ]
                        },
                        "function_call": {
                          "type": "object",
                          "properties": {
                            "name": { "type": "string" },
                            "arguments": { "type": "string" }
                          },
                          "required": ["name", "arguments"]
                        },
                        "tool_calls": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": { "type": "string" },
                              "type": {
                                "type": "string",
                                "enum": ["function"]
                              },
                              "function": {
                                "type": "object",
                                "properties": {
                                  "name": { "type": "string" },
                                  "arguments": { "type": "string" }
                                },
                                "required": ["name", "arguments"]
                              }
                            },
                            "required": ["id", "type", "function"]
                          }
                        },
                        "tool_choice": {
                          "anyOf": [
                            { "type": "string", "enum": ["auto"] },
                            { "type": "string", "enum": ["none"] },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": ["function"]
                                },
                                "function": {
                                  "type": "object",
                                  "properties": {
                                    "name": { "type": "string" }
                                  },
                                  "required": ["name"]
                                }
                              },
                              "required": ["type", "function"]
                            }
                          ]
                        },
                        "tool_call_id": { "type": "string" }
                      },
                      "required": ["role", "content"]
                    }
                  },
                  "tool_choice": {
                    "description": "Overrides the tool choice of deployed assistant.",
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": ["auto", "required", "none"]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": { "type": "string", "enum": ["function"] },
                          "function": {
                            "type": "object",
                            "properties": { "name": { "type": "string" } },
                            "required": ["name"]
                          }
                        },
                        "required": ["type", "function"]
                      }
                    ]
                  },
                  "response_format": {
                    "description": "Overrides the response format of deployed assistant.",
                    "type": "object",
                    "properties": {
                      "type": { "type": "string", "enum": ["json_object"] }
                    },
                    "required": ["type"]
                  },
                  "user": {
                    "type": "string",
                    "description": "A unique identifier representing your end-user",
                    "example": "user_123"
                  },
                  "doNotRecord": {
                    "type": "boolean",
                    "description": "If true, potentially sensitive data like the assistant and response will not be recorded in the logs",
                    "example": false
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {
                      "anyOf": [{ "type": "string" }, { "type": "number" }]
                    },
                    "description": "Additional custom data that will be stored for this request",
                    "example": { "my_identifier": "my-custom-ID" }
                  },
                  "seed": {
                    "type": "number",
                    "description": "A seed is used  to generate reproducible results",
                    "example": 123
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Chat completion response from OpenAI - see https://platform.openai.com/docs/api-reference/chat/object for more details. Note: The response includes an 'x-langtail-thread-id' header containing the unique identifier for the thread associated with this response.",
            "headers": {
              "x-langtail-thread-id": {
                "schema": {
                  "type": "string"
                },
                "description": "The unique identifier for the thread associated with this response."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A unique identifier for the chat completion."
                    },
                    "object": {
                      "type": "string",
                      "description": "The object type, which is always `chat.completion`."
                    },
                    "created": {
                      "type": "number",
                      "description": "The Unix timestamp (in seconds) of when the chat completion was created."
                    },
                    "model": {
                      "type": "string",
                      "description": "The model used for the chat completion."
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "number",
                            "description": "The index of the choice in the list of choices.",
                            "x-internal-comment": "Using enum as example: 0 was ignored",
                            "enum": [0]
                          },
                          "message": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string",
                                "enum": ["assistant"],
                                "description": "The role of the author of this message."
                              },
                              "content": {
                                "type": "string",
                                "nullable": true,
                                "example": "I'm sorry, but I'm not able to fulfill this request."
                              }
                            },
                            "required": ["role", "content"]
                          },
                          "finish_reason": {
                            "type": "string",
                            "enum": [
                              "stop",
                              "length",
                              "tool_calls",
                              "content_filter",
                              "function_call"
                            ],
                            "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, `content_filter` if content was omitted due to a flag from our content filters, `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function."
                          }
                        },
                        "required": ["index", "message", "finish_reason"]
                      },
                      "description": "A list of chat completion choices. Can be more than one if `n` is greater than 1."
                    }
                  },
                  "required": ["id", "object", "created", "model", "choices"]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request bodys",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": ["Invalid request body"]
                    },
                    "issues": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "enum": ["unrecognized_keys", "invalid_type"]
                          },
                          "keys": {
                            "type": "array",
                            "items": { "type": "string" }
                          },
                          "path": {
                            "type": "array",
                            "items": { "type": "string" }
                          },
                          "message": { "type": "string" }
                        },
                        "required": ["code", "keys", "path", "message"]
                      }
                    }
                  },
                  "required": ["error", "issues"],
                  "example": {
                    "error": "Invalid request body",
                    "issues": [
                      {
                        "code": "unrecognized_keys",
                        "keys": ["unknown_variable"],
                        "path": ["variables"],
                        "message": "Unrecognized key(s) in object: 'unknown_variable'"
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
