POST
/
api
/
v1
/
external-functions
curl --request POST \
  --url https://api.play.ai/api/v1/external-functions \
  --header 'AUTHORIZATION: <api-key>' \
  --header 'X-USER-ID: <api-key>' \
  --header 'content-type: <content-type>' \
  --data '{
  "name": "My External Function",
  "description": "My external function is the best external function",
  "endpointUrl": "https://my.external.function.example.com/api/v1/external-function",
  "method": "GET",
  "parameters": [
    {
      "type": "number",
      "name": "MyExternalFunctionParameter",
      "description": "My external function parameter is the best external function parameter",
      "id": "MyExternalFunctionParameterId",
      "parameterPosition": "body"
    }
  ]
}'

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 endpoint.

Authorizations

AUTHORIZATION
string
header
required

API key required for this endpoint. Use Bearer YOUR_SECRET_API_KEY. Get your key from https://play.ai/developers.

X-USER-ID
string
header
required

User ID required for this endpoint. Get it from https://play.ai/developers.

Headers

content-type
enum<string>
required
Available options:
application/json
accept
enum<string>
Available options:
application/json

Body

application/json
name
any
required
description
any
required
endpointUrl
any
required
method
any
required
parameters
any

Response

201

External function created.