Skip to content

Edit Article

Request

Overview

This API allows a user to edit details of a single article. To specify whether you are editing, checking in, or publishing the article, use the required operation query parameter.

Removing values and editing collections

A property omitted from the request is left unchanged. To remove a value, send it explicitly in the form that matches its type:

  • Strings — send an empty string (""). For example, "summary": "" clears the version summary.
  • Objects — send null. For example, "compliancePolicy": null unassigns the compliance policy from the article. An object is removed as a whole; {} is not a removal form and is treated as an object with no properties supplied.
  • Arrays — the supplied array replaces the current one in full; there is no partial add or remove. To drop two entries and add one, send the complete list as it should read after the edit. To clear an array, send an empty array ([]).
  • Dates and numbers — send null. There is no empty date or empty number, so "" is not accepted. For example, "expirationDate": null clears the expiration date.

These rules apply at every level of the request body. Within an object supplied for update, its own properties follow the same rules: those omitted are left unchanged, and those sent as "", null, or [] are removed. For example, "macro": { "defaultValue": "" } clears the macro's default value and leaves the rest of the macro unchanged.

links and unlinks are the exception to the array rule. They do not replace a collection; they describe resource associations to add and to remove — for example, topics and related articles.

Not every property can be removed. Some must always hold a value — such as versions.name, versions.articleType, versions.ownedBy, and versions.availabilityDate — and sending "" or null for them is rejected instead of clearing the value. Read-only properties cannot be sent at all.

Inline images

content is authoritative for the version's inline images. Send it as the article should read after the edit — images to keep, images to add, and no tag for images to drop.

  • Keep an existing image by leaving its tag as Get Article returned it. The server resolves the image from id alone and never reads src, so src can be omitted and a signature that has since expired is not a problem.
  • Add a new image exactly as in Create Article — pre-upload it with application set to article and isInline set to true, then put the returned fileUploadId on the tag.
  • Remove an image by dropping its tag. An inline image whose tag is not present in the submitted content is removed from the version.
<img id="96ea5bd9-36dd-4771-aaa7-aa8cf794307e" alt="Forgot password link" width="480" />
<img fileUploadId="c1f0a3d2-9b47-4e15-8a6c-2d7e5f4b8091" alt="Reset confirmation" width="480" />
  • A tag must not carry both id and fileUploadId. Sending both is rejected with 400.
  • An id that does not exist, or that belongs to a different article or version, is rejected with 400, and no change is saved.
  • Inline images are never listed in attachments. The two are separate uploads, distinguished by isInline at pre-upload time, and are managed independently.
  • Omitting content leaves the current content, and with it the current inline images, unchanged.

Each newly added image is stored and its tag rewritten into the hosted form, so the next Get Article returns it with a generated id and a signed src, alongside the images that were kept.

Permissions

The user must have either the Author or Knowledge Base Manager role, or a custom role with Edit Article action. Additionally:

  • If article is being edited using any operation
    • User must have Edit Article permission on the parent folder.
    • If related article links or unlinks are supplied with the request, the user must have View Folder permission on the parent folder for each of the related articles.
  • If operation is checkin
    • If the article is not in the draft stage, the user must be a contributor of the current article stage.
  • If operation is publish
    • The requesting user must be allowed by this article's workflow to move the article to published stage.

Preconditions

  • Article must have been checked out by the requesting user.
  • When versions is included, the article version being edited is always the latest version.

Conflicts

  • The article name (versions[].name) must be unique among articles of the same language in the same folder. Renaming the article in the $lang language, including translating its name, to a name already used by another article in that folder and language is rejected with 409. The same name in a different language is not a conflict.
Security
oAuthUser(Required scopes:
https://api.egain.cloud/auth/knowledge.contentmgr.manage
)
or oAuthOnBehalfOfUser(Required scopes:
https://api.egain.cloud/auth/knowledge.contentmgr.onbehalfof.manage
)
Path
articleIDsstring, [ 7 .. 20 ] characters^[a-zA-Z0-9]{2,4}-\d{4,15}$required

The ID of a single Article.

An Article ID is composed of a 2-4 letter prefix followed by a dash and 4-15 digits.

Example:PROD-2996
Query
operationstringrequired

The article authoring operation to perform.

  • edit — edit article content and metadata. The request body must include at least one writable property.
  • checkin — check in the article, optionally with edits. Send {} to check in without changing any fields.
  • publish — publish the article, optionally with edits. Send {} to publish without changing any fields.
Enum:"edit""checkin""publish"
Example:operation=edit
$langstring(KnowledgeBaseLanguageCode)required

The knowledge base language in which the article is being edited. Must be one of the enabled Knowledge Base languages.

Enum:"ar-AE""bg-BG""cs-CZ""da-DK""de-AT""de-DE""el-GR""en-GB""en-US""es-ES"
Example:$lang=en-US
Headers
If-Matchstring, (date-time), [ 20 .. 24 ] characters^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$required

ETag value from a prior response; the server rejects the request with 412 if the resource has changed.

Example:2026-04-15T09:00:00.000Z
Content-Typestringrequired

The media type sent by the client.

Default:"application/json"
Value:"application/json"
Accept-Languagestring(Language)required

The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).

Enum:"en-US""en-GB""es-ES""fr-FR""it-IT""de-DE""nl-NL""pt-BR""pt-PT""da-DK"
Example:en-US
Bodyapplication/jsonrequired
versionsArray of objects, = 1 items(Version)

Version object with the fields to update. Omitted version properties are left unchanged.

