Mensageiro Batch API

Batch API: upload a JSONL file of requests, run it within 24 hours, download the answers.

GitHub OpenAPI

Operations 9

POST /v1/files Upload a batch input file #
GET /v1/files List the organization's files #
GET /v1/files/{file_id} A batch file #
DELETE /v1/files/{file_id} Delete a batch file #
GET /v1/files/{file_id}/content A batch file's content #
POST /v1/batches Create a batch #
GET /v1/batches List the organization's batches #
GET /v1/batches/{batch_id} A batch and its request counts #
POST /v1/batches/{batch_id}/cancel Cancel a batch #

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-batch-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-batch-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Mensageiro Batch 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: Batch
  description: 'Batch API: upload a JSONL file of requests, run it within 24 hours, download the answers.'
paths:
  /v1/files:
    post:
      operationId: createFile
      summary: Upload a batch input file
      description: 'Multipart `file` (JSONL, 50 MB and 50,000 lines at most) with `purpose` batch. Each line: `{ custom_id, method: "POST", url, body }`, url one of /v1/chat/completions, /v1/completions, /v1/embeddings, /v1/responses, /v1/moderations, custom_id unique. Every line is checked on upload; the first bad one is named. Kept 30 days.'
      tags:
      - Batch
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
              - file
              - purpose
              properties:
                file:
                  type: string
                  format: binary
                purpose:
                  type: string
                  enum:
                  - batch
      responses:
        '200':
          description: The file.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchFile'
        '400':
          description: 'invalid_request: purpose is not batch, no file, or a line that is not a valid batch request (named by number).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: invalid_api_key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: 'invalid_request: the file is over 50 MB.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    get:
      operationId: listFiles
      summary: List the organization's files
      description: Batch input files and the output and error files batches wrote, newest first. `purpose` filters (batch, batch_output); `limit` up to 10,000, default 100.
      tags:
      - Batch
      responses:
        '200':
          description: The files.
          content:
            application/json:
              schema:
                type: object
                required:
                - object
                - data
                - has_more
                properties:
                  object:
                    const: list
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/BatchFile'
                  has_more:
                    type: boolean
        '401':
          description: invalid_api_key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/files/{file_id}:
    get:
      operationId: retrieveFile
      summary: A batch file
      tags:
      - Batch
      parameters:
      - $ref: '#/components/parameters/file_id'
      responses:
        '200':
          description: The file.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchFile'
        '401':
          description: invalid_api_key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: 'not_found: no such file in this organization.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: deleteFile
      summary: Delete a batch file
      tags:
      - Batch
      parameters:
      - $ref: '#/components/parameters/file_id'
      responses:
        '200':
          description: Deleted.
          content:
            application/json:
              schema:
                type: object
                required:
                - id
                - object
                - deleted
                properties:
                  id:
                    type: string
                  object:
                    const: file
                  deleted:
                    const: true
        '401':
          description: invalid_api_key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: 'not_found: no such file in this organization.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/files/{file_id}/content:
    get:
      operationId: downloadFile
      summary: A batch file's content
      description: 'The JSONL as uploaded, or a batch''s output or error file: one line per request, `{ id, custom_id, response: { status_code, request_id, body }, error }`.'
      tags:
      - Batch
      parameters:
      - $ref: '#/components/parameters/file_id'
      responses:
        '200':
          description: JSONL.
          content:
            application/jsonl:
              schema:
                type: string
        '401':
          description: invalid_api_key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: 'not_found: no such file in this organization.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/batches:
    post:
      operationId: createBatch
      summary: Create a batch
      description: 'Runs every line of an uploaded file within 24 hours, through the same routes as a direct request with the key that creates the batch: priced at the catalog rates less the batch discount of 50% on every line (the receipt and the usage log show the discounted charge), held against the balance, the key''s budget and limits as each line runs. Lines run a few at a time per organization. Answers 2xx go to the output file, the rest to the error file; lines not run by the end of the window go to the error file with code batch_expired.'
      tags:
      - Batch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - input_file_id
              - endpoint
              - completion_window
              properties:
                input_file_id:
                  type: string
                  description: A file uploaded with purpose batch.
                endpoint:
                  type: string
                  enum:
                  - /v1/chat/completions
                  - /v1/completions
                  - /v1/embeddings
                  - /v1/responses
                  - /v1/moderations
                  description: Every line's url must match.
                completion_window:
                  type: string
                  enum:
                  - 24h
                metadata:
                  type: object
                  description: Up to 16 string values, returned with the batch.
                  additionalProperties:
                    type: string
      responses:
        '200':
          description: The batch, in progress.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Batch'
        '400':
          description: 'invalid_request: an unknown endpoint, a completion_window other than 24h, or a line whose url is not the batch''s endpoint.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: invalid_api_key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: 'not_found: no such input file in this organization.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    get:
      operationId: listBatches
      summary: List the organization's batches
      description: Newest first. `limit` up to 100 (default 20); `after` a batch id to page on from.
      tags:
      - Batch
      responses:
        '200':
          description: The batches.
          content:
            application/json:
              schema:
                type: object
                required:
                - object
                - data
                - has_more
                properties:
                  object:
                    const: list
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Batch'
                  first_id:
                    type:
                    - string
                    - 'null'
                  last_id:
                    type:
                    - string
                    - 'null'
                  has_more:
                    type: boolean
        '401':
          description: invalid_api_key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/batches/{batch_id}:
    get:
      operationId: retrieveBatch
      summary: A batch and its request counts
      tags:
      - Batch
      parameters:
      - $ref: '#/components/parameters/batch_id'
      responses:
        '200':
          description: The batch.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Batch'
        '401':
          description: invalid_api_key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: 'not_found: no such batch in this organization.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/batches/{batch_id}/cancel:
    post:
      operationId: cancelBatch
      summary: Cancel a batch
      description: Lines not started are left out; lines already answered stay in the output file. The batch is cancelling until its running lines finish, then cancelled.
      tags:
      - Batch
      parameters:
      - $ref: '#/components/parameters/batch_id'
      responses:
        '200':
          description: The batch, cancelling or cancelled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Batch'
        '401':
          description: invalid_api_key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: 'not_found: no such batch in this organization.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: 'batch_not_cancellable: the batch already finished.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    batch_id:
      name: batch_id
      in: path
      required: true
      schema:
        type: string
        pattern: ^batch_[0-9a-f]{24}$
    file_id:
      name: file_id
      in: path
      required: true
      description: A batch file's id.
      schema:
        type: string
        pattern: ^file-[0-9a-f]{24}$
  schemas:
    Batch:
      type: object
      required:
      - id
      - object
      - endpoint
      - input_file_id
      - completion_window
      - status
      - created_at
      - expires_at
      - request_counts
      properties:
        id:
          type: string
          pattern: ^batch_[0-9a-f]{24}$
        object:
          const: batch
        endpoint:
          type: string
        errors:
          oneOf:
          - type: object
          - type: 'null'
        input_file_id:
          type: string
        completion_window:
          const: 24h
        status:
          type: string
          enum:
          - validating
          - failed
          - in_progress
          - finalizing
          - completed
          - expired
          - cancelling
          - cancelled
        output_file_id:
          type:
          - string
          - 'null'
          description: Set once the batch finishes, when any line answered 2xx.
        error_file_id:
          type:
          - string
          - 'null'
          description: Set once the batch finishes, when any line failed or expired.
        created_at:
          type: integer
        in_progress_at:
          type:
          - integer
          - 'null'
        expires_at:
          type: integer
        finalizing_at:
          type:
          - integer
          - 'null'
        completed_at:
          type:
          - integer
          - 'null'
        failed_at:
          type:
          - integer
          - 'null'
        expired_at:
          type:
          - integer
          - 'null'
        cancelling_at:
          type:
          - integer
          - 'null'
        cancelled_at:
          type:
          - integer
          - 'null'
        request_counts:
          type: object
          required:
          - total
          - completed
          - failed
          properties:
            total:
              type: integer
            completed:
              type: integer
            failed:
              type: integer
        metadata:
          oneOf:
          - type: object
          - type: 'null'
    BatchFile:
      type: object
      required:
      - id
      - object
      - bytes
      - created_at
      - filename
      - purpose
      properties:
        id:
          type: string
          pattern: ^file-[0-9a-f]{24}$
        object:
          const: file
        bytes:
          type: integer
        created_at:
          type: integer
          description: Unix seconds.
        expires_at:
          type: integer
          description: 'Unix seconds: 30 days after upload.'
        filename:
          type: string
        purpose:
          type: string
          enum:
          - batch
          - batch_output
        status:
          const: processed
    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.'
  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.'