Portkey · Capability

Portkey API — Batch

Portkey API — Batch. 5 operations. Lead operation: Creates and executes a batch from an uploaded file of requests. Self-contained Naftiko capability covering one Portkey business surface.

Run with Naftiko PortkeyBatch

What You Can Do

POST
Createbatch — Creates and executes a batch from an uploaded file of requests
/v1/batches
GET
Listbatches — List your organization's batches.
/v1/batches
GET
Retrievebatch — Retrieves a batch.
/v1/batches/{batch-id}
POST
Cancelbatch — Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file.
/v1/batches/{batch-id}/cancel
GET
Getbatchoutput — Returns batch output as stream.
/v1/batches/{batch-id}/output

MCP Tools

creates-and-executes-batch-uploaded

Creates and executes a batch from an uploaded file of requests

list-your-organization-s-batches

List your organization's batches.

read-only idempotent
retrieves-batch

Retrieves a batch.

read-only idempotent
cancels-progress-batch-batch-will

Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file.

returns-batch-output-stream

Returns batch output as stream.

read-only idempotent

Capability Spec

portkey-batch.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Portkey API — Batch
  description: 'Portkey API — Batch. 5 operations. Lead operation: Creates and executes a batch from an uploaded file of requests.
    Self-contained Naftiko capability covering one Portkey business surface.'
  tags:
  - Portkey
  - Batch
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    PORTKEY_API_KEY: PORTKEY_API_KEY
capability:
  consumes:
  - type: http
    namespace: portkey-batch
    baseUri: https://api.portkey.ai/v1
    description: Portkey API — Batch business capability. Self-contained, no shared references.
    resources:
    - name: batches
      path: /batches
      operations:
      - name: createbatch
        method: POST
        description: Creates and executes a batch from an uploaded file of requests
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
      - name: listbatches
        method: GET
        description: List your organization's batches.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: after
          in: query
          type: string
          description: A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance,
            if you make a list request and receive 100 objects, e
        - name: limit
          in: query
          type: integer
          description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default
            is 20.
    - name: batches-batch_id
      path: /batches/{batch_id}
      operations:
      - name: retrievebatch
        method: GET
        description: Retrieves a batch.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: batch_id
          in: path
          type: string
          description: The ID of the batch to retrieve.
          required: true
    - name: batches-batch_id-cancel
      path: /batches/{batch_id}/cancel
      operations:
      - name: cancelbatch
        method: POST
        description: Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing
          to `cancelled`, where it will have partial results (if any) available in the output file.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: batch_id
          in: path
          type: string
          description: The ID of the batch to cancel.
          required: true
    - name: batches-batch_id-output
      path: /batches/{batch_id}/output
      operations:
      - name: getbatchoutput
        method: GET
        description: Returns batch output as stream.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: batch_id
          in: path
          type: string
          description: The ID of the batch to retrieve output for.
          required: true
    authentication:
      type: bearer
      token: '{{env.PORTKEY_API_KEY}}'
  exposes:
  - type: rest
    namespace: portkey-batch-rest
    port: 8080
    description: REST adapter for Portkey API — Batch. One Spectral-compliant resource per consumed operation, prefixed with
      /v1.
    resources:
    - path: /v1/batches
      name: batches
      description: REST surface for batches.
      operations:
      - method: POST
        name: createbatch
        description: Creates and executes a batch from an uploaded file of requests
        call: portkey-batch.createbatch
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
      - method: GET
        name: listbatches
        description: List your organization's batches.
        call: portkey-batch.listbatches
        with:
          after: rest.after
          limit: rest.limit
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/batches/{batch-id}
      name: batches-batch-id
      description: REST surface for batches-batch_id.
      operations:
      - method: GET
        name: retrievebatch
        description: Retrieves a batch.
        call: portkey-batch.retrievebatch
        with:
          batch_id: rest.batch_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/batches/{batch-id}/cancel
      name: batches-batch-id-cancel
      description: REST surface for batches-batch_id-cancel.
      operations:
      - method: POST
        name: cancelbatch
        description: Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing
          to `cancelled`, where it will have partial results (if any) available in the output file.
        call: portkey-batch.cancelbatch
        with:
          batch_id: rest.batch_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/batches/{batch-id}/output
      name: batches-batch-id-output
      description: REST surface for batches-batch_id-output.
      operations:
      - method: GET
        name: getbatchoutput
        description: Returns batch output as stream.
        call: portkey-batch.getbatchoutput
        with:
          batch_id: rest.batch_id
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: portkey-batch-mcp
    port: 9090
    transport: http
    description: MCP adapter for Portkey API — Batch. One tool per consumed operation, routed inline through this capability's
      consumes block.
    tools:
    - name: creates-and-executes-batch-uploaded
      description: Creates and executes a batch from an uploaded file of requests
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: portkey-batch.createbatch
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: list-your-organization-s-batches
      description: List your organization's batches.
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: portkey-batch.listbatches
      with:
        after: tools.after
        limit: tools.limit
      outputParameters:
      - type: object
        mapping: $.
    - name: retrieves-batch
      description: Retrieves a batch.
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: portkey-batch.retrievebatch
      with:
        batch_id: tools.batch_id
      outputParameters:
      - type: object
        mapping: $.
    - name: cancels-progress-batch-batch-will
      description: Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing
        to `cancelled`, where it will have partial results (if any) available in the output file.
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: portkey-batch.cancelbatch
      with:
        batch_id: tools.batch_id
      outputParameters:
      - type: object
        mapping: $.
    - name: returns-batch-output-stream
      description: Returns batch output as stream.
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: portkey-batch.getbatchoutput
      with:
        batch_id: tools.batch_id
      outputParameters:
      - type: object
        mapping: $.