macroobject or null(Macro)

Macros are embeddable shortcuts to article content — they substitute lengthy or dynamic text with short values. If a new macro is created while editing an article, the name field is required.

To unassign the macro from the article, send null. Omitting the property leaves the current macro unchanged.

compliancePolicyobject or null(CompliancePolicy)

Compliance policy associated with the article; defines when users must complete the Read & Sign for an article.

To remove the compliance policy from the article, send null. Omitting the property leaves the current compliance policy unchanged.

relatedQuestionsArray of strings, <= 100 items

Related questions for the article.

The supplied array replaces the current list in full. To add or remove individual questions, send the complete list as it should read after the edit. To remove all related questions, send an empty array ([]). Omitting the property leaves the current list unchanged.

customAttributesArray of objects, [ 0 .. 50 ] items(CustomAttribute)

Custom attribute values for this article. Each entry corresponds to an attribute definition that already exists in the system.

The supplied array replaces the current set in full. To unassign the values of an individual custom attribute, send the array containing only the attributes that should remain. To unassign the values of every custom attribute at once, send an empty array ([]). Omitting the property leaves the current custom attributes unchanged.

attribValues requires at least one value, so an individual attribute's values cannot be cleared by sending it with an empty attribValues array. Omit that attribute from the supplied customAttributes array instead.

Every writable request field populated for operation=edit and operation=checkin. attachments keeps existing attachment 9001 by its id and adds a newly uploaded file by its fileUploadId; any attachment not listed is removed. content does the same for inline images — it keeps image 96ea5bd9-36dd-4771-aaa7-aa8cf794307e by its id and adds a pre-uploaded image by its fileUploadId; any image whose tag is dropped is removed.

label and isMajorUpdate are rejected with 400 unless operation=publish.

curl -i -X PATCH \
  'https://api.egain.cloud/knowledge/contentmgr/v4/articles/PROD-2996?operation=edit&%24lang=en-US' \
  -H 'Accept-Language: en-US' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -H 'If-Match: 2026-04-15T09:00:00.000Z' \
  -d '{
    "relatedQuestions": [
      "How do I reset my password?",
      "What if the reset email never arrives?"
    ],
    "customAttributes": [
      {
        "attribInternalName": "audience",
        "attribValues": [
          {
            "value": "Administrators"
          }
        ]
      }
    ],
    "compliancePolicy": {
      "id": "5001"
    },
    "links": [
      {
        "rel": "topic",
        "href": "/knowledge/contentmgr/v4/topics/KB-3102"
      },
      {
        "rel": "article",
        "href": "/knowledge/contentmgr/v4/articles/PROD-4102"
      }
    ],
    "unlinks": [
      {
        "rel": "topic",
        "href": "/knowledge/contentmgr/v4/topics/KB-3103"
      },
      {
        "rel": "article",
        "href": "/knowledge/contentmgr/v4/articles/PROD-3050"
      }
    ],
    "macro": {
      "name": "password_reset_support_hours",
      "description": "Reusable support-hours note for password reset content.",
      "defaultValue": "Agents respond within 24 hours.",
      "fallbackArticle": {
        "id": "PROD-2997"
      }
    },
    "versions": [
      {
        "name": "How to reset your password",
        "description": "Steps to reset a forgotten password.",
        "keywords": "password reset,sign-in,troubleshooting",
        "summary": "Reset your password from the account portal.",
        "additionalInfo": "Applies to SSO and local accounts.",
        "content": "<p>Open the sign-in page, select <b>Forgot password</b>, and follow the emailed reset instructions.</p><p><img id=\"96ea5bd9-36dd-4771-aaa7-aa8cf794307e\" alt=\"Forgot password link\" width=\"480\" /></p><p><img fileUploadId=\"7b2e94a1-0c58-4d63-9f17-5ae83b6c204d\" alt=\"Reset confirmation\" width=\"480\" /></p>",
        "structuredAuthoring": {
          "confidenceLevel": {
            "value": "validated"
          },
          "environment": "Online banking portal, Account Management",
          "issueDescription": "Customer cannot complete password reset after being redirected from the sign-in page.",
          "issueCause": "Redirect URI mismatch between the portal and the identity provider."
        },
        "availabilityDate": "2027-08-19T09:00:00.000Z",
        "expirationDate": "2028-04-14T23:59:59.000Z",
        "imageUrl": "https://www.example.com/images/kb/password-reset-draft.png",
        "attachments": [
          {
            "id": "9001"
          },
          {
            "fileUploadId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
          }
        ],
        "articleType": {
          "id": "932100000002021"
        },
        "personalization": {
          "accessTagCategories": [
            {
              "id": "300",
              "tags": [
                {
                  "id": "301"
                }
              ],
              "tagGroups": [
                {
                  "id": "330"
                }
              ]
            }
          ],
          "filterTagCategories": [
            {
              "id": "310",
              "tags": [
                {
                  "id": "311"
                }
              ],
              "tagGroups": [
                {
                  "id": "340"
                }
              ]
            }
          ],
          "publishViews": [
            {
              "id": "320"
            }
          ]
        },
        "ownedBy": {
          "id": "1005"
        },
        "includeInGenAI": true
      }
    ]
  }'

Responses

No Content

Headers
ETagstring, (date-time), [ 20 .. 24 ] characters^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$

UTC ISO-8601 timestamp identifying the resource version for use with the If-Match header on subsequent updates.

Example:"2026-04-15T09:00:00.000Z"
Response
No content