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

# Create External Function

> Use this endpoint to create new external functions.

Required parameters include the external function's name and the external function's description.

After you create your agent, you can attach the external function to an agent.

To update the external functions see the [Update External Function](/api-reference/agents/endpoints/v1/external-functions/patch) endpoint.


## OpenAPI

````yaml POST /api/v1/external-functions
openapi: 3.1.0
info:
  title: PlayAI API
  version: 1.0.0
  description: |
    A single, combined OpenAPI specification that merges:
      • PlayAI Agent API
      • PlayAI PlayNote API
      • PlayAI Text-to-Speech (TTS) API
      • PlayAI Dialog Turbo API

    This file contains all endpoints, schemas, and components 
    from the four original specs. See "Merged Issues" below 
    for notes on how certain conflicts were resolved.
servers:
  - url: https://api.play.ai
security:
  - ApiKeyAuth: []
    XUserIdAuth: []
paths:
  /api/v1/external-functions:
    post:
      description: Create a new external function.
      parameters:
        - name: content-type
          in: header
          required: true
          schema:
            type: string
            enum:
              - application/json
        - name: accept
          in: header
          required: false
          schema:
            type: string
            enum:
              - application/json
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateExternalFunctionApiParams'
      responses:
        '201':
          description: External function created.
      security:
        - ApiKeyAuth: []
          XUserIdAuth: []
components:
  schemas:
    CreateExternalFunctionApiParams:
      type: object
      properties:
        name: dc2f0f7f-4497-4674-813a-e15b0d048cda
        description: 82aeff51-ee2a-49af-a313-fe71fc37f05f
        endpointUrl: ad21bffb-a4ce-4f0b-b655-7416b6b22c2e
        method: 2874ffd5-308a-49de-be91-827bad64a19e
        parameters: 1e5f3547-1beb-4741-bcfc-971bb33fe81d
      required:
        - name
        - description
        - endpointUrl
        - method
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: >
        Your secret API key from [PlayAI](https://play.ai/api/keys), formatted
        as `Bearer YOUR_SECRET_API_KEY`.
    XUserIdAuth:
      type: apiKey
      in: header
      name: X-USER-ID
      description: |
        Your unique user ID from [PlayAI](https://play.ai/api/keys).
      x-prompt: What is your PlayAI user ID?

````