---
title: "Save AI Actions config"
method: POST
path: "/api/{projectId}/ai-actions/{actionId}"
tags: ["Projects"]
---

# Save AI Actions config

`POST /api/{projectId}/ai-actions/{actionId}`

## Request

- Base URL: `https://studio.edgeimpulse.com/v1`
- URL: `https://studio.edgeimpulse.com/v1/api/{projectId}/ai-actions/{actionId}`
- Auth: one of:
  - API key in header `x-api-key`
  - API key in cookie `jwt`
  - API key in header `x-jwt-token`
  - OAuth 2
    - Authorization code: `/v1/oauth/authorize`
    - Client credentials
    - Implicit: `/v1/oauth/authorize`
    - Password
    - Token URL: `/v1/oauth/token`
- TypeScript: <https://skmtc.dev/edgeimpulse/apis/edge-impulse-api/docs/api/:projectId/ai-actions/:actionId/post.ts> (a function with typed inputs; its response is checked against the schema)

Store an AI Actions config. Use `createAIActionsJob` to run the job. Post the full AI Action here w/ all parameters.

## Path parameters

- `projectId` integer, required
- `actionId` integer, required

## Request body

- UpdateAIActionRequest
  - `name` string: User-provided name. If no name is set then displayName on the action will be automatically configured based on the transformation block.
  - `steps` AIActionsConfigStep[], required
    - `transformationBlockId` integer, required: The selected transformation block ID.
    - `parameters` object, required: Parameters for the transformation block. These map back to the parameters in OrganizationTransformationBlock 'parameters' property.
  - `dataCategory` 'allData' | 'unlabeledData' | 'enabledData' | 'dataWithoutMetadataKey' | 'dataWithMetadata', required
  - `dataMetadataKey` string: Metadata key to filter on. Required if dataCategory is equal to "dataWithoutMetadataKey" or "dataWithMetadata".
  - `dataMetadataValue` string: Metadata value to filter on. Required if dataCategory is equal to "dataWithMetadata".
  - `setMetadataAfterRunning` object[], required: After the action runs, add this key/value pair as metadata on the affected samples.
    - `key` string, required
    - `value` string, required
  - `sortOrder` integer: Numeric value (1..n) where this action should be shown in the action list (and in which order the actions should run when started from a data source).

## Response `200`

OK

- GenericApiResponse
  - `success` boolean, required: Whether the operation succeeded
  - `error` string: Optional error description (set if 'success' was false)

---

[API](https://skmtc.dev/edgeimpulse/apis/edge-impulse-api.md) - [All operations](https://skmtc.dev/edgeimpulse/apis/edge-impulse-api/llms.txt) - [OpenAPI document](https://skmtc.dev/edgeimpulse/apis/edge-impulse-api/revisions/e2a976d38427?raw)
