---
updatedAt: 2026-02-10T13:44:13.000Z
---

# Save Draft

Save a draft. At the moment, only one draft can be created per engagement.

# OpenAPI definition

```json
{
  "openapi": "3.0.2",
  "x-explorer-enabled": false,
  "x-samples-languages": [
    "curl",
    "node",
    "java",
    "javascript",
    "python",
    "go"
  ],
  "info": {
    "title": "Draft - Save",
    "description": "Manage Messaging or Email drafts that is drafted by Agent/Supervisor",
    "contact": {
      "name": "Avaya API Team",
      "url": "https://developers.avayacloud.com/onecloud-ccaas",
      "email": "apiteam@avaya.com"
    },
    "license": {
      "name": "Avaya Software Development Kit (SDK) Software License Terms",
      "url": "http://support.avaya.com/css/P8/documents/101038288"
    },
    "version": "1.0.2"
  },
  "servers": [
    {
      "url": "{protocol}://{server}{basePath}",
      "description": "Open API",
      "variables": {
        "protocol": {
          "enum": [
            "https"
          ],
          "default": "https"
        },
        "server": {
          "default": "HOST-REGION.api.avayacloud.com"
        },
        "basePath": {
          "default": "/api/digital/draft/command/v1"
        }
      }
    },
    {
      "url": "{protocol}://{server}:{port}",
      "description": "Internal API",
      "variables": {
        "protocol": {
          "enum": [
            "http",
            "https"
          ],
          "default": "http"
        },
        "server": {
          "default": "transcript-command-service"
        },
        "port": {
          "enum": [
            "80",
            "443"
          ],
          "default": "80"
        }
      }
    }
  ],
  "tags": [
    {
      "name": "Drafts",
      "description": "Drafts prepared by an Agent at an early stage before it is in final form in response to Email or Messaging contact. At the moment, only one draft supported per engagement.\n"
    }
  ],
  "security": [
    {},
    {
      "BearerAuth": [],
      "AppKey": []
    }
  ],
  "paths": {
    "/accounts/{accountId}/engagements/{engagementId}/drafts": {
      "post": {
        "tags": [
          "Drafts"
        ],
        "summary": "Save Draft",
        "description": "Save a draft. At the moment, only one draft can be created per engagement.\n",
        "operationId": "saveDraft",
        "parameters": [
          {
            "$ref": "#/components/parameters/accountId"
          },
          {
            "$ref": "#/components/parameters/engagementId"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageDraft"
              },
              "examples": {
                "Draft": {
                  "$ref": "#/components/examples/MessageDraftRequest"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageDraft"
                },
                "examples": {
                  "Draft": {
                    "$ref": "#/components/examples/MessageDraftResponse"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "accountId": {
        "name": "accountId",
        "description": "The unique 6 character internal id that represents the customer account.",
        "required": true,
        "in": "path",
        "schema": {
          "type": "string",
          "minLength": 6,
          "maxLength": 6,
          "pattern": "^[a-zA-Z]{6}$",
          "example": "ABCDEF"
        }
      },
      "engagementId": {
        "name": "engagementId",
        "description": "The unique 36 character internal id that represents the engagement.",
        "required": true,
        "in": "path",
        "schema": {
          "type": "string",
          "minLength": 36,
          "maxLength": 36,
          "pattern": "^[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}$",
          "example": "8d7cf5b8-70ad-11eb-9439-0242ac130002"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Bad Request",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "examples": {
              "default": {
                "$ref": "#/components/examples/ErrorConstraintViolation"
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Unauthorized.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "examples": {
              "default": {
                "$ref": "#/components/examples/ErrorUnauthorized"
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "Forbidden.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "examples": {
              "default": {
                "$ref": "#/components/examples/ErrorForbidden"
              }
            }
          }
        }
      },
      "InternalServerError": {
        "description": "Internal Server Error",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "examples": {
              "default": {
                "$ref": "#/components/examples/ErrorInternalServerError"
              }
            }
          }
        }
      }
    },
    "schemas": {
      "MessageDraft": {
        "type": "object",
        "description": "Message Draft",
        "required": [
          "dialogId",
          "body",
          "messageType"
        ],
        "properties": {
          "draftId": {
            "type": "string",
            "description": "The unique 36 character internal id that represents the draftId.",
            "minLength": 36,
            "maxLength": 36,
            "pattern": "^[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}$",
            "readOnly": true
          },
          "engagementId": {
            "type": "string",
            "description": "The unique 36 character internal id that represents the engagement.",
            "minLength": 36,
            "maxLength": 36,
            "pattern": "^[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}$",
            "readOnly": true
          },
          "dialogId": {
            "type": "string",
            "description": "The unique 36 character internal id that represents the dialog.",
            "minLength": 36,
            "maxLength": 36,
            "pattern": "^[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}$"
          },
          "parentMessageId": {
            "type": "string",
            "description": "The unique 36 character internal id that represents the id of parent message against which the draft is been created.",
            "minLength": 36,
            "maxLength": 36,
            "pattern": "^[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}$"
          },
          "channelProviderId": {
            "type": "string",
            "description": "The unique id that represents the channel provider",
            "minLength": 3,
            "maxLength": 256
          },
          "channelId": {
            "type": "string",
            "minLength": 3,
            "maxLength": 50,
            "description": "The unique id representing the Contact Center Channel. Only valid Contact Center Channel Id's are accepted. See Contact Center Channel list in Developers guide for further details."
          },
          "body": {
            "$ref": "#/components/schemas/BodyElement"
          },
          "headers": {
            "$ref": "#/components/schemas/MessageHeaders"
          },
          "attachments": {
            "type": "array",
            "maxItems": 25,
            "items": {
              "$ref": "#/components/schemas/Attachment"
            }
          },
          "customData": {
            "type": "object",
            "maxProperties": 20,
            "description": "Any data complementing the actual message body that is valuable for recipient clients. For example any additional reference links, key words, hash tag references, additional content information etc. Key is limited to 64 characters",
            "additionalProperties": {
              "type": "string",
              "maxLength": 256
            }
          },
          "messageType": {
            "$ref": "#/components/schemas/MessageType"
          },
          "correlationId": {
            "type": "string",
            "maxLength": 256,
            "description": "The correlation id can be used to uniquely identify the client request. This is an optional field but when specified it will be included in any callback events and can be used to correlate the callback event with the original API request."
          },
          "updatedBy": {
            "type": "string",
            "minLength": 36,
            "maxLength": 36,
            "pattern": "^[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}$",
            "writeOnly": true,
            "description": "The unique identifier of the user who last updated the draft",
            "example": "dfd117d7-73e3-4436-8bd7-3ce8f1a008ed"
          },
          "lastUpdatedBy": {
            "type": "string",
            "minLength": 36,
            "maxLength": 36,
            "pattern": "^[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}$",
            "readOnly": true,
            "description": "The unique identifier of the user who last updated the draft",
            "example": "dfd117d7-73e3-4436-8bd7-3ce8f1a008ed"
          },
          "lastUpdatedAt": {
            "readOnly": true,
            "type": "string",
            "format": "date-time",
            "description": "The datetime when the draft was last updated (in ISO 8601 format including timezone, 'yyyy-MM-dd'T'HH:mm:ss[.SSS]Z')"
          }
        }
      },
      "BodyElement": {
        "type": "object",
        "description": "Definition of the body element such as the type of element, the message text and format",
        "required": [
          "elementType",
          "elementText"
        ],
        "properties": {
          "elementType": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "description": "The type of the body element such as text, image, file, postback, carousel, location",
            "example": "text"
          },
          "elementText": {
            "$ref": "#/components/schemas/ElementText"
          },
          "payload": {
            "type": "string",
            "description": "Data required to help render the message on end clients",
            "maxLength": 4096
          }
        }
      },
      "ElementText": {
        "type": "object",
        "description": "The message text and format of the message body",
        "required": [
          "text"
        ],
        "properties": {
          "text": {
            "type": "string",
            "maxLength": 524288,
            "description": "The message text"
          },
          "textFormat": {
            "$ref": "#/components/schemas/TextFormat"
          }
        }
      },
      "TextFormat": {
        "description": "The message text format",
        "example": "PLAINTEXT",
        "type": "string",
        "enum": [
          "PLAINTEXT",
          "HTML",
          "MARKDOWN"
        ]
      },
      "MessageType": {
        "description": "Type of message, NEW is a new email received/sent by contact center, REPLY is email replied to/by contact center, FORWARD is email forwarded to/by contact center).\n",
        "type": "string",
        "enum": [
          "NEW",
          "REPLY",
          "FORWARD"
        ]
      },
      "MessageHeaders": {
        "type": "object",
        "properties": {
          "priority": {
            "type": "string",
            "maxLength": 32,
            "description": "The priority of the message set by the provider"
          },
          "sensitivity": {
            "type": "string",
            "maxLength": 32,
            "description": "The sensitivity of the message set by the provider"
          },
          "encoding": {
            "type": "string",
            "maxLength": 32,
            "description": "The encoding used for the body of the message"
          },
          "subject": {
            "type": "string",
            "maxLength": 256,
            "description": "The subject of the message set by the provider"
          },
          "from": {
            "type": "string",
            "maxLength": 256,
            "description": "The sender of the message set by the provider"
          },
          "to": {
            "type": "array",
            "description": "The To (recipients) of the message set by the provider",
            "maxItems": 50,
            "items": {
              "type": "string",
              "maxLength": 256
            }
          },
          "cc": {
            "type": "array",
            "maxItems": 50,
            "description": "The Cc (recipients) of the message set by the provider. This field is mainly used for email messages",
            "items": {
              "type": "string",
              "maxLength": 256
            }
          },
          "bcc": {
            "type": "array",
            "maxItems": 50,
            "description": "The Bcc (recipients) of the message set by the provider. This field is mainly used for email messages",
            "items": {
              "type": "string",
              "maxLength": 256
            }
          },
          "replyTo": {
            "type": "string",
            "maxLength": 256,
            "description": "The address to use when replying."
          },
          "clientDeviceTag": {
            "type": "string",
            "maxLength": 256,
            "description": "The tag used to identify the client device that was used to send the message."
          },
          "messageSourceServerTag": {
            "type": "string",
            "maxLength": 256,
            "description": "The tag used by a service to identify that this message was sent by itself."
          },
          "providerTimestamp": {
            "type": "string",
            "format": "date-time",
            "description": "The date time when the message was captured by the provider (in ISO 8601 format including timezone, 'yyyy-MM-dd'T'HH:mm:ss[.SSS]Z')"
          },
          "additionalHeaders": {
            "type": "object",
            "description": "The additional header fields of the message. For example if the payload is of a specific version that the clients rendering the payload need to be aware of that information can be sent here. Total size is limited to 256KB (including keys and values).",
            "additionalProperties": {
              "type": "string"
            },
            "x-disable-custom-linter-rules": [
              "request-body-validation"
            ]
          }
        }
      },
      "Attachment": {
        "type": "object",
        "description": "Meta information about the media",
        "required": [
          "attachmentId",
          "name",
          "size",
          "contentType",
          "url"
        ],
        "properties": {
          "attachmentId": {
            "type": "string",
            "description": "The unique 36 character internal id for the attachment",
            "minLength": 36,
            "maxLength": 36,
            "pattern": "^[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}$"
          },
          "name": {
            "type": "string",
            "maxLength": 256,
            "description": "The name of the attachment"
          },
          "size": {
            "type": "integer",
            "format": "int64",
            "description": "The size of the attachment in bytes"
          },
          "contentType": {
            "type": "string",
            "maxLength": 256,
            "description": "The content type of the attachment"
          },
          "contentId": {
            "type": "string",
            "maxLength": 256,
            "description": "The content id of the attachment"
          },
          "url": {
            "type": "string",
            "maxLength": 2048,
            "description": "The URL link to retrieve the attachment"
          },
          "captionText": {
            "type": "string",
            "maxLength": 256,
            "description": "The text describing the caption of the attachment"
          },
          "thumbnailUrl": {
            "type": "string",
            "maxLength": 2048,
            "description": "The URL link to retrieve the thumbnail of the attachment"
          },
          "additionalProperties": {
            "type": "object",
            "maxProperties": 10,
            "description": "Any additional properties of the attachment like labels, tags, revision numbers, display properties, etc.",
            "additionalProperties": {
              "type": "string",
              "maxLength": 256
            }
          }
        }
      },
      "Problem": {
        "type": "object",
        "description": "<b>Problem Detail</b> as a way to carry machine-readable details of errors in a HTTP response to avoid the need to define new error response formats for HTTP APIs <a href=\"https://tools.ietf.org/html/rfc7807\">RFC 7807</a>\n",
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "description": "An absolute URI that identifies the problem type. When dereferenced, it SHOULD provide human-readable documentation for the problem type (e.g., using HTML).\n",
            "default": "about:blank",
            "example": "https://developers.avayacloud.com/onecloud-ccaas/docs/error-handling#constraint-violation"
          },
          "title": {
            "type": "string",
            "description": "A short, summary of the problem type. Written in english and readable for engineers (usually not suited for non technical stakeholders and not localized).\n",
            "example": "Service Unavailable",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "description": "The HTTP status code generated by the origin server for this occurrence of the problem.\n",
            "minimum": 100,
            "maximum": 600,
            "exclusiveMaximum": true,
            "example": 503,
            "nullable": true
          },
          "detail": {
            "type": "string",
            "description": "A human readable explanation specific to this occurrence of the problem.\n",
            "example": "Connection to database timed out",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "format": "uri",
            "description": "An absolute URI that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.\n",
            "nullable": true
          },
          "violations": {
            "type": "array",
            "description": "A list of violations that occurred as a result of invalid data provided as part of a request.\n",
            "nullable": true,
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string",
                  "description": "The name of the field in the request that caused the violation. This can be the name of a path parameter, query parameter, or a field within the request body.\n",
                  "example": "accountId"
                },
                "message": {
                  "type": "string",
                  "description": "A human readable explanation specific to this occurrence of the violation.\n",
                  "example": "must match \"^[a-zA-Z]{6}$\""
                },
                "code": {
                  "type": "integer",
                  "format": "int32",
                  "description": "The violation code generated by the server for this occurrence of the violation. Use this code when implementing any error handling logic instead of the message, as the message can change.\n",
                  "example": 20006
                }
              }
            },
            "example": [
              {
                "field": "emailAddress",
                "message": "must not be null",
                "code": 20002
              },
              {
                "field": "accountId",
                "message": "must match \"^[a-zA-Z]{6}$\"",
                "code": 20006
              }
            ]
          }
        }
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "This API uses Bearer Token Authorization Flow",
        "bearerFormat": "JWT"
      },
      "AppKey": {
        "type": "apiKey",
        "in": "header",
        "name": "appkey",
        "description": "This API needs an appKey as header"
      }
    },
    "examples": {
      "MessageDraftRequest": {
        "value": {
          "dialogId": "bafba69d-5220-4cb8-9f02-82fe4f57f825",
          "parentMessageId": "e1e3d642-4200-4c1f-b010-b8ac46957ebd",
          "channelProviderId": "8252111c-4798-4fbf-bef7-44ddc671b2b0",
          "channelId": "Email",
          "body": {
            "elementType": "text",
            "elementText": {
              "text": "string",
              "textFormat": "PLAINTEXT"
            },
            "payload": "this is message body"
          },
          "headers": {
            "priority": "high",
            "sensitivity": "high",
            "encoding": "Optional[HTML]",
            "subject": "Re: Regarding car enquiry",
            "from": "test_dev1_02@outlook.com",
            "to": [
              "customer@abc.com"
            ],
            "cc": [
              "customer@abc.com"
            ],
            "bcc": [
              "customer@abc.com"
            ],
            "replyTo": "customer@abc.com",
            "clientDeviceTag": "android",
            "messageSourceServerTag": "connector01",
            "providerTimestamp": "2023-10-25T16:38:56.691Z",
            "additionalHeaders": {
              "Content-Language": "en"
            }
          },
          "attachments": [
            {
              "attachmentId": "7200ca37-7356-11ee-b8a9-41cf9e26c986",
              "name": "test.txt",
              "size": 1353,
              "contentType": "text/plain",
              "url": "https://service-domain.com/file.png",
              "captionText": "test logs",
              "contentId": "company-logo-cid",
              "thumbnailUrl": "https://somedomain.com/thumb.png",
              "additionalProperties": {
                "tags": "[\"logo-small\"]"
              }
            }
          ],
          "customData": {
            "sentiment": "neutral"
          },
          "messageType": "REPLY",
          "correlationId": "e5a3d414-a9dd-4297-964c-e048efd250b5",
          "updatedBy": "8fac92b8-5335-44b9-8347-efe484ca569a"
        }
      },
      "MessageDraftResponse": {
        "value": {
          "draftId": "b3c49e7e-b2ea-43f5-b911-17eb36974095",
          "engagementId": "ecc1b913-c351-461d-947b-00fb91586b25",
          "dialogId": "bafba69d-5220-4cb8-9f02-82fe4f57f825",
          "parentMessageId": "e1e3d642-4200-4c1f-b010-b8ac46957ebd",
          "channelProviderId": "8252111c-4798-4fbf-bef7-44ddc671b2b0",
          "channelId": "Email",
          "body": {
            "elementType": "text",
            "elementText": {
              "text": "string",
              "textFormat": "PLAINTEXT"
            },
            "payload": "this is message body"
          },
          "headers": {
            "priority": "high",
            "sensitivity": "high",
            "encoding": "Optional[HTML]",
            "subject": "Re: Regarding car enquiry",
            "from": "test_dev1_02@outlook.com",
            "to": [
              "customer@abc.com"
            ],
            "cc": [
              "customer@abc.com"
            ],
            "bcc": [
              "customer@abc.com"
            ],
            "replyTo": "customer@abc.com",
            "clientDeviceTag": "android",
            "messageSourceServerTag": "connector01",
            "providerTimestamp": "2023-10-25T16:38:56.691Z",
            "additionalHeaders": {
              "Content-Language": "en"
            }
          },
          "attachments": [
            {
              "attachmentId": "7200ca37-7356-11ee-b8a9-41cf9e26c986",
              "name": "test.txt",
              "size": 1353,
              "contentType": "text/plain",
              "url": "https://service-domain.com/file.png",
              "captionText": "test logs",
              "contentId": "company-logo-cid",
              "thumbnailUrl": "https://somedomain.com/thumb.png",
              "additionalProperties": {
                "tags": "[\"logo-small\"]"
              }
            }
          ],
          "customData": {
            "sentiment": "neutral"
          },
          "messageType": "REPLY",
          "correlationId": "e5a3d414-a9dd-4297-964c-e048efd250b5",
          "lastUpdatedBy": "8fac92b8-5335-44b9-8347-efe484ca569a",
          "lastUpdatedAt": "2023-10-25T16:38:56.692Z"
        }
      },
      "ErrorConstraintViolation": {
        "description": "Constraint Violation",
        "value": {
          "type": "https://developers.avayacloud.com/onecloud-ccaas/docs/error-handling#constraint-violation",
          "title": "Constraint Violation",
          "status": 400,
          "detail": "A problem that indicates a syntactically correct, yet semantically illegal request. The Server can not process this request until the client resolves the semantic errors described in the violations section.",
          "violations": [
            {
              "field": "engagementId",
              "message": "must match \"^[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}$\"",
              "code": 20006
            }
          ]
        }
      },
      "ErrorUnauthorized": {
        "description": "Unauthorized",
        "value": {
          "type": "https://developers.avayacloud.com/onecloud-ccaas/docs/error-handling#unauthorized",
          "title": "Unauthorized",
          "status": 401,
          "detail": "This operation requires authentication. See https://developers.avayacloud.com/onecloud-ccaas/docs/how-to-authenticate-with-ccaas-apis"
        }
      },
      "ErrorForbidden": {
        "description": "Forbidden",
        "value": {
          "type": "https://developers.avayacloud.com/onecloud-ccaas/docs/error-handling#forbidden",
          "title": "Forbidden",
          "status": 403,
          "detail": "According to the access control policy the current user and/or accountId does not have permission to access this resource."
        }
      },
      "ErrorInternalServerError": {
        "description": "Server Error",
        "value": {
          "type": "https://developers.avayacloud.com/onecloud-ccaas/docs/error-handling#server-error",
          "title": "Server Error",
          "status": 500,
          "detail": "An internal server error was encountered."
        }
      }
    }
  },
  "x-readme": {
    "proxy-enabled": true
  }
}
```