Skip to content
ajan.io

Docs menu

On this page

Update Action

Update an existing action in an integration

Updates an existing action in an integration. Changing name does not change the action slug.

Base URL

https://api.ajan.io/integrations/v1/{integrationId}/actions/{actionId}

Required Scopes

This endpoint requires the INTEGRATION_API scope.

Parameters

Path Parameters

ParameterTypeRequiredDescription
integrationIdstringYesUUID of the integration
actionIdstringYesUUID of the action to update

Request Body

ParameterTypeRequiredDescription
namestringYesAction name (max 100 characters)
descriptionstringNoAction description (max 1,000 characters)
codestringNoJavaScript code to execute (max 150,000 characters)
inputFieldsarrayNoInput fields for the action
requiresConfirmationbooleanNoWhether the action requires user confirmation before running

See Create Action for the full input field schema.

Example

javascript
const axios = require("axios");

async function updateAction(integrationId, actionId) {
  const response = await axios.put(
    `https://api.ajan.io/integrations/v1/${integrationId}/actions/${actionId}`,
    {
      name: "Get User Data v2",
      description: "Updated action with additional fields",
      code: `
        const response = await ld.request({
          method: "GET",
          url: "https://api.example.com/v2/users/" + data.input.userId
        });
        return response.json;
      `,
      inputFields: [
        {
          label: "User ID",
          type: "TEXT",
          required: true
        },
        {
          label: "Format",
          type: "SELECT",
          options: [
            { label: "JSON", value: "json" },
            { label: "XML", value: "xml" }
          ],
          required: false
        }
      ]
    },
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
      }
    }
  );

  console.log("Updated action:", response.data.action);
}

updateAction("550e8400-e29b-41d4-a716-446655440000", "660e8400-e29b-41d4-a716-446655440001");

Response Format

Success Response (200 OK)

typescript
{
  action: {
    id: string;
    name: string;
    slug: string;
    description: string;
    code: string | null;
    order: number;
    requiresConfirmation: boolean;
    inputFields: Array<{
      slug: string;
      label: string;
      type: string;
      description: string;
      placeholder: string | null;
      required: boolean;
      order: number;
      options: Array<{label: string, value: string}> | null;
      allowMultiSelect: boolean | null;
      contextActionId: string | null;
      jsonSchema: string | null;
    }>;
  };
}

Error Handling

Status CodeDescription
400Invalid request body or IDs
401Invalid or missing API key
403No access to this integration
404Integration or action not found
422Unsupported integration type. Update actions only on a workspace owned API integration.
429Rate limit exceeded