Client API
Responses API
The Public Client API is designed for the JavaScript SDK and does not require authentication. It's primarily used for creating persons, sessions, and responses within the TypeflowAI platform. This API is ideal for client-side interactions, as it doesn't expose sensitive information.
This set of API can be used to
POST/api/v1/client/<environment-id>/responses
Create Response
Add a new response to a workflow.
Mandatory Body Fields
- Name
workflowId
- Type
- string
- Description
The id of the workflow the response belongs to.
- Name
finished
- Type
- boolean
- Description
Marks whether the response is complete or not.
- Name
data
- Type
- string
- Description
The data of the response as JSON object (key: questionId, value: answer).
Optional Body Fields
- Name
userId
- Type
- string
- Description
Pre-existing User ID to identify the user sending the response
Parameters Explained
field name | required | default | description |
---|---|---|---|
data | yes | - | The response data object (answers to the workflow). In this object the key is the questionId, the value the answer of the user to this question. |
userId | no | - | The person this response is connected to. |
workflowId | yes | - | The workflow this response is connected to. |
finished | yes | false | Mark a response as complete to be able to filter accordingly. |
Request
POST
/api/v1/client/<environment-id>/responsescurl --location --request POST 'https://dashboard.typeflowai.com/api/v1/client/<environment-id>/responses' \
--data-raw '{
"workflowId":"cloqzeuu70000z8khcirufo60",
"userId": "1",
"finished": true,
"data": {
"clfqjny0v0003yzgscnog1j9i": 10,
"clfqjtn8n0070yzgs6jgx9rog": "I love TypeflowAI"
}
}'
Response
{
"data": {
"id": "clp84xdld0002px36fkgue5ka",
}
}
PUT/api/v1/client/<environment-id>/responses/<response-id>
Update Response
Update an existing response in a workflow.
Mandatory Body Fields
- Name
finished
- Type
- boolean
- Description
Marks whether the response is complete or not.
- Name
data
- Type
- string
- Description
The data of the response as JSON object (key: questionId, value: answer).
Parameters Explained
field name | required | default | description |
---|---|---|---|
data | yes | - | The response data object (answers to the workflow). In this object the key is the questionId, the value the answer of the user to this question. |
finished | yes | false | Mark a response as complete to be able to filter accordingly. |
Request
PUT
/api/v1/client/<environment-id>/responses/<response-id>curl --location --request PUT 'https://dashboard.typeflowai.com/api/v1/client/<environment-id>/responses/<response-id>' \
--data-raw '{
"finished":false,
"data": {
"clfqjny0v0003yzgscnog1j9i": 10,
"clfqjtn8n0070yzgs6jgx9rog": "I love TypeflowAI"
}
}'
Response
{
"data": {}
}