From 87f2f8d870aa4e95143123866bbff82003185364 Mon Sep 17 00:00:00 2001 From: Shubham Palriwala Date: Wed, 24 Apr 2024 18:29:28 +0530 Subject: [PATCH] docs: revamp API docs with Postman (#2518) Co-authored-by: Johannes --- .../api}/add-api-key.webp | Bin .../api}/api-key-secret.webp | Bin .../app/docs/additional-features/api/page.mdx | 137 +++ .../app/docs/api/client/actions/page.mdx | 94 --- .../app/docs/api/client/displays/page.mdx | 145 ---- .../app/docs/api/client/overview/page.mdx | 47 -- .../app/docs/api/client/people/page.mdx | 130 --- .../app/docs/api/client/responses/page.mdx | 200 ----- .../api/management/action-classes/page.mdx | 297 ------- .../api/management/api-key-setup/page.mdx | 103 --- .../api/management/attribute-classes/page.mdx | 289 ------- .../app/docs/api/management/me/page.mdx | 78 -- .../app/docs/api/management/people/page.mdx | 232 ----- .../docs/api/management/responses/page.mdx | 379 --------- .../app/docs/api/management/surveys/page.mdx | 789 ------------------ .../app/docs/api/management/webhooks/page.mdx | 398 --------- .../app/docs/integrations/make/page.mdx | 2 +- .../app/docs/integrations/n8n/page.mdx | 2 +- .../app/docs/integrations/zapier/page.mdx | 2 +- .../components/docs/Navigation.tsx | 28 +- apps/formbricks-com/next.config.mjs | 5 + 21 files changed, 149 insertions(+), 3208 deletions(-) rename apps/formbricks-com/app/docs/{api/management/api-key-setup => additional-features/api}/add-api-key.webp (100%) rename apps/formbricks-com/app/docs/{api/management/api-key-setup => additional-features/api}/api-key-secret.webp (100%) create mode 100644 apps/formbricks-com/app/docs/additional-features/api/page.mdx delete mode 100644 apps/formbricks-com/app/docs/api/client/actions/page.mdx delete mode 100644 apps/formbricks-com/app/docs/api/client/displays/page.mdx delete mode 100644 apps/formbricks-com/app/docs/api/client/overview/page.mdx delete mode 100644 apps/formbricks-com/app/docs/api/client/people/page.mdx delete mode 100644 apps/formbricks-com/app/docs/api/client/responses/page.mdx delete mode 100644 apps/formbricks-com/app/docs/api/management/action-classes/page.mdx delete mode 100644 apps/formbricks-com/app/docs/api/management/api-key-setup/page.mdx delete mode 100644 apps/formbricks-com/app/docs/api/management/attribute-classes/page.mdx delete mode 100644 apps/formbricks-com/app/docs/api/management/me/page.mdx delete mode 100644 apps/formbricks-com/app/docs/api/management/people/page.mdx delete mode 100644 apps/formbricks-com/app/docs/api/management/responses/page.mdx delete mode 100644 apps/formbricks-com/app/docs/api/management/surveys/page.mdx delete mode 100644 apps/formbricks-com/app/docs/api/management/webhooks/page.mdx diff --git a/apps/formbricks-com/app/docs/api/management/api-key-setup/add-api-key.webp b/apps/formbricks-com/app/docs/additional-features/api/add-api-key.webp similarity index 100% rename from apps/formbricks-com/app/docs/api/management/api-key-setup/add-api-key.webp rename to apps/formbricks-com/app/docs/additional-features/api/add-api-key.webp diff --git a/apps/formbricks-com/app/docs/api/management/api-key-setup/api-key-secret.webp b/apps/formbricks-com/app/docs/additional-features/api/api-key-secret.webp similarity index 100% rename from apps/formbricks-com/app/docs/api/management/api-key-setup/api-key-secret.webp rename to apps/formbricks-com/app/docs/additional-features/api/api-key-secret.webp diff --git a/apps/formbricks-com/app/docs/additional-features/api/page.mdx b/apps/formbricks-com/app/docs/additional-features/api/page.mdx new file mode 100644 index 0000000000..d09ed103f2 --- /dev/null +++ b/apps/formbricks-com/app/docs/additional-features/api/page.mdx @@ -0,0 +1,137 @@ +import { MdxImage } from "@/components/shared/MdxImage"; +import AddApiKey from "./add-api-key.webp"; +import ApiKeySecret from "./api-key-secret.webp"; + +export const metadata = { + title: "Formbricks API Overview: Public Client & Management API Breakdown", + description: + "Formbricks provides a powerful API to manage your surveys, responses, users, displays, actions, attributes & webhooks programmatically. Get a detailed understanding of Formbricks' dual API offerings: the unauthenticated Public Client API optimized for client-side tasks and the secured Management API for advanced account operations. Choose the perfect fit for your integration needs and ensure robust data handling", +}; + +#### API + +# API Overview + +Formbricks offers two types of APIs: the **Public Client API** and the **Management API**. Each API serves a different purpose, has different authentication requirements, and provides access to different data and settings. + +View our [API Documentation](https://documenter.getpostman.com/view/11026000/2sA3Bq5XEh) in more than 30 frameworks and languages. Or directly try out our APIs in Postman by clicking the button below: + +
+ + Run in Postman + +
+ +## Public Client API + +The [Public Client API](https://documenter.getpostman.com/view/11026000/2sA3Bq5XEh#5c981d9e-5e7d-455d-9795-b9c45bc2f930) is designed for our SDKs and **does not require authentication**. This API is ideal for client-side interactions, as it doesn't expose sensitive information. + +We currently have the following Client API methods exposed and below is their documentation attached in Postman: + +- [Actions API](https://documenter.getpostman.com/view/11026000/2sA3Bq5XEh#b8f3a10e-1642-4d82-a629-fef0a8c6c86c) - Create actions for a Person +- [Displays API](https://documenter.getpostman.com/view/11026000/2sA3Bq5XEh#949272bf-daec-4d72-9b52-47af3d74a62c) - Mark Survey as Displayed or Update an existing Display by linking it with a Response for a Person +- [People API](https://documenter.getpostman.com/view/11026000/2sA3Bq5XEh#ee3d2188-4253-4bca-9238-6b76455805a9) - Create & Update a Person (e.g. attributes, email, userId, etc) +- [Responses API](https://documenter.getpostman.com/view/11026000/2sA3Bq5XEh#8c773032-536c-483c-a237-c7697347946e) - Create & Update a Response for a Survey + +## Management API + +The [Management API](https://documenter.getpostman.com/view/11026000/2sA3Bq5XEh#98fce5a1-1365-4125-8de1-acdb28206766) provides access to all data and settings that your account has access to in the Formbricks app. This API **requires a personal API Key** for authentication, which can be generated in the Settings section of the Formbricks app. Checkout the [API Key Setup](#how-to-generate-an-api-key) below to generate & manage API Keys. + +We currently have the following Management API methods exposed and below is their documentation attached in Postman: + +- [Action Class API](https://documenter.getpostman.com/view/11026000/2sA3Bq5XEh#81947f69-99fc-41c9-a184-f3260e02be48) - Create, List, and Delete Action Classes +- [Attribute Class API](https://documenter.getpostman.com/view/11026000/2sA3Bq5XEh#31089010-d468-4a7c-943e-8ebe71b9a36e) - Create, List, and Delete Attribute Classes +- [Me API](https://documenter.getpostman.com/view/11026000/2sA3Bq5XEh#79e08365-641d-4b2d-aea2-9a855e0438ec) - Retrieve Account Information +- [People API](https://documenter.getpostman.com/view/11026000/2sA3Bq5XEh#cffc27a6-dafb-428f-8ea7-5165bedb911e) - List and Delete People +- [Response API](https://documenter.getpostman.com/view/11026000/2sA3Bq5XEh#e544ec0d-8b30-4e33-8d35-2441cb40d676) - List, List by Survey, Update, and Delete Responses +- [Survey API](https://documenter.getpostman.com/view/11026000/2sA3Bq5XEh#953189b2-37b5-4429-a7bd-f4d01ceae242) - List, Create, Update, and Delete Surveys +- [Webhook API](https://documenter.getpostman.com/view/11026000/2sA3Bq5XEh#62e6ec65-021b-42a4-ac93-d1434b393c6c) - List, Create, and Delete Webhooks + +## How to Generate an API key + +The API requests are authorized with a personal API key. This API key gives you the same rights as if you were logged in at formbricks.com - **don't share it around!** + +1. Go to your settings on [app.formbricks.com](https://app.formbricks.com). +2. Go to page “API keys” + +3. Create a key for the development or production environment. +4. Copy the key immediately. You won’t be able to see it again. + + + + ### Store API key safely! + Anyone who has your API key has full control over your account. For security reasons, you cannot view the API key again. + + +### Test your API Key + +Hit the below request to verify that you are authenticated with your API Key and the server is responding. + +## Get My Profile {{ tag: 'GET', label: '/api/v1/me' }} + + + + + Get the product details and environment type of your account. + + ### Mandatory Headers + + + + Your Formbricks API key. + + + + ### Delete a personal API key + + 1. Go to settings on [app.formbricks.com](https://app.formbricks.com/). + 2. Go to page “API keys”. + 3. Find the key you wish to revoke and select “Delete”. + 4. Your API key will stop working immediately. + + + + + + + + ```bash {{ title: 'cURL' }} + curl --location \ + 'https://app.formbricks.com/api/v1/me' \ + --header \ + 'x-api-key: ' + ``` + + + + + + ```json {{title:'200 Success'}} + { + "id": "cll2m30r70004mx0huqkitgqv", + "createdAt": "2023-08-08T18:04:59.922Z", + "updatedAt": "2023-08-08T18:04:59.922Z", + "type": "production", + "product": { + "id": "cll2m30r60003mx0hnemjfckr", + "name": "My Product" + }, + "widgetSetupCompleted": false + } + ``` + ```json {{ title: '401 Not Authenticated' }} + Not authenticated + ``` + + + + + +Can’t figure it out? Join our [Discord](https://discord.com/invite/3YFcABF2Ts) and we'd be glad to assist you! + +--- diff --git a/apps/formbricks-com/app/docs/api/client/actions/page.mdx b/apps/formbricks-com/app/docs/api/client/actions/page.mdx deleted file mode 100644 index a9511b50a6..0000000000 --- a/apps/formbricks-com/app/docs/api/client/actions/page.mdx +++ /dev/null @@ -1,94 +0,0 @@ -import { Fence } from "@/components/shared/Fence"; - -export const metadata = { - title: "Formbricks Actions API Documentation - Manage Your Survey Data Seamlessly", - description: - "Unlock the full potential of Formbricks' Client Actions API. Create Actions right from the API.", -}; - -#### Client API - -# Actions 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 Formbricks platform. This API is ideal for client-side interactions, as it doesn't expose sensitive information. - -This API can be used to: - -- [Add Action for User](#add-action-for-user) - ---- - -## Add Action for User {{ tag: 'POST', label: '/api/v1/client//actions' }} - -Adds an Actions for a given User by their User ID - - - - - ### Mandatory Body Fields - - - - The id of the user for whom the action is being created. - - Note: A user with this ID must exist in your environment in Formbricks. - - - The name of the Action being created. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl --location --request POST 'https://app.formbricks.com/api/v1/client//actions' \ - --data-raw '{ - "userId": "1", - "name": "new_action_v2" - - }' - ``` - - ```json {{ title: 'Example Request Body' }} - { - "userId": "1", - "name": "new_action_v3" - } - ``` - - - - - - ```json {{ title: '200 Success' }} - { - "data": {} - } - ``` - - ```json {{ title: '400 Bad Request' }} - { - "code": "bad_request", - "message": "Fields are missing or incorrectly formatted", - "details": { - "name": "Required" - } - } - ``` - - ```json {{ title: '500 Internal Server Error' }} - { - "code": "internal_server_error", - "message": "Unable to handle the request: Database operation failed", - "details": {} - } - ``` - - - - - ---- diff --git a/apps/formbricks-com/app/docs/api/client/displays/page.mdx b/apps/formbricks-com/app/docs/api/client/displays/page.mdx deleted file mode 100644 index fd14e1084f..0000000000 --- a/apps/formbricks-com/app/docs/api/client/displays/page.mdx +++ /dev/null @@ -1,145 +0,0 @@ -import { Fence } from "@/components/shared/Fence"; - -export const metadata = { - title: "Formbricks Public Client API Guide: Manage Survey Displays & Responses", - description: - "Dive deep into Formbricks' Public Client API designed for customisation. This comprehensive guide provides detailed instructions on how to mark create and update survey displays for users.", -}; - -#### Client API - -# Displays 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 Formbricks platform. This API is ideal for client-side interactions, as it doesn't expose sensitive information. - -This set of API can be used to -- [Create Display](#create-display) -- [Update Display](#update-display) - ---- - -## Create Display {{ tag: 'POST', label: '/api/v1/client//diplays' }} - - - - - Create Display of survey for a user - - ### Mandatory Request Body JSON Keys - - - Survey ID to mark as viewed for a person - - - - ### Optional Request Body JSON Keys - - - Already existing user's ID to mark as viewed for a survey - - - Already existing response's ID to link with this new Display - - - - - - - - - - ```bash {{ title: 'cURL' }} - curl -X POST \ - 'https://app.formbricks.com/api/v1/client/displays' \ - -H 'Content-Type: application/json' \ - -d '{ - "surveyId":"", - "userId":"" - }' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": { - "id": "clphzz6oo00083zdmc7e0nwzi" - } - } - ``` - - ```json {{ title: '400 Bad Request' }} - { - "code": "bad_request", - "message": "Fields are missing or incorrectly formatted", - "details": { - "surveyId": "Required" - } - } - ``` - - - - - ---- - -## Update Display {{ tag: 'PUT', label: '/api/v1/client//diplays/' }} - - - - - Update a display by it's ID - - ### Optional Request Body JSON Keys - - - Already existing user's ID to mark as viewed for a survey - - - Already existing response's ID to link with this new Display - - - - - - - - - - ```bash {{ title: 'cURL' }} - curl -X POST \ - 'https://app.formbricks.com/api/v1/client//displays/' \ - -H 'Content-Type: application/json' \ - -d '{ - "userId":"" - }' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": {} - } - ``` - - ```json {{ title: '400 Bad Request' }} - { - "code": "bad_request", - "message": "Fields are missing or incorrectly formatted", - "details": { - "surveyId": "Required" - } - } - ``` - - - - - ---- diff --git a/apps/formbricks-com/app/docs/api/client/overview/page.mdx b/apps/formbricks-com/app/docs/api/client/overview/page.mdx deleted file mode 100644 index 8399456133..0000000000 --- a/apps/formbricks-com/app/docs/api/client/overview/page.mdx +++ /dev/null @@ -1,47 +0,0 @@ -export const metadata = { - title: "Formbricks API Overview: Public Client & Management API Breakdown", - description: - "Get a detailed understanding of Formbricks' dual API offerings: the unauthenticated Public Client API optimized for client-side tasks and the secured Management API for advanced account operations. Choose the perfect fit for your integration needs and ensure robust data handling", -}; - -#### API - -# API Overview - -Formbricks offers two types of APIs: the **Public Client API** and the **Management API**. Each API serves a different purpose, has different authentication requirements, and provides access to different data and settings. - -Checkout the [API Key Setup](/docs/api/management/api-key-setup) - to generate, store, or delete API Keys. - -## Public Client 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 Formbricks platform. This API is ideal for client-side interactions, as it doesn't expose sensitive information. - -- [Actions API](/docs/api/client/actions) - Create actions for a person -- [Displays API](/docs/api/client/displays) - Mark Survey as Displayed or Responded for a Person -- [People API](/docs/api/client/people) - Create & update people (e.g. attributes) -- [Responses API](/docs/api/client/responses) - Create & update responses for a survey - -## Management API - -The Management API provides access to all data and settings that are visible in the Formbricks App. This API requires a personal API Key for authentication, which can be generated in the Settings section of the Formbricks App. With the Management API, you can manage your Formbricks account programmatically, accessing and modifying data and settings as needed. - -**Auth:** Personal API Key - -API requests made to the Management API are authorized using a personal API key. This key grants the same rights and access as if you were logged in at formbricks.com. It's essential to keep your API key secure and not share it with others. - -To generate, store, or delete an API key, follow the instructions provided on the following page [API Key](/docs/api/management/api-key-setup). - -- [Action Class API](/docs/api/management/action-classes) - Create, Update, and Delete Action Classes -- [Attribute Class API](/docs/api/management/attribute-classes) - Create, Update, and Delete Attribute Classes -- [Me API](/docs/api/management/me) - Retrieve Account Information -- [People API](/docs/api/management/people) - Create, Update, and Delete People -- [Responses API](/docs/api/management/responses) - Create, Update, and Delete Responses -- [Surveys API](/docs/api/management/surveys) - Create, Update, and Delete Surveys -- [Webhook API](/docs/api/management/webhooks) - Create, Update, and Delete Webhooks - - - By understanding the differences between these two APIs, you can choose the appropriate one for your needs, - ensuring a secure and efficient integration with the Formbricks platform. - - ---- diff --git a/apps/formbricks-com/app/docs/api/client/people/page.mdx b/apps/formbricks-com/app/docs/api/client/people/page.mdx deleted file mode 100644 index d4b85735b5..0000000000 --- a/apps/formbricks-com/app/docs/api/client/people/page.mdx +++ /dev/null @@ -1,130 +0,0 @@ -import { Fence } from "@/components/shared/Fence"; - -export const metadata = { - title: "Formbricks Public Client API Guide: Manage Users", - description: - "Dive deep into Formbricks' Public Client API designed for customisation. This comprehensive guide provides detailed instructions on creating and updating users to help in user identification.", -}; - -#### Client API - -# People 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 Formbricks platform. This API is ideal for client-side interactions, as it doesn't expose sensitive information. - -This set of API can be used to -- [Create Person](#create-person) -- [Update Person](#update-person) - ---- - -## Create Person {{ tag: 'POST', label: '/api/v1/client//people' }} - - - - - Create User with your own User ID - - ### Mandatory Request Body JSON Keys - - - User ID which you would like to identify the person with - - - - - - - - - ```bash {{ title: 'cURL' }} - curl -X POST \ - 'https://app.formbricks.com/api/v1/client//people' \ - -H 'Content-Type: application/json' \ - -d '{ - "userId":"docs_user" - }' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": { - "userId": "docs_user" - } - } - ``` - - ```json {{ title: '400 Bad Request' }} - { - "code": "bad_request", - "message": "Fields are missing or incorrectly formatted", - "details": { - "surveyId": "Required" - } - } - ``` - - - - - ---- - -## Update Person {{ tag: 'POST', label: '/api/v1/client//people/' }} - - - - - Update Person by their User ID - - ### Mandatory Request Body JSON Keys - - - Key Value pairs of attributes to add to the user - - - - - - - - - ```bash {{ title: 'cURL' }} - curl -X POST \ - --location \ - 'https://app.formbricks.com/api/v1/client//people/' - -H 'Content-Type: application/json' \ - -d '{ - "attributes":{ - "welcome_to":"formbricks" - } - }' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": {} - } - ``` - - ```json {{ title: '500 Internal Server Error' }} - { - "code": "internal_server_error", - "message": "Database operation failed", - "details": {} - } - ``` - - - - - ---- diff --git a/apps/formbricks-com/app/docs/api/client/responses/page.mdx b/apps/formbricks-com/app/docs/api/client/responses/page.mdx deleted file mode 100644 index b2099d95fb..0000000000 --- a/apps/formbricks-com/app/docs/api/client/responses/page.mdx +++ /dev/null @@ -1,200 +0,0 @@ -import { Fence } from "@/components/shared/Fence"; - -export const metadata = { - title: "Formbricks Responses API Documentation - Manage Your Survey Data Seamlessly", - description: - "Unlock the full potential of Formbricks' Responses API. From fetching to updating survey responses, our comprehensive guide helps you integrate and manage survey data efficiently without compromising security. Ideal for client-side interactions.", -}; - -#### 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 Formbricks platform. This API is ideal for client-side interactions, as it doesn't expose sensitive information. - -This set of API can be used to -- [Create Response](#create-response) -- [Update Response](#update-response) - ---- - -## Create Response {{ tag: 'POST', label: '/api/v1/client//responses' }} - -Add a new response to a survey. - - - - - ### Mandatory Body Fields - - - - The id of the survey the response belongs to. - - - Marks whether the response is complete or not. - - - The data of the response as JSON object (key: questionId, value: answer). - - - - - ### Optional Body Fields - - - - 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 survey). 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. | -| surveyId | yes | - | The survey this response is connected to. | -| finished | yes | false | Mark a response as complete to be able to filter accordingly. | - - - - - - - ```bash {{ title: 'cURL' }} - curl --location --request POST 'https://app.formbricks.com/api/v1/client//responses' \ - --data-raw '{ - "surveyId":"cloqzeuu70000z8khcirufo60", - "userId": "1", - "finished": true, - "data": { - "clfqjny0v0003yzgscnog1j9i": 10, - "clfqjtn8n0070yzgs6jgx9rog": "I love Formbricks" - } - }' - ``` - - ```json {{ title: 'Example Request Body' }} - { - "userId": "1", - "surveyId": "cloqzeuu70000z8khcirufo60", - "finished": true, - "data": { - "clfqjny0v0003yzgscnog1j9i": 10, - "clfqjtn8n0070yzgs6jgx9rog": "I love Formbricks" - } - } - ``` - - - - - - ```json {{ title: '200 Success' }} - { - "data": { - "id": "clp84xdld0002px36fkgue5ka", - } - } - ``` - - ```json {{ title: '400 Bad Request' }} - { - "code": "bad_request", - "message": "surveyId was not provided.", - "details": { - "surveyId": "This field is required." - } - } - ``` - - - - - - ---- - -## Update Response {{ tag: 'PUT', label: '/api/v1/client//responses/' }} - -Update an existing response in a survey. - - - - - ### Mandatory Body Fields - - - - Marks whether the response is complete or not. - - - 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 survey). 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. | - - - - - - - ```bash {{ title: 'cURL' }} - curl --location --request PUT 'https://app.formbricks.com/api/v1/client//responses/' \ - --data-raw '{ - "finished":false, - "data": { - "clfqjny0v0003yzgscnog1j9i": 10, - "clfqjtn8n0070yzgs6jgx9rog": "I love Formbricks" - } - }' - ``` - - ```json {{ title: 'Example Request Body' }} - { - "finished":false, - "data": { - "clfqjny0v0003yzgscnog1j9i": 10, - "clfqjtn8n0070yzgs6jgx9rog": "I love Formbricks" - } - } - ``` - - - - - - ```json {{ title: '200 Success' }} - { - "data": {} - } - ``` - - ```json {{ title: '400 Bad Request' }} - { - "code": "bad_request", - "message": "data was not provided.", - "details": { - "data": "This field is required." - } - } - ``` - - ```json {{ title: '404 Not Found' }} - { - "code": "not_found", - "message": "Response not found" - } - ``` - - - - - diff --git a/apps/formbricks-com/app/docs/api/management/action-classes/page.mdx b/apps/formbricks-com/app/docs/api/management/action-classes/page.mdx deleted file mode 100644 index d7be643d30..0000000000 --- a/apps/formbricks-com/app/docs/api/management/action-classes/page.mdx +++ /dev/null @@ -1,297 +0,0 @@ -import { Fence } from "@/components/shared/Fence"; -import {generateManagementApiMetadata} from "@/lib/utils" -export const metadata = generateManagementApiMetadata("Action Class",["Fetch","Create","Delete"]) - -#### Management API - -# Action Classes API - -This set of API can be used to -- [List Actions](#get-all-action-classes) -- [Get Action](#get-action-class-by-id) -- [Create Actions](#create-action-class) -- [Delete Actions](#delete-action-class) - -You will need an API Key to interact with these APIs. - ---- - -## Get all Action Classes {{ tag: 'GET', label: '/api/v1/management/action-classes' }} - - - - - Get all the existing action classes in your environment. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl --location \ - 'https://app.formbricks.com/api/v1/management/action-classes' \ - --header \ - 'x-api-key: ' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": [ - { - "id": "cln8k0t47000gz87nw4ibwv35", - "createdAt": "2023-10-02T07:13:19.207Z", - "updatedAt": "2023-10-02T07:13:19.207Z", - "name": "New Session", - "description": "Gets fired when a new session is created", - "type": "automatic", - "noCodeConfig": null, - "environmentId": "cln8k0t47000fz87njmmu2bck" - }, - { - "id": "cln8k0t55000uz87noerwdooj", - "createdAt": "2023-10-02T07:13:19.241Z", - "updatedAt": "2023-10-02T07:13:19.241Z", - "name": "Invited Team Member", - "description": "Person invited a team member", - "type": "noCode", - "noCodeConfig": { - "type": "innerHtml", - "innerHtml": { - "value": "Add Team Member" - } - }, - "environmentId": "cln8k0t47000fz87njmmu2bck" - }, - ] - } - ``` - - ```json {{ title: '401 Unauthorized' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - ---- - -## Get Action Class by ID {{ tag: 'GET', label: '/api/v1/management/action-classes/' }} - - - - - Fetch an action class by its ID. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl --location \ - 'https://app.formbricks.com/api/v1/management/action-classes/' \ - --header \ - 'x-api-key: ' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": { - "id": "cln8k0t55000uz87noerwdooj", - "createdAt": "2023-10-02T07:13:19.241Z", - "updatedAt": "2023-10-02T07:13:19.241Z", - "name": "Invited Team Member", - "description": "Person invited a team member", - "type": "noCode", - "noCodeConfig": { - "type": "innerHtml", - "innerHtml": { - "value": "Add Team Member" - } - }, - "environmentId": "cln8k0t47000fz87njmmu2bck" - } - } - ``` - - ```json {{ title: '401 Unauthorized' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - ---- - -## Create Action Class {{ tag: 'POST', label: '/api/v1/management/action-classes/' }} - - - - - Create an action class. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - ### Body - - - ```json {{ title: 'cURL' }} - { - "environmentId": "cln8k0t47000fz87njmmu2bck", - "name": "My Action from API", - "type": "code" - } - ``` - - - - - - - - ```bash {{ title: 'cURL' }} - curl -X POST https://app.formbricks.com/api/v1/management/action-classes/ \ - --header 'Content-Type: application/json' \ - --header 'x-api-key: ' \ - -d '{"environmentId": "cln8k0t47000fz87njmmu2bck", "name": "My Action from API", "type": "code"}' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": { - "id": "cln9w1cno0008z8zu79nk5w0c", - "createdAt": "2023-10-03T05:37:26.100Z", - "updatedAt": "2023-10-03T05:37:26.100Z", - "name": "My Action from API", - "description": null, - "type": "code", - "noCodeConfig": null, - "environmentId": "cln8k0t47000fz87njmmu2bck" - } - } - ``` - - ```json {{ title: '401 Unauthorized' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - ---- - -## Delete Action Class {{ tag: 'DELETE', label: '/api/v1/management/action-classes/' }} - - - - - Delete an action class by its ID. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl -X DELETE https://app.formbricks.com/api/v1/management/action-classes/ \ - --header 'x-api-key: ' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": { - "id": "cln9w1cno0008z8zu79nk5w0c", - "createdAt": "2023-10-03T05:37:26.100Z", - "updatedAt": "2023-10-03T05:37:26.100Z", - "name": "My Action from API", - "description": null, - "type": "code", - "noCodeConfig": null, - "environmentId": "cln8k0t47000fz87njmmu2bck" - } - } - ``` - - ```json {{ title: '401 Unauthorized' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - ---- diff --git a/apps/formbricks-com/app/docs/api/management/api-key-setup/page.mdx b/apps/formbricks-com/app/docs/api/management/api-key-setup/page.mdx deleted file mode 100644 index c5ea86e9d5..0000000000 --- a/apps/formbricks-com/app/docs/api/management/api-key-setup/page.mdx +++ /dev/null @@ -1,103 +0,0 @@ -import { MdxImage } from "@/components/shared/MdxImage"; - -import AddApiKey from "./add-api-key.webp"; -import ApiKeySecret from "./api-key-secret.webp"; - -export const metadata = { - title: "Formbricks API Key: Setup and Testing", - description: - "This guide provides step-by-step instructions to generate, store, and delete API keys, ensuring safe and authenticated access to your Formbricks account.", -}; - -#### API - -# API Key Setup - -## Auth: Personal API key - -The API requests are authorized with a personal API key. This API key gives you the same rights as if you were logged in at formbricks.com - **don't share it around!** - -### How to generate an API key - -1. Go to your settings on [app.formbricks.com](https://app.formbricks.com). -2. Go to page “API keys” - -3. Create a key for the development or production environment. -4. Copy the key immediately. You won’t be able to see it again. - - - - ### Store API key safely! - Anyone who has your API key has full control over your account. For security - reasons, you cannot view the API key again. - - -### Test your API Key - -Hit the below request to verify that you are authenticated with your API Key and the server is responding. - -## Get My Profile {{ tag: 'GET', label: '/api/v1/me' }} - - - - - Get the product details and environment type of your account. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl --location \ - 'https://app.formbricks.com/api/v1/me' \ - --header \ - 'x-api-key: ' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "id": "cll2m30r70004mx0huqkitgqv", - "createdAt": "2023-08-08T18:04:59.922Z", - "updatedAt": "2023-08-08T18:04:59.922Z", - "type": "production", - "product": { - "id": "cll2m30r60003mx0hnemjfckr", - "name": "My Product" - }, - "widgetSetupCompleted": false - } - ``` - ```json {{ title: '401 Not Authenticated' }} - Not authenticated - ``` - - - - - ---- - -### Delete a personal API key - -1. Go to settings on [app.formbricks.com](https://app.formbricks.com/). -2. Go to page “API keys”. -3. Find the key you wish to revoke and select “Delete”. -4. Your API key will stop working immediately. diff --git a/apps/formbricks-com/app/docs/api/management/attribute-classes/page.mdx b/apps/formbricks-com/app/docs/api/management/attribute-classes/page.mdx deleted file mode 100644 index 009376f10a..0000000000 --- a/apps/formbricks-com/app/docs/api/management/attribute-classes/page.mdx +++ /dev/null @@ -1,289 +0,0 @@ -import { Fence } from "@/components/shared/Fence"; -import {generateManagementApiMetadata} from "@/lib/utils" - -export const metadata = generateManagementApiMetadata("Attribute Class",["Fetch","Create","Delete"]) - -#### Management API - -# Attribute Classes API - -This set of API can be used to -- [List Attributes](#get-all-attribute-classes) -- [Get Attributes](#get-attribute-class-by-id) -- [Create Attributes](#create-attribute-class) -- [Delete Attributes](#delete-attribute-class) - -You will need an API Key to interact with these APIs. - ---- - -## Get all Attribute Classes {{ tag: 'GET', label: '/api/v1/management/attribute-classes' }} - - - - - Get all the existing attribute classes in your environment. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl --location \ - 'https://app.formbricks.com/api/v1/management/attribute-classes' \ - --header \ - 'x-api-key: ' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": [ - { - "id": "cln8k0t47000kz87n3lh23zf0", - "createdAt": "2023-10-02T07:13:19.207Z", - "updatedAt": "2023-10-02T07:13:19.207Z", - "name": "email", - "description": "The email of the person", - "archived": false, - "type": "automatic", - "environmentId": "cln8k0t47000fz87njmmu2bck" - }, - { - "id": "cln8k0t55000xz87nrtwbo7sf", - "createdAt": "2023-10-02T07:13:19.241Z", - "updatedAt": "2023-10-02T07:13:19.241Z", - "name": "Name", - "description": "Full Name of the Person", - "archived": false, - "type": "code", - "environmentId": "cln8k0t47000fz87njmmu2bck" - }, - ] - } - ``` - - ```json {{ title: '401 Unauthorized' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - ---- - -## Get Attribute Class by ID {{ tag: 'GET', label: '/api/v1/management/attribute-classes/' }} - - - - - Fetch an Attribute class by its ID. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl --location \ - 'https://app.formbricks.com/api/v1/management/attribute-classes/' \ - --header \ - 'x-api-key: ' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": { - "id": "cln8k0t47000jz87nfwcey6mh", - "createdAt": "2023-10-02T07:13:19.207Z", - "updatedAt": "2023-10-02T07:13:19.207Z", - "name": "userId", - "description": "The internal ID of the person", - "archived": false, - "type": "automatic", - "environmentId": "cln8k0t47000fz87njmmu2bck" - } - } - ``` - - ```json {{ title: '401 Unauthorized' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - ---- - -## Create Attribute Class {{ tag: 'POST', label: '/api/v1/management/attribute-classes/' }} - - - - - Create an Attribute class. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - ### Body - - - ```json {{ title: 'cURL' }} - { - "environmentId": "clmlmwdqq0003196ufewo6ibg", - "name": "My Attribute from API", - "type": "code", - "description": "My description" - } - ``` - - - - - - - - ```bash {{ title: 'cURL' }} - curl -X POST https://app.formbricks.com/api/v1/management/attribute-classes/ \ - --header 'Content-Type: application/json' \ - --header 'x-api-key: ' \ - -d '{"environmentId": "clmlmwdqq0003196ufewo6ibg", "name": "My Attribute from API", "type": "code", "description":"My description"}' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": { - "id": "clna0hd7z0009z8zue2z3a7wy", - "createdAt": "2023-10-03T07:41:51.792Z", - "updatedAt": "2023-10-03T07:41:51.792Z", - "name": "My Attribute from API", - "description": null, - "archived": false, - "type": "code", - "environmentId": "cln8k0t47000fz87njmmu2bck" - } - } - ``` - - ```json {{ title: '401 Unauthorized' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - ---- - -## Delete Attribute Class {{ tag: 'DELETE', label: '/api/v1/management/attribute-classes/' }} - - - - - Delete an Attribute class by its ID. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl -X DELETE https://app.formbricks.com/api/v1/management/attribute-classes/ \ - --header 'x-api-key: ' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": { - "id": "clna0hd7z0009z8zue2z3a7wy", - "createdAt": "2023-10-03T07:41:51.792Z", - "updatedAt": "2023-10-03T07:41:51.792Z", - "name": "My Attribute from API", - "description": null, - "archived": false, - "type": "code", - "environmentId": "cln8k0t47000fz87njmmu2bck" - } - } - ``` - - ```json {{ title: '401 Unauthorized' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - ---- diff --git a/apps/formbricks-com/app/docs/api/management/me/page.mdx b/apps/formbricks-com/app/docs/api/management/me/page.mdx deleted file mode 100644 index c5ba911036..0000000000 --- a/apps/formbricks-com/app/docs/api/management/me/page.mdx +++ /dev/null @@ -1,78 +0,0 @@ -import { Fence } from "@/components/shared/Fence"; - -export const metadata = { - title: "Formbricks Me API: Fetch your environment details", - description: - "Dive into Formbricks' Me API within the Public Client API suite. Seamlessly fetch your own current environment details.", -}; - -#### Management API - -# Me API - -This API can be used to get your own current environment details. - -You will need an API Key to interact with these APIs. - ---- - -## Get Environment {{ tag: 'GET', label: '/api/v1/management/me' }} - - - - - Get your current environment details. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl --location \ - 'https://app.formbricks.com/api/v1/management/me' \ - --header \ - 'x-api-key: ' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "id": "cln8k0t47000fz87njmmu2bck", - "createdAt": "2023-10-02T07:13:19.207Z", - "updatedAt": "2023-10-02T07:14:14.162Z", - "type": "production", - "product": { - "id": "cln8k0t47000ez87n57aqywvz", - "name": "Demo Product" - }, - "widgetSetupCompleted": true - } - ``` - - ```json {{ title: '401 Unauthorized' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - ---- diff --git a/apps/formbricks-com/app/docs/api/management/people/page.mdx b/apps/formbricks-com/app/docs/api/management/people/page.mdx deleted file mode 100644 index 14856ba9fa..0000000000 --- a/apps/formbricks-com/app/docs/api/management/people/page.mdx +++ /dev/null @@ -1,232 +0,0 @@ -import { Fence } from "@/components/shared/Fence"; -import {generateManagementApiMetadata} from "@/lib/utils" - -export const metadata = generateManagementApiMetadata("People",["Fetch","Delete"]) - - -#### Management API - -# People API - -This set of API can be used to -- [List People](#list-people) -- [Get Person](#get-person) -- [Delete Person](#delete-person) - -You will need an API Key to interact with these APIs. - ---- - -## List People {{ tag: 'GET', label: '/api/v1/management/people' }} - - - - - List People - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl --location \ - 'https://app.formbricks.com/api/v1/management/people' \ - --header \ - 'x-api-key: ' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": [ - { - "id": "b4wgrzl363dn3zb6yy5gf265", - "attributes": { - "userId": "CYO618", - "email": "sophia@amazon.com", - "Name": "Sophia Johnson", - "Role": "Designer", - "Company": "Amazon", - "Experience": "7 years", - "Usage Frequency": "Yearly", - "Company Size": "1628 employees", - "Product Satisfaction Score": "62", - "Recommendation Likelihood": "9" - }, - "environmentId": "cln8k0t47000fz87njmmu2bck", - "createdAt": "2023-10-02T07:13:19.444Z", - "updatedAt": "2023-10-02T07:13:19.444Z" - }, - { - "id": "jrb5iyzqvnkg9322ckhde3j4", - "attributes": { - "userId": "CYO511", - "email": "antonio@ibm.com", - "Name": "Antonio García", - "Role": "Designer", - "Company": "IBM", - "Experience": "1 years", - "Usage Frequency": "Weekly", - "Company Size": "4023 employees", - "Product Satisfaction Score": "77", - "Recommendation Likelihood": "4" - }, - "environmentId": "cln8k0t47000fz87njmmu2bck", - "createdAt": "2023-10-02T07:13:19.444Z", - "updatedAt": "2023-10-02T07:13:19.444Z" - }, - ] - } - ``` - - ```json {{ title: '400 Bad Request' }} - { - "code": "bad_request", - "message": "Fields are missing or incorrectly formatted", - "details": { - "userId": "" - } - } - ``` - - - - - ---- - -## Get Person {{ tag: 'GET', label: '/api/v1/management/people/' }} - - - - - Get Person by ID - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl --location \ - 'https://app.formbricks.com/api/v1/management/people/' \ - --header \ - 'x-api-key: ' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": { - "id": "jrb5iyzqvnkg9322ckhde3j4", - "attributes": { - "userId": "CYO511", - "email": "antonio@ibm.com", - "Name": "Antonio García", - "Role": "Designer", - "Company": "IBM", - "Experience": "1 years", - "Usage Frequency": "Weekly", - "Company Size": "4023 employees", - "Product Satisfaction Score": "77", - "Recommendation Likelihood": "4" - }, - "environmentId": "cln8k0t47000fz87njmmu2bck", - "createdAt": "2023-10-02T07:13:19.444Z", - "updatedAt": "2023-10-02T07:13:19.444Z" - } - } - ``` - - ```json {{ title: '404 Not Found' }} - { - "code": "not_found", - "message": "Person not found", - "details": { - "resource_id": "clmlmykc2000019vz5o3jglsa", - "resource_type": "Person" - } - } - ``` - - - - - ---- - -## Delete Person {{ tag: 'DELETE', label: '/api/v1/management/people/' }} - - - - - Delete Person by ID - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl -X DELETE https://app.formbricks.com/api/v1/management/people/ \ - --header 'x-api-key: ' - ``` - - - - - ```json {{title:'200 Success'}} - { - "data": { - "success": "Person deleted successfully" - } - } - ``` - - ```json {{ title: '404 Not Found' }} - { - "code": "not_found", - "message": "Person not found", - "details": { - "resource_id": "clmlmykc2000019vz5o3jglsa", - "resource_type": "Person" - } - } - ``` - - - - - ---- diff --git a/apps/formbricks-com/app/docs/api/management/responses/page.mdx b/apps/formbricks-com/app/docs/api/management/responses/page.mdx deleted file mode 100644 index 0fcbdb5d0e..0000000000 --- a/apps/formbricks-com/app/docs/api/management/responses/page.mdx +++ /dev/null @@ -1,379 +0,0 @@ -import { Fence } from "@/components/shared/Fence"; -import { generateManagementApiMetadata } from "@/lib/utils"; - -export const metadata = generateManagementApiMetadata("Responses", ["Fetch", "Delete"]); - -#### Management API - -# Responses API - -This set of API can be used to - -- [List Responses](#list-all-responses) -- [List all Responses by surveyId](#list-all-responses-by-survey-id) -- [Get Response](#get-response-by-id) -- [Delete Response](#delete-a-response) - -You will need an API Key to interact with these APIs. - ---- - -## List all Responses {{ tag: 'GET', label: '/api/v1/management/responses' }} - - - - - Retrieve all the responses you have received in your environment. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl --location \ - 'https://app.formbricks.com/api/v1/management/responses' \ - --header \ - 'x-api-key: ' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data":[ - { - "id": "cln8k0tqv00pcz87no4qrw333", - "createdAt": "2023-10-02T07:13:20.023Z", - "updatedAt": "2023-10-02T07:13:20.023Z", - "surveyId": "cln8k0tqu00p7z87nqr4thi3k", - "finished": true, - "data": { - "interview-prompt": "clicked" - }, - "meta": { - "userAgent": { - "os": "MacOS", - "browser": "Chrome" - } - }, - "personAttributes": null, - "person": { - "id": "e0x4i5tvsp8puxfztyrwykvn", - "attributes": { - "userId": "CYO675", - "email": "ravi@netflix.com", - "Name": "Ravi Kumar", - "Role": "Manager", - "Company": "Netflix", - "Experience": "6 years", - "Usage Frequency": "Monthly", - "Company Size": "4610 employees", - "Product Satisfaction Score": "43", - "Recommendation Likelihood": "4" - }, - "environmentId": "cln8k0t47000fz87njmmu2bck", - "createdAt": "2023-10-02T07:13:19.444Z", - "updatedAt": "2023-10-02T07:13:19.444Z" - }, - "notes": [], - "tags": [] - }, - ] - } - ``` - - ```json {{ title: '401 Not Authenticated' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - ---- - -## List all Responses by surveyId {{ tag: 'GET', label: '/api/v1/management/responses?surveyId=' }} - - - - - Retrieve all the responses received in your survey. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl --location \ - 'https://app.formbricks.com/api/v1/management/responses?surveyId=' \ - --header \ - 'x-api-key: ' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data":[ - { - "id": "cln8k0tqv00pcz87no4qrw333", - "createdAt": "2023-10-02T07:13:20.023Z", - "updatedAt": "2023-10-02T07:13:20.023Z", - "surveyId": "cln8k0tqu00p7z87nqr4thi3k", - "finished": true, - "data": { - "interview-prompt": "clicked" - }, - "meta": { - "userAgent": { - "os": "MacOS", - "browser": "Chrome" - } - }, - "personAttributes": null, - "person": { - "id": "e0x4i5tvsp8puxfztyrwykvn", - "attributes": { - "userId": "CYO675", - "email": "ravi@netflix.com", - "Name": "Ravi Kumar", - "Role": "Manager", - "Company": "Netflix", - "Experience": "6 years", - "Usage Frequency": "Monthly", - "Company Size": "4610 employees", - "Product Satisfaction Score": "43", - "Recommendation Likelihood": "4" - }, - "environmentId": "cln8k0t47000fz87njmmu2bck", - "createdAt": "2023-10-02T07:13:19.444Z", - "updatedAt": "2023-10-02T07:13:19.444Z" - }, - "notes": [], - "tags": [] - }, - ] - } - ``` - - ```json {{ title: '401 Not Authenticated' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - ---- - -## Get Response by ID {{ tag: 'GET', label: '/api/v1/management/responses/' }} - - - - - Retrieve a response by its ID. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl --location \ - 'https://app.formbricks.com/api/v1/management/responses/' \ - --header \ - 'x-api-key: ' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": - { - "id": "cln8k0tqv00pbz87nwo5lr72b", - "createdAt": "2023-10-02T07:13:20.023Z", - "updatedAt": "2023-10-02T07:13:20.023Z", - "surveyId": "cln8k0tqu00p7z87nqr4thi3k", - "finished": true, - "data": { - "interview-prompt": "clicked" - }, - "meta": { - "userAgent": { - "os": "Windows", - "browser": "Edge" - } - }, - "personAttributes": null, - "person": { - "id": "hsx38f15v50ua8383uadagq5", - "attributes": { - "userId": "CYO278", - "email": "jorge@facebook.com", - "Name": "Jorge Sanchez", - "Role": "Product Manager", - "Company": "Facebook", - "Experience": "10 years", - "Usage Frequency": "Daily", - "Company Size": "1685 employees", - "Product Satisfaction Score": "84", - "Recommendation Likelihood": "6" - }, - "environmentId": "cln8k0t47000fz87njmmu2bck", - "createdAt": "2023-10-02T07:13:19.444Z", - "updatedAt": "2023-10-02T07:13:19.444Z" - }, - "notes": [], - "tags": [] - } - } - ``` - - ```json {{ title: '401 Not Authenticated' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - ---- - -## Delete a response {{ tag: 'DELETE', label: '/api/v1/client/responses/' }} - - - - - Delete Response by ID - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl -X DELETE https://app.formbricks.com/api/v1/management/responses/ \ - --header 'x-api-key: ' - ``` - - - - - - ```json {{ title: '200 Success' }} - { - "data": { - "id": "cln8k0tqv00pbz87nwo5lr72b", - "createdAt": "2023-10-02T07:13:20.023Z", - "updatedAt": "2023-10-02T07:13:20.023Z", - "surveyId": "cln8k0tqu00p7z87nqr4thi3k", - "finished": true, - "data": { - "interview-prompt": "clicked" - }, - "meta": { - "userAgent": { - "os": "Windows", - "browser": "Edge" - } - }, - "personAttributes": null, - "person": { - "id": "hsx38f15v50ua8383uadagq5", - "attributes": { - "userId": "CYO278", - "email": "jorge@facebook.com", - "Name": "Jorge Sanchez", - "Role": "Product Manager", - "Company": "Facebook", - "Experience": "10 years", - "Usage Frequency": "Daily", - "Company Size": "1685 employees", - "Product Satisfaction Score": "84", - "Recommendation Likelihood": "6" - }, - "environmentId": "cln8k0t47000fz87njmmu2bck", - "createdAt": "2023-10-02T07:13:19.444Z", - "updatedAt": "2023-10-02T07:13:19.444Z" - }, - "notes": [], - "tags": [] - } - } - ``` - - ```json {{ title: '400 Bad Request' }} - { - "code": "bad_request", - "message": "surveyId was not provided.", - "details": { - "surveyId": "This field is required." - } - } - ``` - - - - - - ---- diff --git a/apps/formbricks-com/app/docs/api/management/surveys/page.mdx b/apps/formbricks-com/app/docs/api/management/surveys/page.mdx deleted file mode 100644 index d15dcb1ef5..0000000000 --- a/apps/formbricks-com/app/docs/api/management/surveys/page.mdx +++ /dev/null @@ -1,789 +0,0 @@ -import { Fence } from "@/components/shared/Fence"; -import { generateManagementApiMetadata } from "@/lib/utils"; - -export const metadata = generateManagementApiMetadata("Surveys", ["Fetch", "Create", "Update", "Delete"]); - -#### Management API - -# Surveys API - -This set of API can be used to - -- [List All Surveys](#list-all-surveys) -- [Get Survey](#get-survey-by-id) -- [Create Survey](#create-survey) -- [Update Survey](#update-survey-by-id) -- [Delete Survey](#delete-survey-by-id) - -You will need an API Key to interact with these APIs. - ---- - -## List all surveys {{ tag: 'GET', label: '/api/v1/management/surveys' }} - - - - Retrieve all the surveys you have for the environment with pagination. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - ### Query Parameters - - - The number of surveys to skip before returning the results. - - - - The number of surveys to return. - - - - - - - - - ```bash {{ title: 'cURL' }} - - curl --location \ - 'https://app.formbricks.com/api/v1/management/surveys?offset=20&limit=10' \ - --header \ - 'x-api-key: ' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": [ - { - "id": "cllnfy2780fromy0hy7uoxvtn", - "createdAt": "2023-08-23T07:56:20.516Z", - "updatedAt": "2023-08-23T07:56:26.947Z", - "name": "Product Market Fit (Superhuman)", - "type": "link", - "environmentId": "cll2m30r70004mx0huqkitgqv", - "status": "inProgress", - "attributeFilters": [], - "displayOption": "displayOnce", - "autoClose": null, - "triggers": [], - "redirectUrl": null, - "recontactDays": null, - "questions": [ - { - "id": "gml6mgy71efgtq8np3s9je5p", - "type": "cta", - "headline": "You are one of our power users! Do you have 5 minutes?", - "required": false, - "buttonLabel": "Happy to help!", - "logic": [ - { - "condition": "skipped", - "destination": "end" - } - ], - "html": "

We would love to understand your user experience better. Sharing your insight helps a lot.

", - "buttonExternal": false, - "dismissButtonLabel": "No, thanks." - }, - { - "id": "kp62fbqe8cfzmvy8qwpr81b2", - "type": "multipleChoiceSingle", - "headline": "How disappointed would you be if you could no longer use My Product?", - "subheader": "Please select one of the following options:", - "required": true, - "choices": [ - { - "id": "bdgy1hnwd7uwmfxk1ljqp1n5", - "label": "Not at all disappointed" - }, - { - "id": "poabnvgtwenp8rb2v70gj4hj", - "label": "Somewhat disappointed" - }, - { - "id": "opfiqyqz8wrqn0i0f7t24d3n", - "label": "Very disappointed" - } - ], - "shuffleOption": "none" - }, - { - "id": "klvpwd4x08x8quesihvw5l92", - "type": "multipleChoiceSingle", - "headline": "What is your role?", - "subheader": "Please select one of the following options:", - "required": true, - "choices": [ - { - "id": "c8nerw6l9gpsxcmqkn10f9hy", - "label": "Founder" - }, - { - "id": "ebjqezei6a2axtuq86cleetn", - "label": "Executive" - }, - { - "id": "ctiijjblyhlp22snypfamqt1", - "label": "Product Manager" - }, - { - "id": "ibalyr0mhemfkkr82vypmg40", - "label": "Product Owner" - }, - { - "id": "fipk606aegslbd0e7yhc0xjx", - "label": "Software Engineer" - } - ], - "shuffleOption": "none" - }, - { - "id": "ryo75306flyg72iaeditbv51", - "type": "openText", - "headline": "What type of people do you think would most benefit from My Product?", - "required": true - }, - { - "id": "lkjaxb73ulydzeumhd51sx9g", - "type": "openText", - "headline": "What is the main benefit you receive from My Product?", - "required": true - }, - { - "id": "ec7agikkr58j8uonhioinkyk", - "type": "openText", - "headline": "How can we improve My Product for you?", - "subheader": "Please be as specific as possible.", - "required": true - } - ], - "thankYouCard": { - "enabled": true, - "headline": "Thank you!", - "subheader": "We appreciate your feedback." - }, - "delay": 0, - "autoComplete": null, - "closeOnDate": null - } - ] - } - ``` - ```json {{ title: '401 Not Authenticated' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` -
- - -
- ---- - -## Get Survey by ID {{ tag: 'GET', label: '/api/v1/management/surveys/' }} - - - - - Get a specific survey by its ID. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl --location \ - 'https://app.formbricks.com/api/v1/management/surveys/' \ - --header \ - 'x-api-key: ' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": { - "id": "cln8k0tjz00n5z87nwq527h3z", - "createdAt": "2023-10-02T07:13:19.775Z", - "updatedAt": "2023-10-02T07:13:19.775Z", - "name": "Churn Survey", - "type": "link", - "environmentId": "cln8k0t47000fz87njmmu2bck", - "status": "inProgress", - "attributeFilters": [], - "displayOption": "displayOnce", - "autoClose": null, - "triggers": [], - "redirectUrl": null, - "recontactDays": null, - "questions": [ - { - "id": "churn-reason", - "type": "multipleChoiceSingle", - "headline": "Why did you cancel your subscription?", - "subheader": "We're sorry to see you leave. Help us do better:", - "required": true, - "logic": [ - { - "condition": "equals", - "value": "Difficult to use", - "destination": "easier-to-use" - }, - { - "condition": "equals", - "value": "It's too expensive", - "destination": "30-off" - }, - { - "condition": "equals", - "value": "I am missing features", - "destination": "missing-features" - }, - { - "condition": "equals", - "value": "Poor customer service", - "destination": "poor-service" - }, - { - "condition": "equals", - "value": "I just didn't need it anymore", - "destination": "end" - } - ], - "choices": [ - { - "id": "isud2xethsw63dlwl89kr4kj", - "label": "Difficult to use" - }, - { - "id": "opuu4ba3dlele3n0gjkuh27c", - "label": "It's too expensive" - }, - { - "id": "gnypapo0rhvkt8pwosrphvbl", - "label": "I am missing features" - }, - { - "id": "wkgsrsrazd9kfunqhzjezx6t", - "label": "Poor customer service" - }, - { - "id": "pykmgyyw74vg0gaeryj6bo4c", - "label": "I just didn't need it anymore" - } - ] - }, - { - "id": "easier-to-use", - "type": "openText", - "headline": "What would have made {{productName}} easier to use?", - "subheader": "", - "required": true, - "buttonLabel": "Send", - "logic": [ - { - "condition": "submitted", - "destination": "end" - } - ] - }, - { - "id": "30-off", - "type": "cta", - "headline": "Get 30% off for the next year!", - "required": true, - "buttonLabel": "Get 30% off", - "logic": [ - { - "condition": "clicked", - "destination": "end" - } - ], - "html": "

We'd love to keep you as a customer. Happy to offer a 30% discount for the next year.

", - "buttonUrl": "https://formbricks.com", - "buttonExternal": true, - "dismissButtonLabel": "Skip" - }, - { - "id": "missing-features", - "type": "openText", - "headline": "What features are you missing?", - "subheader": "", - "required": true, - "logic": [ - { - "condition": "submitted", - "destination": "end" - } - ] - }, - { - "id": "poor-service", - "type": "cta", - "headline": "So sorry to hear 😔 Talk to our CEO directly!", - "required": true, - "buttonLabel": "Send email to CEO", - "logic": [ - { - "condition": "clicked", - "destination": "end" - } - ], - "html": "

We aim to provide the best possible customer service. Please email our CEO and she will personally handle your issue.

", - "buttonUrl": "mailto:ceo@company.com", - "buttonExternal": true, - "dismissButtonLabel": "Skip" - } - ], - "thankYouCard": { - "enabled": false - }, - "delay": 0, - "autoComplete": null, - "closeOnDate": null, - "surveyClosedMessage": null, - "verifyEmail": null - } - } - ``` - ```json {{ title: '401 Not Authenticated' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` -
- - -
- ---- - -## Create Survey {{ tag: 'POST', label: '/api/v1/management/surveys' }} - - - - - Create a survey - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - ### Body - - - ```json {{ title: 'cURL' }} - { - "environmentId": "clmlmwdqq0003196ufewo6ibg", - "type": "link", - "name": "My new Survey" - } - ``` - - - - - - - - ```bash {{ title: 'cURL' }} - curl -X POST \ - 'https://app.formbricks.com/api/v1/management/surveys' \ - --header \ - 'x-api-key: ' - ``` - - ```bash {{ title: 'cURL' }} - curl -X POST https://app.formbricks.com/api/v1/management/surveys/ \ - --header 'Content-Type: application/json' \ - --header 'x-api-key: ' \ - -d '{"environmentId": "cln8k0t47000fz87njmmu2bck", "name": "My Survey from API", "type": "link"}' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": { - "id": "clna6bqnz000az8zubq3e757t", - "createdAt": "2023-10-03T10:25:26.975Z", - "updatedAt": "2023-10-03T10:25:26.975Z", - "name": "My new Survey", - "redirectUrl": null, - "type": "link", - "environmentId": "cln8k0t47000fz87njmmu2bck", - "status": "draft", - "questions": [], - "thankYouCard": { - "enabled": false - }, - "displayOption": "displayOnce", - "recontactDays": null, - "autoClose": null, - "delay": 0, - "autoComplete": null, - "closeOnDate": null, - "surveyClosedMessage": null, - "verifyEmail": null - } - } - ``` - - ```json {{ title: '401 Not Authenticated' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - ---- - -## Update Survey by ID {{ tag: 'PUT', label: '/api/v1/management/surveys/' }} - - - - - Update a survey by its ID - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - ### Body - - - ```json {{ title: 'cURL' }} - { - "name": "My renamed Survey", - "redirectUrl":"https://formbricks.com", - "type":"web" - } - ``` - - - - - - - - ```bash {{ title: 'cURL' }} - curl -X PUT https://app.formbricks.com/api/v1/management/surveys/ \ - --header 'Content-Type: application/json' \ - --header 'x-api-key: ' \ - -d '{"name": "My renamed Survey"}' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": { - "id": "cloqzeuu70000z8khcirufo60", - "createdAt": "2023-11-09T09:23:42.367Z", - "updatedAt": "2023-11-09T09:23:42.367Z", - "name": "My renamed Survey", - "redirectUrl": null, - "type": "link", - "environmentId": "clonzr6vc0009z8md7y06hipl", - "status": "inProgress", - "welcomeCard": { - "html": "Thanks for providing your feedback - let's go!", - "enabled": false, - "headline": "Welcome!", - "timeToFinish": false - }, - "questions": [ - { - "id": "l9rwn5nbk48y44tvnyyjcvca", - "type": "openText", - "headline": "Why did you leave the platform?", - "required": true, - "inputType": "text" - } - ], - "thankYouCard": { - "enabled": true, - "headline": "Thank you!", - "subheader": "We appreciate your feedback." - }, - "hiddenFields": { - "enabled": true, - "fieldIds": [] - }, - "displayOption": "displayOnce", - "recontactDays": null, - "autoClose": null, - "delay": 0, - "autoComplete": 50, - "closeOnDate": null, - "surveyClosedMessage": null, - "productOverwrites": null, - "singleUse": { - "enabled": false, - "isEncrypted": true - }, - "verifyEmail": null, - "pin": null, - "triggers": [], - "attributeFilters": [] - } - } - ``` - - ```json {{ title: '401 Not Authenticated' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - ---- - -## Delete Survey by ID {{ tag: 'DELETE', label: '/api/v1/management/surveys/' }} - - - - - Delete a survey by its ID. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl -X DELETE \ - 'https://app.formbricks.com/api/v1/management/surveys/' \ - --header \ - 'x-api-key: ' - ``` - - - - - - ```json {{title:'200 Success'}} - { - "data": { - "id": "cln8k0tjz00n5z87nwq527h3z", - "createdAt": "2023-10-02T07:13:19.775Z", - "updatedAt": "2023-10-02T07:13:19.775Z", - "name": "Churn Survey", - "type": "link", - "environmentId": "cln8k0t47000fz87njmmu2bck", - "status": "inProgress", - "attributeFilters": [], - "displayOption": "displayOnce", - "autoClose": null, - "triggers": [], - "redirectUrl": null, - "recontactDays": null, - "questions": [ - { - "id": "churn-reason", - "type": "multipleChoiceSingle", - "headline": "Why did you cancel your subscription?", - "subheader": "We're sorry to see you leave. Help us do better:", - "required": true, - "logic": [ - { - "condition": "equals", - "value": "Difficult to use", - "destination": "easier-to-use" - }, - { - "condition": "equals", - "value": "It's too expensive", - "destination": "30-off" - }, - { - "condition": "equals", - "value": "I am missing features", - "destination": "missing-features" - }, - { - "condition": "equals", - "value": "Poor customer service", - "destination": "poor-service" - }, - { - "condition": "equals", - "value": "I just didn't need it anymore", - "destination": "end" - } - ], - "choices": [ - { - "id": "isud2xethsw63dlwl89kr4kj", - "label": "Difficult to use" - }, - { - "id": "opuu4ba3dlele3n0gjkuh27c", - "label": "It's too expensive" - }, - { - "id": "gnypapo0rhvkt8pwosrphvbl", - "label": "I am missing features" - }, - { - "id": "wkgsrsrazd9kfunqhzjezx6t", - "label": "Poor customer service" - }, - { - "id": "pykmgyyw74vg0gaeryj6bo4c", - "label": "I just didn't need it anymore" - } - ] - }, - { - "id": "easier-to-use", - "type": "openText", - "headline": "What would have made {{productName}} easier to use?", - "subheader": "", - "required": true, - "buttonLabel": "Send", - "logic": [ - { - "condition": "submitted", - "destination": "end" - } - ] - }, - { - "id": "30-off", - "type": "cta", - "headline": "Get 30% off for the next year!", - "required": true, - "buttonLabel": "Get 30% off", - "logic": [ - { - "condition": "clicked", - "destination": "end" - } - ], - "html": "

We'd love to keep you as a customer. Happy to offer a 30% discount for the next year.

", - "buttonUrl": "https://formbricks.com", - "buttonExternal": true, - "dismissButtonLabel": "Skip" - }, - { - "id": "missing-features", - "type": "openText", - "headline": "What features are you missing?", - "subheader": "", - "required": true, - "logic": [ - { - "condition": "submitted", - "destination": "end" - } - ] - }, - { - "id": "poor-service", - "type": "cta", - "headline": "So sorry to hear 😔 Talk to our CEO directly!", - "required": true, - "buttonLabel": "Send email to CEO", - "logic": [ - { - "condition": "clicked", - "destination": "end" - } - ], - "html": "

We aim to provide the best possible customer service. Please email our CEO and she will personally handle your issue.

", - "buttonUrl": "mailto:ceo@company.com", - "buttonExternal": true, - "dismissButtonLabel": "Skip" - } - ], - "thankYouCard": { - "enabled": false - }, - "delay": 0, - "autoComplete": null, - "closeOnDate": null, - "surveyClosedMessage": null, - "verifyEmail": null - } - } - ``` - ```json {{ title: '401 Not Authenticated' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` -
- - -
- ---- diff --git a/apps/formbricks-com/app/docs/api/management/webhooks/page.mdx b/apps/formbricks-com/app/docs/api/management/webhooks/page.mdx deleted file mode 100644 index a4efd78cf9..0000000000 --- a/apps/formbricks-com/app/docs/api/management/webhooks/page.mdx +++ /dev/null @@ -1,398 +0,0 @@ -import {generateManagementApiMetadata} from "@/lib/utils" - -export const metadata = generateManagementApiMetadata("Webhook",["Fetch","Create","Delete"]) - -#### Management API - -# Webhook API - -Formbricks' Webhook API offers a powerful interface for interacting with webhooks. Webhooks allow you to receive real-time HTTP notifications of changes to specific objects in the Formbricks environment. - -The behavior of the webhooks is determined by their trigger settings. The trigger determines which updates the webhook sends. Current available triggers include "responseCreated", "responseUpdated", and "responseFinished". This allows you to customize your webhooks to only send notifications for the events that are relevant to your application. - -Webhooks are tied to a specific Formbricks environment. Once set, a webhook will receive updates from all surveys within this environment. This makes it easy to manage your data flow and ensure that all relevant updates are caught by the webhook. - -This set of API can be used to -- [List All Webhooks](#list-webhooks) -- [Get Webhook](#retrieve-webhook-by-id) -- [Create Webhook](#create-webhook) -- [Delete Webhook](#delete-webhook-by-id) - -And the detailed Webhook Payload is elaborated [here](#webhook-payload). - -These APIs are designed to facilitate seamless integration of Formbricks with third-party systems. By making use of our webhook API, you can automate the process of sending data to these systems whenever significant events occur within your Formbricks environment. - -You will need an API Key to interact with these APIs. - ---- - -## List Webhooks {{ tag: 'GET', label: '/api/v1/webhooks' }} - - - - - Learn how to retrieve a list of all webhooks via API. - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl --location \ - 'https://app.formbricks.com/api/v1/webhooks' \ - --header \ - 'x-api-key: ' - ``` - - - - - - ```json {{ title: '200 Success' }} - { - "data": [ - { - "id": "cliu1kdza000219zftad4ip6c", - "createdAt": "2023-06-13T08:49:04.198Z", - "updatedAt": "2023-06-13T08:49:04.198Z", - "url": "https://mysystem.com/myendpoint", - "environmentId": "clisypjy4000319t4imm289uo", - "triggers": [ - "responseFinished" - ] - } - ] - } - ``` - - ```json {{ title: '401 Not Authenticated' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - - ---- - -## Retrieve Webhook by ID {{ tag: 'GET', label: '/api/v1/webhooks/' }} - - - - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl --location \ - 'https://app.formbricks.com/api/v1/webhooks/' \ - --header \ - 'x-api-key: ' - ``` - - - - - - ```json {{ title: '200 Success' }} - { - "data": { - "id": "cliu167rk000019zfhbo68bar", - "createdAt": "2023-06-13T08:38:02.960Z", - "updatedAt": "2023-06-13T08:38:02.960Z", - "url": "https://mysystem.com/myendpoint", - "environmentId": "clisypjy4000319t4imm289uo", - "triggers": [ - "responseFinished" - ] - } - } - ``` - - ```json {{ title: '401 Not Authenticated' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - - ---- - -## Create Webhook {{ tag: 'POST', label: '/api/v1/webhooks' }} - -Add a webhook to your product. - - - - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - ### Request Body Parameters - - - - The URL where the webhook will send data to. - - - List of events that will trigger the webhook. - - - List of survey IDs that will trigger the webhook. If not provided, the webhook will be triggered for all surveys. - - - -| field name | required | default | description | -| ---------- | -------- | ------- | ----------------------------------------------------------------------------------------------------------------- | -| url | yes | - | The endpoint that the webhook will send data to | -| trigger | yes | - | The event that will trigger the webhook ("responseCreated" or "responseUpdated" or "responseFinished") | -| surveyIds | no | - | List of survey IDs that will trigger the webhook. If not provided, the webhook will be triggered for all surveys. | - - - - - - - ```bash {{ title: 'cURL' }} - curl --location --request POST 'https://app.formbricks.com/api/v1/webhooks' \ - --header 'x-api-key: ' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "url": "https://mysystem.com/myendpoint", - "triggers": ["responseFinished"] - }' - ``` - - ```json {{ title: 'Example Request Body' }} - { - "url": "https://mysystem.com/myendpoint", - "triggers": ["responseFinished"] - } - ``` - - - - - - ```json {{ title: '200 Success' }} - { - "data": { - "id": "cliu1kdza000219zftad4ip6c", - "createdAt": "2023-06-13T08:49:04.198Z", - "updatedAt": "2023-06-13T08:49:04.198Z", - "url": "https://mysystem.com/myendpoint", - "environmentId": "clisypjy4000319t4imm289uo", - "triggers": ["responseFinished"], - "surveyIds": ["clisypjy4000319t4imm289uo"] - } - } - ``` - - ```json {{ title: '400 Bad Request' }} - { - "code": "bad_request", - "message": "Missing trigger", - "details": { - "missing_field": "trigger" - } - } - ``` - - ```json {{ title: '401 Not Authenticated' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - - - - - ---- - -## Delete Webhook by ID {{ tag: 'DELETE', label: '/api/v1/webhooks/' }} - - - - - ### Mandatory Headers - - - - Your Formbricks API key. - - - - - - - - - ```bash {{ title: 'cURL' }} - curl --location --request DELETE 'https://app.formbricks.com/api/v1/webhooks/' \ - --header 'x-api-key: ' - ``` - - - - - - ```json {{ title: '200 Success' }} - { - "data": { - "id": "cliu167rk000019zfhbo68bar", - "createdAt": "2023-06-13T08:38:02.960Z", - "updatedAt": "2023-06-13T08:38:02.960Z", - "url": "https://mysystem.com/myendpoint", - "environmentId": "clisypjy4000319t4imm289uo", - "triggers": ["responseFinished"] - } - } - ``` - - ```json {{ title: '401 Not Authenticated' }} - { - "code": "not_authenticated", - "message": "Not authenticated", - "details": { - "x-Api-Key": "Header not provided or API Key invalid" - } - } - ``` - - ```json {{ title: '404 Not Found' }} - { - "code": "not_found", - "message": "Webhook not found.", - "details": { - "webhookId": "The requested webhook does not exist." - } - } - ``` - - - - - - ---- - -## Webhook Payload - -This documentation helps understand the payload structure that will be received when the webhook is triggered in Formbricks. - - - - -| Variable | Type | Description | -| --------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| webhookId | String | Webhook's Id | -| event | String | The name of the trigger event [responseCreated, responseUpdated, responseFinished] | -| data | Object | Contains the details of the newly created response. | -| data.id | String | Formbricks Response ID. | -| data.createdAt | String | The timestamp when the response was created. | -| data.updatedAt | String | The timestamp when the response was last updated. | -| data.surveyId | String | The identifier of the survey associated with this response. | -| data.finished | Boolean | A boolean value indicating whether the survey response is marked as finished. | -| data.data | Object | An object containing the response data, where keys are question identifiers, and values are the corresponding answers given by the respondent. | -| data.meta | Object | Additional metadata related to the response, such as the user's operating system and browser information. | -| data.personAttributes | Object | An object with attributes related to the respondent, such as their email and a user ID (if available). | -| data.person | Object | Information about the respondent, including their unique id, attributes, and creation/update timestamps. | -| data.notes | Array | An array of notes associated with the response (if any). | -| data.tags | Array | An array of tags assigned to the response (if any). | - - - - - ### An example webhook payload - - - - ```json - { - "webhookId": "cljwxvjos0003qhnvj2jg4k5i", - "event": "responseCreated", - "data": { - "id": "cljwy2m8r0001qhclco1godnu", - "createdAt": "2023-07-10T14:14:17.115Z", - "updatedAt": "2023-07-10T14:14:17.115Z", - "surveyId": "cljsf3d7a000019cv9apt2t27", - "finished": false, - "data": { - "qumbk3fkr6cky8850bvvq5z1": "Executive" - }, - "meta": { - "userAgent": { - "os": "Mac OS", - "browser": "Chrome" - } - }, - "personAttributes": { - "email": "test@web.com", - "userId": "THIS-IS-A-VERY-LONG-USER-ID-FOR-TESTING" - }, - "person": { - "id": "cljold01t0000qh8ewzigzmjk", - "attributes": { - "email": "test@web.com", - "userId": "THIS-IS-A-VERY-LONG-USER-ID-FOR-TESTING" - }, - "createdAt": "2023-07-04T17:56:17.154Z", - "updatedAt": "2023-07-04T17:56:17.154Z" - }, - "notes": [], - "tags": [] - } - } - ``` - - - - - - ---- diff --git a/apps/formbricks-com/app/docs/integrations/make/page.mdx b/apps/formbricks-com/app/docs/integrations/make/page.mdx index aa34b22228..84efb9ea6d 100644 --- a/apps/formbricks-com/app/docs/integrations/make/page.mdx +++ b/apps/formbricks-com/app/docs/integrations/make/page.mdx @@ -95,7 +95,7 @@ Click "Create a webhook": className="max-w-full rounded-lg sm:max-w-3xl" /> -Enter the Formbricks API key. Learn how to get one from the [API Key tutorial](/docs/api/management/api-key-setup). +Enter the Formbricks API key. Learn how to get one from the [API Key tutorial](/docs/additional-features/api#how-to-generate-an-api-key). -Now you need an API key. Please refer to the [API Key Setup](/docs/api/management/api-key-setup) page to learn how to create one. +Now you need an API key. Please refer to the [API Key Setup](/docs/additional-features/api#how-to-generate-an-api-key) page to learn how to create one. Once you copied it in the API Key field, hit Save button to test the connection and save the credentials. diff --git a/apps/formbricks-com/app/docs/integrations/zapier/page.mdx b/apps/formbricks-com/app/docs/integrations/zapier/page.mdx index 2fa9005de0..1d65d346d9 100644 --- a/apps/formbricks-com/app/docs/integrations/zapier/page.mdx +++ b/apps/formbricks-com/app/docs/integrations/zapier/page.mdx @@ -93,7 +93,7 @@ Now, you have to connect Zapier with Formbricks via an API Key: className="max-w-full rounded-lg sm:max-w-3xl" /> -Now you need an API key. Please refer to the [API Key Setup](/docs/api/management/api-key-setup) page to learn how to create one. +Now you need an API key. Please refer to the [API Key Setup](/docs/additional-features/api#how-to-generate-an-api-key) page to learn how to create one. Once you copied it in the newly opened Zapier window, you will be connected: diff --git a/apps/formbricks-com/components/docs/Navigation.tsx b/apps/formbricks-com/components/docs/Navigation.tsx index a7106beddd..d3f8b042c9 100644 --- a/apps/formbricks-com/components/docs/Navigation.tsx +++ b/apps/formbricks-com/components/docs/Navigation.tsx @@ -215,7 +215,10 @@ export const navigation: Array = [ }, { title: "Additional Features", - links: [{ title: "Multi Language Surveys", href: "/docs/additional-features/multi-language-surveys" }], + links: [ + { title: "Multi Language Surveys", href: "/docs/additional-features/multi-language-surveys" }, + { title: "API", href: "/docs/additional-features/api" }, + ], }, { title: "Best Practices", @@ -267,29 +270,6 @@ export const navigation: Array = [ { title: "FAQ", href: "/docs/faq" }, ], }, - { - title: "Client API", - links: [ - { title: "Overview", href: "/docs/api/client/overview" }, - { title: "Actions", href: "/docs/api/client/actions" }, - { title: "Displays", href: "/docs/api/client/displays" }, - { title: "People", href: "/docs/api/client/people" }, - { title: "Responses", href: "/docs/api/client/responses" }, - ], - }, - { - title: "Management API", - links: [ - { title: "API Key Setup", href: "/docs/api/management/api-key-setup" }, - { title: "Action Classes", href: "/docs/api/management/action-classes" }, - { title: "Attribute Classes", href: "/docs/api/management/attribute-classes" }, - { title: "Me", href: "/docs/api/management/me" }, - { title: "People", href: "/docs/api/management/people" }, - { title: "Responses", href: "/docs/api/management/responses" }, - { title: "Surveys", href: "/docs/api/management/surveys" }, - { title: "Webhooks", href: "/docs/api/management/webhooks" }, - ], - }, ]; export function Navigation(props: React.ComponentPropsWithoutRef<"nav">) { diff --git a/apps/formbricks-com/next.config.mjs b/apps/formbricks-com/next.config.mjs index 496f2f20cf..daaa09df45 100644 --- a/apps/formbricks-com/next.config.mjs +++ b/apps/formbricks-com/next.config.mjs @@ -210,6 +210,11 @@ const nextConfig = { destination: "/blog", permanent: true, }, + { + source: '/docs/api/:slug*', + destination: '/docs/additional-features/api', + permanent: false, + } ]; }, };