> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runloop.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# [Beta] Publish an event to an axon.

> [Beta] Publish an event to a specified axon.



## OpenAPI

````yaml /openapi-specs/stainless-processed-openapi.json post /v1/axons/{id}/publish
openapi: 3.1.0
info:
  title: RunLoop API
  version: '0.1'
  description: >-
    The RunLoop API spec that allows you to host lambda functions and Devboxes
    to enable scaled long running ai workflows.
  contact:
    name: Runloop AI Support
    url: https://runloop.ai
    email: support@runloop.ai
servers:
  - url: https://api.runloop.ai
    description: Runloop API
    variables: {}
security:
  - bearerAuth: []
tags:
  - name: Benchmark
  - name: Blueprint
  - name: Blueprint-Lifecycle
  - name: Blueprint-ObservabilityTools
  - name: Devbox
  - name: Devbox-FileTools
  - name: Devbox-Lifecycle
  - name: Devbox-NetworkTools
  - name: Devbox-ObservabilityTools
  - name: Devbox-PersistenceTools
  - name: Devbox-ShellTools
  - name: Scenario
  - name: ScenarioScorer
  - name: accounts
  - name: agents
  - name: apikeys
  - name: axons
  - name: executions
  - name: gateway-configs
  - name: mcp-configs
  - name: network-policies
  - name: objects
  - name: restricted_keys
  - name: secrets
  - name: streaming
paths:
  /v1/axons/{id}/publish:
    post:
      tags:
        - axons
      summary: '[Beta] Publish an event to an axon.'
      description: '[Beta] Publish an event to a specified axon.'
      operationId: publishToAxon
      parameters:
        - name: id
          in: path
          description: The axon identifier.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublishParams'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublishResultView'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Runloop from '@runloop/api-client';

            const client = new Runloop({
              bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
            });

            const publishResultView = await client.axons.publish('id', {
              event_type: 'event_type',
              origin: 'EXTERNAL_EVENT',
              payload: 'payload',
              source: 'source',
            });

            console.log(publishResultView.sequence);
        - lang: Python
          source: |-
            import os
            from runloop_api_client import Runloop

            client = Runloop(
                bearer_token=os.environ.get("RUNLOOP_API_KEY"),  # This is the default and can be omitted
            )
            publish_result_view = client.axons.publish(
                id="id",
                event_type="event_type",
                origin="EXTERNAL_EVENT",
                payload="payload",
                source="source",
            )
            print(publish_result_view.sequence)
components:
  schemas:
    PublishParams:
      type: object
      properties:
        source:
          type: string
          description: The source of the event (e.g. github, slack).
        event_type:
          type: string
          description: The event type (e.g. push, pull_request).
        origin:
          $ref: '#/components/schemas/PublishEventOrigin'
          description: Event origin.
        payload:
          type: string
          description: Event payload.
      required:
        - source
        - event_type
        - origin
        - payload
    PublishResultView:
      type: object
      properties:
        sequence:
          type: integer
          format: int64
          description: Assigned sequence number.
        timestamp_ms:
          type: integer
          format: int64
          description: Timestamp in milliseconds since epoch.
      required:
        - sequence
        - timestamp_ms
    PublishEventOrigin:
      type: string
      enum:
        - EXTERNAL_EVENT
        - AGENT_EVENT
        - USER_EVENT
      description: Allowed event origins for publish requests.
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````