# Create Orchestration

# Overview
Use this API to configure workflows for conversations between participants (Customer/Agent/Bot applications).
New Account API process flow: Authenticiation > Client Application > Participant > Channel > **Orchestration** > Account
## Scope
Client application must have 'app.conversation.conversationmgr.manage' scope assigned.

Endpoint: POST /orchestrations
Security: oAuthClient

## Request fields (application/json):

  - `name` (string, required)
    Name for orchestration
    Example: default_orhchestration

  - `description` (string)

  - `active` (boolean)

  - `applications` (object, required)

  - `applications.botConfiguration` (object)
    Required if agentConfiguration is not provided

  - `applications.botConfiguration.forwardTranscript` (boolean)
    If VA session is not escalated and customer is identifiable then forward transcript to eGain agent

  - `applications.botConfiguration.bypassVaDuration` (number)
    If customer returns before this duration(in minutes) ends then bypass va and escalate to agent directly.

  - `applications.botConfiguration.bots` (array, required)

  - `applications.botConfiguration.bots.id` (string, required)
    UUID generated by Conversation Hub for bot client application.

  - `applications.botConfiguration.bots.participant` (object, required)

  - `applications.botConfiguration.bots.participant.id` (string, required)
    UUID generated by Conversation Hub for bot participant.

  - `applications.botConfiguration.bots.onEscalation` (object)

  - `applications.botConfiguration.bots.onEscalation.agent` (object, required)

  - `applications.botConfiguration.bots.onEscalation.agent.id` (string, required)
    UUID generated by Conversation Hub for agent client application, on escalation from bot, message will be sent to this client application

  - `applications.customerConfiguration` (object)
    details of customer client app, this object must be specified for custom channels.

  - `applications.customerConfiguration.customer` (object, required)
    Replies sent by bot or agent will be sent to this client application

  - `applications.customerConfiguration.customer.id` (string, required)
    UUID generated by Conversation Hub for customer client application

  - `applications.agentConfiguration` (object)
    Details of agent client app. Required if botConfiguration is not provided.

  - `applications.agentConfiguration.agents` (array, required)

  - `applications.agentConfiguration.agents.id` (string, required)
    UUID generated by Conversation Hub for agent application

## Response 201 fields (application/json):

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

## 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 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 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 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

