PromptLayer Logging & Tracking API

Log and track LLM requests, scores, and metadata.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/promptlayer-logging-tracking-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no email required.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

promptlayer-logging-tracking-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: PromptLayer Evaluations & Datasets Logging & Tracking API
  description: 'REST API for PromptLayer, a prompt engineering, prompt management, and LLM observability platform. The API logs and tracks LLM requests, manages a versioned prompt registry with release labels, ingests OpenTelemetry-style spans and traces, and runs evaluations against datasets. All requests are authenticated with an `X-API-KEY` header. Note: some legacy tracking endpoints are served under the `/rest` path prefix while newer endpoints are served at the API root.'
  termsOfService: https://www.promptlayer.com/terms-of-service
  contact:
    name: PromptLayer Support
    email: hello@promptlayer.com
  version: '1.0'
servers:
- url: https://api.promptlayer.com
security:
- ApiKeyAuth: []
tags:
- name: Logging & Tracking
  description: Log and track LLM requests, scores, and metadata.
paths:
  /log-request:
    post:
      operationId: logRequest
      tags:
      - Logging & Tracking
      summary: Log an LLM request
      description: Logs a provider-agnostic LLM request to PromptLayer using the Prompt Blueprint format for input and output, including timing, parameters, token usage, price, tags, and metadata.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LogRequest'
      responses:
        '201':
          description: Request logged
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogRequestResponse'
        '401':
          description: Unauthorized
        '422':
          description: Validation error
  /rest/track-prompt:
    post:
      operationId: trackPrompt
      tags:
      - Logging & Tracking
      summary: Associate a prompt template with a logged request
      description: Associates a prompt template (by name, with optional version or release label) and its input variables with a previously logged PromptLayer request.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TrackPromptRequest'
      responses:
        '200':
          description: Prompt tracked
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessMessage'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '422':
          description: Validation error
  /rest/track-score:
    post:
      operationId: trackScore
      tags:
      - Logging & Tracking
      summary: Attach a score to a logged request
      description: Attaches a 0-100 integer score, optionally named, to a logged request.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TrackScoreRequest'
      responses:
        '200':
          description: Score tracked
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessMessage'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '422':
          description: Validation error
  /rest/track-metadata:
    post:
      operationId: trackMetadata
      tags:
      - Logging & Tracking
      summary: Attach metadata to a logged request
      description: Attaches a custom key-value metadata dictionary to a logged request.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TrackMetadataRequest'
      responses:
        '200':
          description: Metadata tracked
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessMessage'
        '401':
          description: Unauthorized
        '422':
          description: Validation error
components:
  schemas:
    PromptBlueprint:
      type: object
      description: Prompt Blueprint payload, either a chat prompt (messages array) or a completion prompt (content string). Provider-agnostic representation.
      additionalProperties: true
    SuccessMessage:
      type: object
      properties:
        success:
          type: boolean
        message:
          type: string
    TrackScoreRequest:
      type: object
      required:
      - request_id
      - score
      properties:
        request_id:
          type: integer
        score:
          type: integer
          minimum: 0
          maximum: 100
        name:
          type: string
          default: default
    LogRequestResponse:
      type: object
      properties:
        id:
          type: integer
        prompt_version:
          type: object
          nullable: true
          additionalProperties: true
        status:
          type: string
          enum:
          - SUCCESS
          - WARNING
          - ERROR
        error_type:
          type: string
          nullable: true
        error_message:
          type: string
          nullable: true
    TrackMetadataRequest:
      type: object
      required:
      - request_id
      - metadata
      properties:
        request_id:
          oneOf:
          - type: integer
          - type: string
        metadata:
          type: object
          additionalProperties: true
    LogRequest:
      type: object
      required:
      - provider
      - model
      - input
      - output
      - request_start_time
      - request_end_time
      properties:
        provider:
          type: string
          description: LLM provider name (e.g., openai, anthropic).
        model:
          type: string
          description: Model identifier.
        input:
          $ref: '#/components/schemas/PromptBlueprint'
        output:
          $ref: '#/components/schemas/PromptBlueprint'
        request_start_time:
          type: string
          format: date-time
        request_end_time:
          type: string
          format: date-time
        api_type:
          type: string
          description: API endpoint type (e.g., chat-completions).
        parameters:
          type: object
          additionalProperties: true
          description: Model parameters such as temperature and max_tokens.
        tags:
          type: array
          items:
            type: string
        metadata:
          type: object
          additionalProperties:
            type: string
        status:
          type: string
          enum:
          - SUCCESS
          - WARNING
          - ERROR
          default: SUCCESS
        error_type:
          type: string
        error_message:
          type: string
          maxLength: 1024
        input_tokens:
          type: integer
        output_tokens:
          type: integer
        price:
          type: number
        score:
          type: integer
          minimum: 0
          maximum: 100
    TrackPromptRequest:
      type: object
      required:
      - prompt_name
      - request_id
      properties:
        prompt_name:
          type: string
        request_id:
          oneOf:
          - type: integer
          - type: string
        prompt_input_variables:
          type: object
          additionalProperties: true
        version:
          oneOf:
          - type: integer
          - type: string
          nullable: true
        label:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY