> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Response

> This endpoint creates a new response from the agent

### Body

<ParamField body="id" type="string">
  This is the unique identifier for the response
</ParamField>

<ParamField body="ticket_url" type="string">
  This is the unique identifier for the ticket url.
</ParamField>

<ParamField body="channel" type="string">
  This is the unique identifier for the channel
</ParamField>

<ParamField body="customer_message" type="string">
  This is the customer message.
</ParamField>

<ParamField body="agent_response" type="string">
  This is the agent response.
</ParamField>

<ParamField body="rating" type="string">
  This is the reported condition of the return.
</ParamField>

<ParamField body="agent_take_over" type="boolean">
  This is whethere the message added the agent\_take\_over tag.
</ParamField>

<ParamField body="served_by_agent" type="boolean">
  This is whether the request was served by an agent.
</ParamField>

<ParamField body="org_id" type="string">
  This is the org\_id of the response.
</ParamField>

<ParamField body="created_date" type="string">
  This is the created date of the response.
</ParamField>

<ParamField body="ticket_id" type="string">
  This is the ticket id of the response.
</ParamField>

<ParamField body="function_call" type="string">
  This is the function call of the response.
</ParamField>

<ParamField body="workflow_id" type="string">
  This is the workflow id of the response.
</ParamField>

### Response

<ResponseField name="id" type="string">
  The ID provided in the data tab may be used to identify the return
</ResponseField>

<ResponseField name="ticket_url" type="string">
  The ticket url provided in the data tab may be used to identify the return
</ResponseField>

<ResponseField name="channel" type="string">
  The channel provided in the data tab may be used to identify the return
</ResponseField>

<ResponseField name="customer_message" type="string">
  The customer message provided in the data tab may be used to identify the return
</ResponseField>

<ResponseField name="agent_response" type="string">
  The agent response provided in the data tab may be used to identify the return
</ResponseField>

<ResponseField name="rating" type="string">
  The rating provided in the data tab may be used to identify the return
</ResponseField>

<ResponseField name="agent_take_over" type="boolean">
  The agent take over provided in the data tab may be used to identify the return
</ResponseField>

<ResponseField name="served_by_agent" type="boolean">
  The served by agent provided in the data tab may be used to identify the return
</ResponseField>

<ResponseField name="org_id" type="string">
  The org id provided in the data tab may be used to identify the return
</ResponseField>

<ResponseField name="created_date" type="string">
  The created date provided in the data tab may be used to identify the return
</ResponseField>

<ResponseField name="ticket_id" type="string">
  The ticket id provided in the data tab may be used to identify the return
</ResponseField>

<ResponseField name="function_call" type="string">
  The function call provided in the data tab may be used to identify the return
</ResponseField>

<ResponseField name="workflow_id" type="string">
  The workflow id provided in the data tab may be used to identify the return
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request POST 'https://api.stateset.com/v1/response' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Token <token>' \
  --data-raw '{
        'id': '0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
          'ticket_url': 'https://api.stateset.com/v1/ticket',
          'channel': 'Email',
          'customer_message': 'I would like to cancel my order',
          'agent_response': 'Your order has been cancelled. Thank you!',
          'rating': '5',
          'agent_take_over': false,
          'served_by_agent': true,
          'org_id': '0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
          'created_date': '2023-06-28T19:34:59.189838+00:00',
          'ticket_id': '0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
          'function_call': 'cancel-order',
          'workflow_id': '0901f083-aa1c-43c5-af5c-0a9d2fc64e30'
  }'
  ```

  ```graphQL GraphQL theme={null}
  mutation InsertNewResponse(
      $response: responses_insert_input!
      ) {
        insert_responses (
        objects: [$response]
        ) {    
        returning {
          id
          ticket_url
          channel
          customer_message
          agent_response
          rating
          agent_take_over
          served_by_agent
          org_id
          created_date
          ticket_id
          function_call
          workflow_id
        }
      }
    }`;
  ```

  ```js Node.js theme={null}
  const response = await stateset.response.create({
    'id': '0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
    'ticket_url': 'https://api.stateset.com/v1/ticket',
    'channel': 'Email',
    'customer_message': 'I would like to cancel my order',
    'agent_response': 'Your order has been cancelled. Thank you!',
    'rating': '5',
    'agent_take_over': false,
    'served_by_agent': true,
    'org_id': '0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
    'created_date': '2023-06-28T19:34:59.189838+00:00',
    'ticket_id': '0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
    'function_call': 'cancel-order',
    'workflow_id': '0901f083-aa1c-43c5-af5c-0a9d2fc64e30'
  })
  ```

  ```python Python theme={null}
  ```

  ```python Python theme={null}
  response = stateset.response.create({
    'id': '0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
    'ticket_url': 'https://api.stateset.com/v1/ticket',
    'channel': 'Email',
    'customer_message': 'I would like to cancel my order',
    'agent_response': 'Your order has been cancelled. Thank you!',
    'rating': '5',
    'agent_take_over': false,
    'served_by_agent': true,
    'org_id': '0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
    'created_date': '2023-06-28T19:34:59.189838+00:00',
    'ticket_id': '0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
    'function_call': 'cancel-order',
    'workflow_id': '0901f083-aa1c-43c5-af5c-0a9d2fc64e30'
  })
  ```

  ```ruby Ruby theme={null}
  ```

  ```ruby Ruby theme={null}
  response = stateset.response.create({
    'id': '0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
    'ticket_url': 'https://api.stateset.com/v1/ticket',
    'channel': 'Email',
    'customer_message': 'I would like to cancel my order',
    'agent_response': 'Your order has been cancelled. Thank you!',
    'rating': '5',
    'agent_take_over': false,
    'served_by_agent': true,
    'org_id': '0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
    'created_date': '2023-06-28T19:34:59.189838+00:00',
    'ticket_id': '0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
    'function_call': 'cancel-order',
    'workflow_id': '0901f083-aa1c-43c5-af5c-0a9d2fc64e30'
  })
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
      "response": [
          {
              "id": "0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
              "ticket_url": "https://api.stateset.com/v1/ticket",
              "channel": "Email",
              "customer_message": "I would like to cancel my order",
              "agent_response": "Your order has been cancelled. Thank you!",
              "rating": "5",
              "agent_take_over": false,
              "served_by_agent": true,
              "org_id": "0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
              "created_date": "2023-06-28T19:34:59.189838+00:00",
              "ticket_id": "0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
              "function_call": "cancel-order",
              "workflow_id": "0901f083-aa1c-43c5-af5c-0a9d2fc64e30"
          },
      ]
  }  
  ```
</ResponseExample>
