Mensageiro Sessions API

Session traces: requests grouped by the x-session-id they carried, and the usage log as CSV. An admin key or a console sign-in.

GitHub OpenAPI

Operations 3

GET /v1/sessions Recent sessions #
GET /v1/sessions/{session_id} One session's timeline #
GET /v1/usage/export Usage log as CSV #

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/mensageiro-ai:mensageiro-ai-sessions-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

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

OpenAPI Specification

mensageiro-ai-sessions-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Mensageiro Sessions API
  version: '2026-10-19'
  summary: One key and one base URL for Claude, GPT, Gemini and the open-weight models in the OpenAI, Anthropic and Gemini wire formats, plus image, video, speech and 3D models.
  description: 'Send the request your SDK already sends, to `https://api.mensageiro.ai/v1` instead of the developer''s URL. The proxy changes only the credential, `stream_options.include_usage` on OpenAI-format streams that did not set it, a `top_k` of 0 or less (off) which it leaves out, and the model id when the request named one of your aliases. Authentication: `Authorization: Bearer sk-msg-live-...`, or the header your SDK sends (`x-api-key` for the Anthropic SDK, `x-goog-api-key` for the Gemini SDK). Exactly one key per request, never in the URL. Model ids are enumerated by GET /v1/catalog (chat, embedding, moderation, rerank and transcription models; each entry''s `type` and `endpoints` say which route takes it) and GET /v1/catalog/media (media), with prices, and by GET /v1/models for what a given key may call. They are not listed in this document. Errors: every error is a JSON object whose `error` carries a `code` and a `message`. OpenAI-format routes and every route outside the chat formats add `type` and `param` (the `Error` schema); the Anthropic format answers in Anthropic''s error shape with the code appended to the message, and the Gemini format in Google''s. Every error carries `x-uplink-request-id`. Fallbacks: `models: ["a", "b"]` in an OpenAI- or Anthropic-format body names up to 5 models tried in order after `model` (or alone, its first entry being the model). The next model is tried only once every route of the one before has failed before a byte reached you, so a stream falls back only before its first byte. The answer''s `model` and `x-uplink-model` name the model that answered, which is the one billed, at its own price. Every entry obeys the key''s allowlist. A key''s `fallback_models` is used when a request names no `models`. Presets: `model: "@preset/"` (also `@`, `@preset/`, or `preset: "@preset/"` beside a model) runs one of your organization''s presets, managed at /v1/presets: its model, fallbacks, default params, system prompt (prepended to yours, or replacing it) and tools. Your request''s own fields win; your tools replace the preset''s tools of the same name and the rest are appended. Every response carries `x-uplink-request-id`; quote it when you write in. Chat responses add `x-uplink-model` and, when they apply, the headers under `components.headers`. Paying per request without a key (x402): POST /v1/chat/completions, /v1/messages, /v1/responses, /v1/embeddings or /v1/search with no credential header and `X-PAYMENT: new` answers 402 with an x402 PaymentRequired object (protocol version 2) as the body and base64 in the PAYMENT-REQUIRED header. `accepts[0]` is scheme `checkout`: `payTo` is a one-time crypto checkout link (USDT, USDC, BTC, ETH, SOL and 13 more), `amount` the dollars to pay (the hold a key would be held for this request, rounded up to whole dollars, at least $1; the hold itself is `extra.request_usd`: the input at 4 bytes a token plus `max_tokens`, 16,384 when the request sets none, at the model''s catalog price, or one search''s fee on /v1/search), `extra.payment_id` the id of the payment. Pay there, then send the same request again with `X-PAYMENT: ` (or PAYMENT-SIGNATURE carrying a base64 x402 PaymentPayload whose `payload.payment_id` is the id). A request with no credential and no X-PAYMENT or PAYMENT-SIGNATURE header is not paying per request: it answers 401 invalid_api_key. Until the payment confirms the answer is 402 x402_payment_pending with the same quote; once it has, the request runs with the payment id as its end user and its own rate limit, and the answer adds PAYMENT-RESPONSE (base64 `{ success, transaction, network, payer }`) beside x-uplink-charge and the signed receipt. Every request sent with the id spends the payment down at the catalog price, and what the last one leaves stays with the service; a request the remainder cannot hold is a 402 x402_payment_spent with a fresh checkout. `stream` must be false. The model must be one id from GET /v1/catalog (no aliases, presets or `auto`).'
  contact:
    url: https://mensageiro.ai/contact
    email: contato@mensageiro.ai
servers:
- url: https://api.mensageiro.ai
  description: Production
security:
- bearer: []
- apiKey: []
- googleApiKey: []
tags:
- name: Sessions
  description: 'Session traces: requests grouped by the x-session-id they carried, and the usage log as CSV. An admin key or a console sign-in.'
paths:
  /v1/sessions:
    get:
      operationId: listSessions
      summary: Recent sessions
      description: Requests grouped by session, newest activity first. A request joins a session through the `x-session-id` header (or `x-uplink-session`, or a `session_id` or `user` field in the body); a hosted agent's turns use `:`. Each row counts requests, models, keys, tokens, cost and failed requests between the first request's start and the last one's end.
      tags:
      - Sessions
      security:
      - adminKey: []
      parameters:
      - name: key_id
        in: query
        description: Only this key's requests.
        schema:
          type: string
      - name: days
        in: query
        description: How far back, 1 to 90. 30 unless set.
        schema:
          type: integer
          minimum: 1
          maximum: 90
      - name: limit
        in: query
        description: 1 to 200. 50 unless set.
        schema:
          type: integer
          minimum: 1
          maximum: 200
      - name: before
        in: query
        description: '`next_before` of the previous page.'
        schema:
          type: integer
      responses:
        '200':
          description: The sessions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionList'
        '401':
          description: 'unauthorized: no admin key and no console sign-in.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/sessions/{session_id}:
    get:
      operationId: getSession
      summary: One session's timeline
      description: Every request of the session in the order they started (up to 1,000), with model, tokens, cost, latency and outcome, plus the totals.
      tags:
      - Sessions
      security:
      - adminKey: []
      parameters:
      - name: session_id
        in: path
        required: true
        description: The session id, URL-encoded.
        schema:
          type: string
          pattern: ^[\x20-\x7E]{1,128}$
      responses:
        '200':
          description: The timeline.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionEnvelope'
        '401':
          description: unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: 'not_found: no request of your organization carried this session id.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/usage/export:
    get:
      operationId: exportUsageCsv
      summary: Usage log as CSV
      description: 'The organization''s requests from `from` to `to`, oldest first, as CSV: request_id, created_at, key_id, session_id, model, outcome, status, input_tokens, cache_read_tokens, cache_write_tokens, output_tokens, charge_usd, latency_ms, refund_reason, user. At most 92 days and 200,000 rows per file.'
      tags:
      - Sessions
      security:
      - adminKey: []
      parameters:
      - name: from
        in: query
        description: YYYY-MM-DD (UTC, inclusive) or Unix milliseconds. 30 days before `to` unless set.
        schema:
          type: string
      - name: to
        in: query
        description: YYYY-MM-DD (UTC, the whole day included) or Unix milliseconds. Now unless set.
        schema:
          type: string
      - name: key_id
        in: query
        description: Only this key's requests.
        schema:
          type: string
      - name: model
        in: query
        description: Only requests for this model id.
        schema:
          type: string
      - name: status
        in: query
        description: Only this outcome, or `failed` for upstream_error and upstream_rejected together.
        schema:
          type: string
          enum:
          - completed
          - client_disconnected
          - upstream_error
          - upstream_rejected
          - cache_hit
          - failed
      - name: user
        in: query
        description: Only this end user's requests (x-customer-id, else the `user` field).
        schema:
          type: string
      responses:
        '200':
          description: The CSV file.
          content:
            text/csv:
              schema:
                type: string
        '400':
          description: 'invalid_request: from is not before to, or the range is over 92 days.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    SessionStep:
      type: object
      required:
      - request_id
      - started_at
      - ended_at
      - key_id
      - model
      - outcome
      - status
      - input_tokens
      - cache_read_tokens
      - cache_write_tokens
      - output_tokens
      - charge_micro
      - cost_usd
      - latency_ms
      properties:
        request_id:
          type: string
        started_at:
          type: integer
        ended_at:
          type: integer
        key_id:
          type: string
        model:
          type: string
        outcome:
          type: string
          enum:
          - completed
          - client_disconnected
          - upstream_error
          - upstream_rejected
        status:
          type: integer
        input_tokens:
          type: integer
        cache_read_tokens:
          type: integer
        cache_write_tokens:
          type: integer
        output_tokens:
          type: integer
        charge_micro:
          type: integer
        cost_usd:
          type: number
        latency_ms:
          type: integer
        refund_reason:
          type:
          - string
          - 'null'
        tool_calls:
          type:
          - integer
          - 'null'
          description: Server tool calls (web search, fetch, MCP, sandbox) whose results this request carried; null for none.
    SessionEnvelope:
      type: object
      required:
      - data
      properties:
        data:
          type: object
          required:
          - id
          - first_at
          - last_at
          - duration_ms
          - models
          - totals
          - truncated
          - steps
          properties:
            id:
              type: string
            first_at:
              type:
              - integer
              - 'null'
            last_at:
              type:
              - integer
              - 'null'
            duration_ms:
              type: integer
            models:
              type: array
              items:
                type: string
            totals:
              type: object
              properties:
                requests:
                  type: integer
                input_tokens:
                  type: integer
                output_tokens:
                  type: integer
                charge_micro:
                  type: integer
                cost_usd:
                  type: number
                errors:
                  type: integer
                latency_ms:
                  type: integer
            truncated:
              type: boolean
              description: True when the session has more than 1,000 requests and only the latest 1,000 are shown.
            steps:
              type: array
              items:
                $ref: '#/components/schemas/SessionStep'
    Error:
      type: object
      description: The error envelope on OpenAI-format routes and on every route outside the chat formats.
      required:
      - error
      properties:
        error:
          type: object
          required:
          - message
          - type
          - code
          properties:
            message:
              type: string
              description: What went wrong, in plain words. Never names a host.
            type:
              type: string
              description: 'OpenAI''s error class for the status: invalid_request_error, authentication_error, insufficient_quota, permission_error, not_found_error, rate_limit_error or api_error.'
            param:
              type:
              - string
              - 'null'
              description: Always null.
            code:
              type: string
              description: 'A stable code, the ones named on each response: invalid_request, invalid_api_key, insufficient_balance, model_not_found, rate_limited, upstream_error and so on.'
    SessionList:
      type: object
      required:
      - data
      - days
      - has_more
      - next_before
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Session'
        days:
          type: integer
        has_more:
          type: boolean
        next_before:
          type:
          - integer
          - 'null'
    Session:
      type: object
      required:
      - id
      - requests
      - first_at
      - last_at
      - duration_ms
      - charge_micro
      - cost_usd
      - input_tokens
      - output_tokens
      - errors
      - models
      - key_ids
      properties:
        id:
          type: string
        requests:
          type: integer
        first_at:
          type: integer
          description: 'Unix milliseconds: when the first request started.'
        last_at:
          type: integer
          description: 'Unix milliseconds: when the last request ended.'
        duration_ms:
          type: integer
        charge_micro:
          type: integer
          description: Micro-dollars charged.
        cost_usd:
          type: number
        input_tokens:
          type: integer
          description: Billed prompt tokens, cached reads and writes included.
        output_tokens:
          type: integer
        errors:
          type: integer
          description: Requests the model failed or refused; never charged.
        models:
          type: array
          items:
            type: string
        key_ids:
          type: array
          items:
            type: string
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: '`Authorization: Bearer sk-msg-live-...`. The OpenAI SDK sends this.'
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: The same key in `x-api-key`, as the Anthropic SDK sends it. On GET /v1/models it selects Anthropic's list shape.
    googleApiKey:
      type: apiKey
      in: header
      name: x-goog-api-key
      description: The same key in `x-goog-api-key`, as the Gemini SDK sends it. On GET /v1/models it selects Google's list shape.
    adminKey:
      type: http
      scheme: bearer
      description: 'An admin key, created in the console: `Authorization: Bearer sk-msg-live-...`. It manages keys (/v1/keys) and log exports (/v1/exports), reads sessions and the usage CSV, and cannot call models.'