Speakeasy · Capability

Speakeasy API — CodeSamples

Speakeasy API — CodeSamples. 4 operations. Lead operation: Retrieve Usage Snippets. Self-contained Naftiko capability covering one Speakeasy business surface.

Run with Naftiko SpeakeasyCodeSamples

What You Can Do

GET
Getcodesamples — Retrieve Usage Snippets
/v1/v1/code-sample
POST
Generatecodesamplepreview — Generate Code Sample Previews from a File and Configuration Parameters
/v1/v1/code-sample/preview
POST
Generatecodesamplepreviewasync — Initiate Asynchronous Code Sample Preview Generation from a File and Configuration Parameters, Receiving an Async JobID Response for Polling
/v1/v1/code-sample/preview/async
GET
Getcodesamplepreviewasync — Poll for the Result of an Asynchronous Code Sample Preview Generation
/v1/v1/code-sample/preview/async/{jobid}

MCP Tools

retrieve-usage-snippets

Retrieve Usage Snippets

read-only idempotent
generate-code-sample-previews-file

Generate Code Sample Previews from a File and Configuration Parameters

initiate-asynchronous-code-sample-preview

Initiate Asynchronous Code Sample Preview Generation from a File and Configuration Parameters, Receiving an Async JobID Response for Polling

poll-result-asynchronous-code-sample

Poll for the Result of an Asynchronous Code Sample Preview Generation

read-only idempotent

Capability Spec

speakeasy-codesamples.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Speakeasy API — CodeSamples
  description: 'Speakeasy API — CodeSamples. 4 operations. Lead operation: Retrieve Usage Snippets. Self-contained Naftiko
    capability covering one Speakeasy business surface.'
  tags:
  - Speakeasy
  - CodeSamples
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    SPEAKEASY_API_KEY: SPEAKEASY_API_KEY
capability:
  consumes:
  - type: http
    namespace: speakeasy-codesamples
    baseUri: https://api.prod.speakeasy.com
    description: Speakeasy API — CodeSamples business capability. Self-contained, no shared references.
    resources:
    - name: v1-code_sample
      path: /v1/code_sample
      operations:
      - name: getcodesamples
        method: GET
        description: Retrieve Usage Snippets
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: registry_url
          in: query
          type: string
          description: The registry URL from which to retrieve the snippets.
          required: true
        - name: operation_ids
          in: query
          type: array
          description: The operation IDs to retrieve snippets for.
        - name: method_paths
          in: query
          type: array
          description: The method paths to retrieve snippets for.
        - name: languages
          in: query
          type: array
          description: The languages to retrieve snippets for.
    - name: v1-code_sample-preview
      path: /v1/code_sample/preview
      operations:
      - name: generatecodesamplepreview
        method: POST
        description: Generate Code Sample Previews from a File and Configuration Parameters
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-code_sample-preview-async
      path: /v1/code_sample/preview/async
      operations:
      - name: generatecodesamplepreviewasync
        method: POST
        description: Initiate Asynchronous Code Sample Preview Generation from a File and Configuration Parameters, Receiving
          an Async JobID Response for Polling
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-code_sample-preview-async-jobID
      path: /v1/code_sample/preview/async/{jobID}
      operations:
      - name: getcodesamplepreviewasync
        method: GET
        description: Poll for the Result of an Asynchronous Code Sample Preview Generation
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: jobID
          in: path
          type: string
          description: The ID of the job to check the status and retrieve results
          required: true
    authentication:
      type: bearer
      token: '{{env.SPEAKEASY_API_KEY}}'
  exposes:
  - type: rest
    namespace: speakeasy-codesamples-rest
    port: 8080
    description: REST adapter for Speakeasy API — CodeSamples. One Spectral-compliant resource per consumed operation, prefixed
      with /v1.
    resources:
    - path: /v1/v1/code-sample
      name: v1-code-sample
      description: REST surface for v1-code_sample.
      operations:
      - method: GET
        name: getcodesamples
        description: Retrieve Usage Snippets
        call: speakeasy-codesamples.getcodesamples
        with:
          registry_url: rest.registry_url
          operation_ids: rest.operation_ids
          method_paths: rest.method_paths
          languages: rest.languages
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/code-sample/preview
      name: v1-code-sample-preview
      description: REST surface for v1-code_sample-preview.
      operations:
      - method: POST
        name: generatecodesamplepreview
        description: Generate Code Sample Previews from a File and Configuration Parameters
        call: speakeasy-codesamples.generatecodesamplepreview
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/code-sample/preview/async
      name: v1-code-sample-preview-async
      description: REST surface for v1-code_sample-preview-async.
      operations:
      - method: POST
        name: generatecodesamplepreviewasync
        description: Initiate Asynchronous Code Sample Preview Generation from a File and Configuration Parameters, Receiving
          an Async JobID Response for Polling
        call: speakeasy-codesamples.generatecodesamplepreviewasync
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/code-sample/preview/async/{jobid}
      name: v1-code-sample-preview-async-jobid
      description: REST surface for v1-code_sample-preview-async-jobID.
      operations:
      - method: GET
        name: getcodesamplepreviewasync
        description: Poll for the Result of an Asynchronous Code Sample Preview Generation
        call: speakeasy-codesamples.getcodesamplepreviewasync
        with:
          jobID: rest.jobID
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: speakeasy-codesamples-mcp
    port: 9090
    transport: http
    description: MCP adapter for Speakeasy API — CodeSamples. One tool per consumed operation, routed inline through this
      capability's consumes block.
    tools:
    - name: retrieve-usage-snippets
      description: Retrieve Usage Snippets
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: speakeasy-codesamples.getcodesamples
      with:
        registry_url: tools.registry_url
        operation_ids: tools.operation_ids
        method_paths: tools.method_paths
        languages: tools.languages
      outputParameters:
      - type: object
        mapping: $.
    - name: generate-code-sample-previews-file
      description: Generate Code Sample Previews from a File and Configuration Parameters
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: speakeasy-codesamples.generatecodesamplepreview
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: initiate-asynchronous-code-sample-preview
      description: Initiate Asynchronous Code Sample Preview Generation from a File and Configuration Parameters, Receiving
        an Async JobID Response for Polling
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: speakeasy-codesamples.generatecodesamplepreviewasync
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: poll-result-asynchronous-code-sample
      description: Poll for the Result of an Asynchronous Code Sample Preview Generation
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: speakeasy-codesamples.getcodesamplepreviewasync
      with:
        jobID: tools.jobID
      outputParameters:
      - type: object
        mapping: $.