---
schema_version: "1"
id: 6f0473f5e3c691082de5bfad23c2027a217556f274094ff1c3774f34a306b1b5
title: Invocable Actions for Lightning Knowledge
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/knowledge/guides/knowledge-development-rest-actions.md
canonical_url: https://developer.salesforce.com/docs/service/salesforce-knowledge-dev-guide/guide/knowledge-development-rest-actions.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 20726c0a0b3aad96c32903e9430f253ced2830ec6cf33576c286f6ac402569cc
products:
  - Salesforce Knowledge Developer Guide
  - Service Cloud Developer Content
---

# Invocable Actions for Lightning Knowledge

Actions for Lightning Knowledge can be invoked from a REST endpoint. Use these actions to manage your articles and article versions.

To learn more about how to use invocable actions, see the [Actions Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.api_action.meta/api_action/actions_intro.htm).

**important:** Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

The Assign and Publish actions are available in API version 44.0 and later. All the other actions are available in API version 45.0 and later.

Lightning Knowledge must be set up in your org. The user must have permissions to manage articles.

You can use multiple inputs to an invocable action. This technique is useful for actions that don't take lists, such as `restoreKnowledgeArticleVersion`.

## Supported REST HTTP Methods

| Action                                                                                     | URI                                                                             |
| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------- |
| [Archive Knowledge articles](#archive-knowledge-articles)                                  | `/services/data/v{XX.X}/actions/standard/archiveKnowledgeArticles`              |
| [Assign Knowledge articles](#assign-knowledge-articles)                                    | `/services/data/v{XX.X}/actions/standard/assignKnowledgeArticles`               |
| [Create draft from online Knowledge articles](#create-draft-from-online-knowledge-article) | `/services/data/v{XX.X}/actions/standard/createDraftFromOnlineKnowledgeArticle` |
| [Delete Knowledge articles](#delete-knowledge-articles)                                    | `/services/data/v{XX.X}/actions/standard/deleteKnowledgeArticles`               |
| [Publish Knowledge articles](#publish-knowledge-articles)                                  | `/services/data/v{XX.X}/actions/standard/publishKnowledgeArticles`              |
| [Restore Knowledge article version](#restore-knowledge-article-version)                    | `/services/data/v{XX.X}/actions/standard/restoreKnowledgeArticleVersion`        |
| [Retrieve Smart Link URL](#retrieve-smart-link-url)                                        | `/services/data/v{XX.X}/actions/standard/getArticleSmartLinkUrl`                |
| [Submit Knowledge article for translation](#submit-knowledge-article-for-translation)      | `/services/data/v{XX.X}/actions/standard/submitKnowledgeArticleForTranslation`  |

| Property          | Value                                         |
| ----------------- | --------------------------------------------- |
| Formats           | JSON, XML                                     |
| HTTP Methods      | GET, HEAD, POST                               |
| Authentication    | `Authorization: Bearer {token}`               |
| Other Information | [Error Response Types](#error-response-types) |

## Archive Knowledge Articles

URI: `/services/data/v{XX.X}/actions/standard/archiveKnowledgeArticles`

| Input                | Type   | Description                                        |
| -------------------- | ------ | -------------------------------------------------- |
| articleVersionIdList | string | Required. Comma-separated article version ID list. |

**Sample Input**

The following code sample archives two articles:

```apex
{
  "inputs" : [
    {
      "articleVersionIdList" : [ "ka0RM00000004VeYAI", "ka0RM00000003doYAA" ]
    }
  ]
}
```

**Sample Output**

The following code sample illustrates a response after a successful request.

```apex
[ {
  "actionName" : "archiveKnowledgeArticles",
  "errors" : null,
  "isSuccess" : true,
  "outputValues" : {
    "ka0RM00000004Ve" : "Success",
    "ka0RM00000003do" : "Success"
  }
} ]
```

The following code sample illustrates a response with one success and one failure:

```apex
[ {
  "actionName" : "archiveKnowledgeArticles",
  "errors" : null,
  "isSuccess" : false,
  "outputValues" : {
    "ka0RM00000004Ve" : "You can't perform this action. Be sure the action is valid for the current state of the article, and that you have permission to perform it.",
    "ka0RM00000003do" : "Success"
  }
} ]
```

## Assign Knowledge Articles

URI: `/services/data/v{XX.X}/actions/standard/assignKnowledgeArticles`

| Input                 | Type    | Description                                                                                      |
| --------------------- | ------- | ------------------------------------------------------------------------------------------------ |
| articleVersionIdList  | string  | Required. Comma-separated article version ID list.                                               |
| assigneeId            | ID      | Required. ID of the assigned user.                                                               |
| assignAction          | string  | Required. Assign action. Valid actions are: `ASSIGN_DRAFT_MASTER` or `ASSIGN_DRAFT_TRANSLATION`. |
| dueDate               | string  | Optional. Assigned due date.                                                                     |
| instruction           | string  | Optional. Instructions for the assignee.                                                         |
| sendEmailNotification | boolean | Optional. Indicates whether to send an email notification. Defaults to `false`.                  |

**Sample Input**

The following code sample assigns two articles for translation:

```apex
{
  "inputs" : [
    {
      "articleVersionIdList" : [ "ka0RM00000004VeYAI", "ka0RM00000003doYAA" ]
      "assigneeId" : "005RM00000AAAAAYA4",
      "assignAction" : "ASSIGN_DRAFT_TRANSLATION"
    }
  ]
}
```

**Sample Output**

The following code sample illustrates a response after a successful request.

```apex
[ {
  "actionName" : "assignKnowledgeArticles",
  "errors" : null,
  "isSuccess" : true,
  "outputValues" : {
    "ka0RM00000004Ve" : "Success",
    "ka0RM00000003do" : "Success"
  }
} ]
```

## Create Draft from Online Knowledge Article

URI: `/services/data/v{XX.X}/actions/standard/createDraftFromOnlineKnowledgeArticle`

| Input            | Type    | Description                                                                                                                                                                                                                                                                                                |
| ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action           | string  | Required. Edit action for primary language or translation articles. Valid actions are: `EDIT_AS_DRAFT_ARTICLE` or `EDIT_AS_DRAFT_TRANSLATION`.                                                                                                                                                             |
| unpublish        | boolean | Required. Indicates whether to keep the article published (`false`) or archive the published article (`true`). Use `false` to keep the current article version online and create a draft. Use `true` to archive the current online version, which removes it from the knowledge base, and creates a draft. |
| articleVersionId | string  | Article version ID. Required to create a draft from an online (published) translation. Optional to create a draft from the online primary article if the Article ID is provided.                                                                                                                           |
| articleId        | string  | Article ID. Required when creating a draft from the online (published) primary article if the Article Version ID isn't provided.                                                                                                                                                                           |

**Sample Input**

The following code sample creates a draft from a primary article and archives the original article:

```apex
{
  "inputs" : [
    {
      "action" : "EDIT_AS_DRAFT_ARTICLE",
      "unpublish" : true,
      "articleId" : "kA0RM00000004pP0AQ"
    }
  ]
}
```

**Sample Output**

The following code sample illustrates a response after a successful request.

```apex
[ {
  "actionName" : "createDraftFromOnlineKnowledgeArticle",
  "errors" : null,
  "isSuccess" : true,
  "outputValues" : {
    "kA0RM00000004pP0AQ" : "Success"
  }
} ]
```

## Delete Knowledge Articles

URI: `/services/data/v{XX.X}/actions/standard/deleteKnowledgeArticles`

| Input                | Type   | Description                                        |
| -------------------- | ------ | -------------------------------------------------- |
| articleVersionIdList | string | Required. Comma-separated article version ID list. |

**Sample Input**

The following code sample deletes two articles:

```apex
{
  "inputs" : [
    {
      "articleVersionIdList" : [ "ka0RM00000004VeYAI", "ka0RM00000003doYAA" ]
    }
  ]
}
```

**Sample Output**

The following code sample illustrates a response after a successful request.

```apex
[ {
  "actionName" : "deleteKnowledgeArticles",
  "errors" : null,
  "isSuccess" : true,
  "outputValues" : {
    "ka0RM00000004Ve" : "Success",
    "ka0RM00000003do" : "Success"
  }
} ]
```

## Publish Knowledge Articles

URI: `/services/data/v{XX.X}/actions/standard/publishKnowledgeArticles`

| Input                | Type   | Description                                                                                                                                                                                                                    |
| -------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| articleVersionIdList | string | Required. Comma-separated article version ID list.                                                                                                                                                                             |
| pubAction            | string | Required. Publish action. Valid actions are: `PUBLISH_ARTICLE` (which replaces the latest version), `PUBLISH_ARTICLE_NEW_VERSION` (which creates a new version), `SCHEDULE_ARTICLE_FOR_PUBLICATION`, or `PUBLISH_TRANSLATION`. |
| pubDate              | string | Optional. Scheduled publish date in ISO 8601 format `yyyy-MM-dd\'T\'HH:mm:ss.SSSZ`. For example, for February 8, 2023, 1:40 pm UTC+01:00 use `2023-02-08T13:40:00.000+0100`.                                                   |

**Sample Input**

The following code sample publishes two articles:

```apex
{
  "inputs" : [
    {
      "articleVersionIdList" : [ "ka0RM00000004VeYAI", "ka0RM00000003doYAA" ],
      "pubAction" : "PUBLISH_ARTICLE"
    }
  ]
}
```

**Sample Output**

The following code sample illustrates a response after a successful request.

```apex
[ {
  "actionName" : "publishKnowledgeArticles",
  "errors" : null,
  "isSuccess" : true,
  "outputValues" : {
    "ka0RM00000004Ve" : "Success",
    "ka0RM00000003do" : "Success"
  }
} ]
```

## Restore Knowledge Article Version

URI: `/services/data/v{XX.X}/actions/standard/restoreKnowledgeArticleVersion`

| Input         | Type    | Description                                                                                                  |
| ------------- | ------- | ------------------------------------------------------------------------------------------------------------ |
| action        | string  | Required. The only valid action is: RESTORE_KNOWLEDGE_ARTICLE_VERSION                                        |
| articleId     | string  | Required. Article ID.                                                                                        |
| versionNumber | integer | Optional. Version number of the archived article version to restore. Default is the latest archived version. |

**Sample Input**

The following code restores the latest archived version:

```apex
{
  "inputs" : [
    {
      "action" : "RESTORE_KNOWLEDGE_ARTICLE_VERSION",
      "articleId" : "kA0RM00000004pP0AQ"
    }
  ]
}
```

The following code restores a past archived version of a published article:

```apex
{
  "inputs" : [
    {
      "action" : "RESTORE_KNOWLEDGE_ARTICLE_VERSION",
      "versionNumber":3,
      "articleId" : "kA0RM00000004pP0AQ"
    }
  ]
}
```

The following code restores two archived articles:

```apex
{
  "inputs" : [
    {
      "action" : "RESTORE_KNOWLEDGE_ARTICLE_VERSION",
      "articleId" : "kA0RM00000004pP0AQ"
    },
    {
      "action" : "RESTORE_KNOWLEDGE_ARTICLE_VERSION",
      "articleId" : "kA0RM00000004pP0AB"
    }
  ]
}
```

**Sample Output**

The following code sample illustrates a response after a successful request.

```apex
[ {
  "actionName" : "restoreKnowledgeArticleVersion",
  "errors" : null,
  "isSuccess" : true,
  "outputValues" : {
    "kA0RM00000004pP0AQ" : "Success"
  }
} ]
```

## Retrieve Smart Link URL

URI: `/services/data/v{XX.X}/actions/standard/getArticleSmartLinkUrl`

| Input            | Type   | Description                                        |
| ---------------- | ------ | -------------------------------------------------- |
| articleVersionId | string | Required. The ID of the Knowledge article version. |

**Sample Input**

The following code sample retrieves the SmartLink URL of a Knowledge article version:

```apex
{
   "inputs":[
      {
         "articleVersionId":"ka0xx00000000cjAAA"
      }
   ]
}

```

**Sample Output**

The following code sample illustrates a response after a successful request.

```apex
[
   {
      "actionName":"getArticleSmartLinkUrl",
      "errors":null,
      "isSuccess":true,
      "outputValues":{
         "articleSmartLinkUrl":"https://example.lightning.force.com/lightning/articles/Knowledge/Test-Redirection-1"
      }
   }
]

```

## Submit Knowledge Article for Translation

URI: `/services/data/v{XX.X}/actions/standard/submitKnowledgeArticleForTranslation`

| Input                 | Type    | Description                                                                     |
| --------------------- | ------- | ------------------------------------------------------------------------------- |
| articleId             | string  | Required. Article ID.                                                           |
| language              | string  | Required. Language code for the translation.                                    |
| assigneeId            | ID      | Required. ID of the assigned user.                                              |
| dueDate               | string  | Optional. Assigned due date.                                                    |
| sendEmailNotification | boolean | Optional. Indicates whether to send an email notification. Defaults to `false`. |

| Output    | Type   | Description                        |
| --------- | ------ | ---------------------------------- |
| articleId | ID     | Article ID.                        |
| language  | string | Language code for the translation. |

**Sample Input**

The following code sample submits one article for translation into Spanish:

```apex
{
  "inputs" : [
    {
      "articleId" : "kA0RM00000004pP0AQ",
      "language" : "es",
      "assigneeId" : "005RM00000AAAAAYA4"
    }
  ]
}
```

**Sample Output**

The following code sample illustrates a response after a successful request.

```apex
[ {
  "actionName" : "submitKnowledgeArticleForTranslation",
  "errors" : null,
  "isSuccess" : true,
  "outputValues" : {
    "articleId" : "kA0RM00000004pP0AQ",
    "language" : "es"
  }
} ]
```

## Error Response Types

Knowledge actions can respond with two types of error responses: action-scoped errors and item-scoped errors.

Action-scoped errors describe an error about the overall action that you're trying to invoke. Action-scoped errors have a `statusCode` in addition to a `message`. This example illustrates an action-scoped error caused by sending invalid input values.

```apex
[ {
         "actionName" : "restoreKnowledgeArticleVersion",
         "errors" : [ {
         "statusCode" : "INVALID_API_INPUT",
         "message" : "You can't perform this action. Be sure the action is valid for the current state of the article, and that you have permission to perform it.",
         "fields" : [ ]
         } ],
         "isSuccess" : false,
         "outputValues" : null
         } ]
```

Item-scoped errors describe a problem with a specific article or article version within the action. For example, this code illustrates an archiveKnowledgeArticles action response with one failed item and one successful item.

```apex
[ {
         "actionName" : "archiveKnowledgeArticles",
         "errors" : null,
         "isSuccess" : false,
         "outputValues" : {
         "ka0RM00000004Ve" : "You can't perform this action. Be sure the action is valid for the current state of the article, and that you have permission to perform it.",
         "ka0RM00000003do" : "Success"
         }
         } ]
```

If any type of error occurs with an action, the `isSuccess` field is `false`.
