Portkey · Capability

Portkey API — Files

Portkey API — Files. 5 operations. Lead operation: List Files. Self-contained Naftiko capability covering one Portkey business surface.

Run with Naftiko PortkeyFiles

What You Can Do

GET
Listfiles — List Files
/v1/files
POST
Createfile — Upload a file to be used across various endpoints, such as Assistant (<2M tokens), Fine-Tuning, and Batch (<100 MB). Total size of your bucket is 100 GB.
/v1/files
DELETE
Deletefile — Delete File
/v1/files/{file-id}
GET
Retrievefile — Returns information about a specific file.
/v1/files/{file-id}
GET
Downloadfile — Returns the contents of the specified file.
/v1/files/{file-id}/content

MCP Tools

list-files

List Files

read-only idempotent
upload-file-be-used-across

Upload a file to be used across various endpoints, such as Assistant (<2M tokens), Fine-Tuning, and Batch (<100 MB). Total size of your bucket is 100 GB.

delete-file

Delete File

idempotent
returns-information-about-specific-file

Returns information about a specific file.

read-only idempotent
returns-contents-specified-file

Returns the contents of the specified file.

read-only idempotent

Capability Spec

portkey-files.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Portkey API — Files
  description: 'Portkey API — Files. 5 operations. Lead operation: List Files. Self-contained Naftiko capability covering
    one Portkey business surface.'
  tags:
  - Portkey
  - Files
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    PORTKEY_API_KEY: PORTKEY_API_KEY
capability:
  consumes:
  - type: http
    namespace: portkey-files
    baseUri: https://api.portkey.ai/v1
    description: Portkey API — Files business capability. Self-contained, no shared references.
    resources:
    - name: files
      path: /files
      operations:
      - name: listfiles
        method: GET
        description: List Files
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: purpose
          in: query
          type: string
          description: Only return files with the given purpose.
      - name: createfile
        method: POST
        description: Upload a file to be used across various endpoints, such as Assistant (<2M tokens), Fine-Tuning, and Batch
          (<100 MB). Total size of your bucket is 100 GB.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: files-file_id
      path: /files/{file_id}
      operations:
      - name: deletefile
        method: DELETE
        description: Delete File
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: file_id
          in: path
          type: string
          description: The ID of the file to use for this request.
          required: true
      - name: retrievefile
        method: GET
        description: Returns information about a specific file.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: file_id
          in: path
          type: string
          description: The ID of the file to use for this request.
          required: true
    - name: files-file_id-content
      path: /files/{file_id}/content
      operations:
      - name: downloadfile
        method: GET
        description: Returns the contents of the specified file.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: file_id
          in: path
          type: string
          description: The ID of the file to use for this request.
          required: true
    authentication:
      type: bearer
      token: '{{env.PORTKEY_API_KEY}}'
  exposes:
  - type: rest
    namespace: portkey-files-rest
    port: 8080
    description: REST adapter for Portkey API — Files. One Spectral-compliant resource per consumed operation, prefixed with
      /v1.
    resources:
    - path: /v1/files
      name: files
      description: REST surface for files.
      operations:
      - method: GET
        name: listfiles
        description: List Files
        call: portkey-files.listfiles
        with:
          purpose: rest.purpose
        outputParameters:
        - type: object
          mapping: $.
      - method: POST
        name: createfile
        description: Upload a file to be used across various endpoints, such as Assistant (<2M tokens), Fine-Tuning, and Batch
          (<100 MB). Total size of your bucket is 100 GB.
        call: portkey-files.createfile
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/files/{file-id}
      name: files-file-id
      description: REST surface for files-file_id.
      operations:
      - method: DELETE
        name: deletefile
        description: Delete File
        call: portkey-files.deletefile
        with:
          file_id: rest.file_id
        outputParameters:
        - type: object
          mapping: $.
      - method: GET
        name: retrievefile
        description: Returns information about a specific file.
        call: portkey-files.retrievefile
        with:
          file_id: rest.file_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/files/{file-id}/content
      name: files-file-id-content
      description: REST surface for files-file_id-content.
      operations:
      - method: GET
        name: downloadfile
        description: Returns the contents of the specified file.
        call: portkey-files.downloadfile
        with:
          file_id: rest.file_id
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: portkey-files-mcp
    port: 9090
    transport: http
    description: MCP adapter for Portkey API — Files. One tool per consumed operation, routed inline through this capability's
      consumes block.
    tools:
    - name: list-files
      description: List Files
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: portkey-files.listfiles
      with:
        purpose: tools.purpose
      outputParameters:
      - type: object
        mapping: $.
    - name: upload-file-be-used-across
      description: Upload a file to be used across various endpoints, such as Assistant (<2M tokens), Fine-Tuning, and Batch
        (<100 MB). Total size of your bucket is 100 GB.
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: portkey-files.createfile
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: delete-file
      description: Delete File
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: portkey-files.deletefile
      with:
        file_id: tools.file_id
      outputParameters:
      - type: object
        mapping: $.
    - name: returns-information-about-specific-file
      description: Returns information about a specific file.
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: portkey-files.retrievefile
      with:
        file_id: tools.file_id
      outputParameters:
      - type: object
        mapping: $.
    - name: returns-contents-specified-file
      description: Returns the contents of the specified file.
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: portkey-files.downloadfile
      with:
        file_id: tools.file_id
      outputParameters:
      - type: object
        mapping: $.