# Create Account

# Overview
Use this API to create a Conversation Account for the Conversation Manager.
New Account API process flow: Authentication > Client Application > Participant > Channel > Orchestration > **Account**
## Scope
Client application must have 'app.conversation.conversationmgr.manage' scope assigned.

Endpoint: POST /accounts
Security: oAuthClient

## Description:

  - `Overview` ()
    Use this API to create a Conversation Account for the Conversation Manager.New Account API process flow: Authentication > Client Application > Participant > Channel > Orchestration > Account

  - `Scope` ()
    Client application must have 'app.conversation.conversationmgr.manage' scope assigned.

## Security:

  - `oAuthClient` (unknown)
    oauth2 scopes: https://api-qe1.ezdev.net/auth/.default

## Request body:

  - `application/json` (unknown)
    Register new account

## Request fields (application/json):

  - `name` (string, required)
    Unique name for account

  - `description` (string)

  - `active` (boolean)

  - `address` (string, required)
    Account ID like email address, phone numbers.

  - `channel` (object, required)

  - `channel.id` (string)
    UUID generated for account
    Example: c987d07a-d59c-11ea-87d0-0242ac130200

  - `caseManagement` (object)

  - `caseManagement.sameCaseDuration` (number)
    If same customer returns before this duration ends, then chat activity will be linked with same case.

  - `caseManagement.copyCustomAttributes` (boolean)
    If bypass VA feature is enabled in orchestration object and if set to true, then custom attributes from previous conversation will be copied for this conversation as well.

  - `chatConfigurations` (object, required)

  - `chatConfigurations.timeout` (number)
    Timeout for conversation created for this account. Time is calculated from last message in conversation.
Client applications should start new conversation after timeout.

  - `chatConfigurations.defaultLanguage` (string)
    Default language
    Example: en-US

  - `chatConfigurations.onAgentUnavailability` (string)
    This attribute indicates action on agent unavailability, in case of 'off_hours' if agent is not available then 'off hours' message is sent back. In case of 'retain_and_retry' message is held on Conversation Hub until agent is online
    Enum: "off_hours", "retain_and_retry"

  - `chatConfigurations.allowLogoutWithOpenChats` (boolean)
    Allow agents to logout with open messages in their inbox.

  - `chatConfigurations.allowQueueTransferOnAgentUnavailability` (boolean)
    Allow agents to transfer messages back to queue when no agents are available.

  - `chatConfigurations.orchestration` (object, required)

  - `chatConfigurations.orchestration.id` (string)
    UUID generated for orchestration object, which will be used for orchestration of conversations for this account
    Example: c987d07a-d59c-11ea-87d0-0242ac13000d

  - `chatConfigurations.entryPoint` (object, required)

  - `chatConfigurations.entryPoint.id` (string, required)
    Unique id of entrypoint in client application

  - `attributes` (array)

  - `attributes.name` (string, required)
    name of attribute

  - `attributes.value` (string, required)
    value of attribute

## Request examples:

  - `Create account for BYOC channel` (unknown)
    This is sample payload for BYOC channel account

  - `Create account for Google Business Messaging channel` (unknown)
    This is sample payload for Google Business Messaging channel channel account.
Replace address value with real Google Business Messaging 'google_business_messaging_agent', for example 'brands/4e16c0b7-fbfe-4f07-bae9-e8b8289d4891/agents/776426e8-98cb-41c9-97fa-f88ee133fa9d'.
If there is custom agent name set, that can be used as well as value of address.
For more info refer https://developers.google.com/business-communications/business-messages/guides/how-to/agents

  - `Create account for Twilio SMS channel` (unknown)
    This is sample payload for Twilio SMS channel account.

  - `Create account for WhatsApp channel` (unknown)
    This is sample payload for WhatsApp channel account.

## Response 201:

  - `201` (unknown)
    Created

## Response 201 fields (application/json):

  - `id` (string)
    UUID generated for the object.

## Response 400:

  - `400` (unknown)
    Bad Request

## Response 400 fields (application/json):

  - `code` (string, required)
    String that follow the pattern {integer}-{integer}.
* The first part is http status code.  The code is unique as a whole. Nothing common between 400-101 and 404-101

  - `developerMessage` (string, required)
    Response explaining what happened

  - `details` (array)

  - `details.key` (string, required)

  - `details.value` (string)

  - `userMessage` (string)
    UI friendly message only supported by some API.
* Client must request explicitly by passing X-egain-error-message=yes header

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 401 fields (application/json):

  - `code` (string, required)
    String that follow the pattern {integer}-{integer}.
* The first part is http status code.  The code is unique as a whole. Nothing common between 400-101 and 404-101

  - `developerMessage` (string, required)
    Response explaining what happened

  - `details` (array)

  - `details.key` (string, required)

  - `details.value` (string)

  - `userMessage` (string)
    UI friendly message only supported by some API.
* Client must request explicitly by passing X-egain-error-message=yes header

## Response 403:

  - `403` (unknown)
    Forbidden

## Response 403 fields (application/json):

  - `code` (string, required)
    String that follow the pattern {integer}-{integer}.
* The first part is http status code.  The code is unique as a whole. Nothing common between 400-101 and 404-101

  - `developerMessage` (string, required)
    Response explaining what happened

  - `details` (array)

  - `details.key` (string, required)

  - `details.value` (string)

  - `userMessage` (string)
    UI friendly message only supported by some API.
* Client must request explicitly by passing X-egain-error-message=yes header

## Response 500:

  - `500` (unknown)
    Internal server error

## Response 500 fields (application/json):

  - `code` (string, required)
    String that follow the pattern {integer}-{integer}.
* The first part is http status code.  The code is unique as a whole. Nothing common between 400-101 and 404-101

  - `developerMessage` (string, required)
    Response explaining what happened

  - `details` (array)

  - `details.key` (string, required)

  - `details.value` (string)

  - `userMessage` (string)
    UI friendly message only supported by some API.
* Client must request explicitly by passing X-egain-error-message=yes header

## Response 400 examples:

  - `Unsupported Parameters` (unknown)

  - `Invalid Value` (unknown)

  - `Missing required query parameter` (unknown)

## Response 401 examples:

  - `Invalid Authorization` (unknown)
    Invalid on expired Authorization. Generate new Authorization header and try again.

## Response 403 examples:

  - `Required Scope Missing` (unknown)
    OAuth Client application used for generating Authorization token doesn't have required scope to call this API.
Refer API description to know which scope needs to be assigned to OAuth client.

## Response 500 examples:

  - `Internal Server Error` (unknown)

