Pypestream Event Handlers API

Register event callbacks

Operations 7

POST /events/onShow Register onShow handler #
POST /events/onHide Register onHide handler #
POST /events/onChatEnd Register onChatEnd handler #
POST /events/onChatRestart Register onChatRestart handler #
POST /events/onSetupComplete Register onSetupComplete handler #
POST /events/onFirstMessage Register onFirstMessage handler #
POST /events/onMount Register onMount handler #

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/pypestream-event-handlers-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

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. See our Privacy Policy and Terms.

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

OpenAPI Specification

pypestream-event-handlers-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Pypestream JavaScript SDK Event Handlers API
  description: Client-side JavaScript SDK for embedding conversational AI chat interfaces into web applications.
  version: 3.0.0
  contact:
    name: Pypestream Support
    url: https://support.pypestream.com
  license:
    name: Proprietary
    url: https://pypestream.com/terms
servers:
- url: https://api.pypestream.com/v3
  description: Production SDK API (Documentation Only)
security: []
tags:
- name: Event Handlers
  description: Register event callbacks
paths:
  /events/onShow:
    post:
      tags:
      - Event Handlers
      summary: Register onShow handler
      description: 'Registers a callback for when the chat interface is shown.


        **JavaScript Usage:**

        ```javascript

        Pypestream.onShow(() => {

        console.log(''Chat opened'');

        });

        ```'
      operationId: onShow
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventHandler'
      responses:
        '200':
          description: Handler registered successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventRegistrationResponse'
  /events/onHide:
    post:
      tags:
      - Event Handlers
      summary: Register onHide handler
      description: 'Registers a callback for when the chat interface is hidden.


        **JavaScript Usage:**

        ```javascript

        Pypestream.onHide(() => {

        console.log(''Chat closed'');

        });

        ```'
      operationId: onHide
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventHandler'
      responses:
        '200':
          description: Handler registered successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventRegistrationResponse'
  /events/onChatEnd:
    post:
      tags:
      - Event Handlers
      summary: Register onChatEnd handler
      description: 'Registers a callback for when a chat session ends.


        **JavaScript Usage:**

        ```javascript

        Pypestream.onChatEnd(() => {

        console.log(''Chat session ended'');

        });

        ```'
      operationId: onChatEnd
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventHandler'
      responses:
        '200':
          description: Handler registered successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventRegistrationResponse'
  /events/onChatRestart:
    post:
      tags:
      - Event Handlers
      summary: Register onChatRestart handler
      description: 'Registers a callback for when a chat session is restarted.


        **JavaScript Usage:**

        ```javascript

        Pypestream.onChatRestart(() => {

        console.log(''Chat restarted'');

        });

        ```'
      operationId: onChatRestart
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventHandler'
      responses:
        '200':
          description: Handler registered successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventRegistrationResponse'
  /events/onSetupComplete:
    post:
      tags:
      - Event Handlers
      summary: Register onSetupComplete handler
      description: 'Registers a callback for when initial setup completes.


        **JavaScript Usage:**

        ```javascript

        Pypestream.onSetupComplete(() => {

        console.log(''Setup complete'');

        });

        ```'
      operationId: onSetupComplete
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventHandler'
      responses:
        '200':
          description: Handler registered successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventRegistrationResponse'
  /events/onFirstMessage:
    post:
      tags:
      - Event Handlers
      summary: Register onFirstMessage handler
      description: 'Registers a callback for when the first message is received.


        **JavaScript Usage:**

        ```javascript

        Pypestream.onFirstMessage(() => {

        console.log(''First message received'');

        });

        ```'
      operationId: onFirstMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventHandler'
      responses:
        '200':
          description: Handler registered successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventRegistrationResponse'
  /events/onMount:
    post:
      tags:
      - Event Handlers
      summary: Register onMount handler
      description: 'Registers a callback for when the app iframe is mounted in the DOM.


        **JavaScript Usage:**

        ```javascript

        Pypestream.onMount(() => {

        console.log(''Iframe mounted'');

        });

        ```'
      operationId: onMount
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventHandler'
      responses:
        '200':
          description: Handler registered successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventRegistrationResponse'
components:
  schemas:
    EventRegistrationResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        eventType:
          type: string
          example: onShow
        message:
          type: string
          example: Event handler registered successfully
    EventHandler:
      type: object
      required:
      - handler
      properties:
        handler:
          type: string
          description: JavaScript function name or reference
          example: myHandlerFunction
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: 'API key for accessing Pypestream services (if applicable).

        Note: The JavaScript SDK does not require API keys for client-side usage.

        '
externalDocs:
  description: Full Pypestream Documentation
  url: https://docs.pypestream.com