Skip to main content

What is Request Metadata?

Request Metadata allows you to enhance your API calls with custom data that enables powerful analytics, tracking, and prompt template rendering. By adding metadata to your requests, you can:
View request logs in the Requesty Console.
  • Track user interactions across sessions
  • Group requests by custom tags
  • Associate requests with specific workflows
  • Add business context to your API usage
  • Apply prompt templates per request, pass template variables, and inherit saved prompt settings

How It Works

  1. Use the standard OpenAI client with Requesty’s base URL
  2. Add the extra_body parameter with your metadata
  3. View and analyze this data in your Requesty dashboard

Key Metadata Fields

Core Fields

  • tags: Array of strings for grouping related requests
  • user_id: Identifier for the end user making the request
  • trace_id: Unique identifier to track related requests in a workflow

Extra Context

The extra object can include any custom fields relevant to your business:
  • country: User’s location for geographic analysis
  • prompt_title: Descriptive name of the prompt’s purpose
  • tier: User’s subscription level
  • language: Preferred language of the user
  • application: Source application or feature

Prompt Templates

Use prompt_id to apply a Prompt Template for a single request, and prompt_variables to pass per-request values into the template. These values are used while Requesty renders the prompt template and are not sent to the model as a separate field. If the selected prompt has model parameters or a response format configured, Requesty applies those settings after rendering the template. Prompt-level settings override the matching request fields, including temperature, max_tokens, reasoning_effort, and response_format. For example, if a prompt template named localized_product_writer contains:
Apply that template and pass variables in the Requesty extras object:
Requesty renders the prompt template before routing the request, so the model sees the rendered instruction:

Benefits

  • User Journey Analysis: Track how users interact with AI across sessions
  • Cost Attribution: Assign AI usage costs to specific business units
  • Performance Optimization: Identify which prompts perform best for specific uses
  • Workflow Visualization: See how multiple API calls connect in complex processes

Implementation Examples

Python Example

Node.js Example

For consistent analytics, establish naming conventions for your tags and metadata fields across your organization.
Last modified on July 10, 2026