mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 02:10:12 -06:00
140 lines
6.5 KiB
Plaintext
140 lines
6.5 KiB
Plaintext
import { MdxImage } from "@/components/MdxImage";
|
||
|
||
import AddApiKey from "./images/add-api-key.webp";
|
||
import ApiKeySecret from "./images/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:
|
||
|
||
<div className="max-w-full sm:max-w-3xl">
|
||
<a
|
||
target="_blank"
|
||
href="https://formbricks.postman.co/collection/11026000-927c954f-85a9-4f8f-b0ec-14191b903737?source=rip_html">
|
||
<img alt="Run in Postman" src="https://run.pstmn.io/button.svg" />
|
||
</a>
|
||
</div>
|
||
|
||
## 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”
|
||
<MdxImage src={AddApiKey} alt="Add API Key" quality="100" className="max-w-full rounded-lg sm:max-w-3xl" />
|
||
3. Create a key for the development or production environment.
|
||
4. Copy the key immediately. You won’t be able to see it again.
|
||
<MdxImage
|
||
src={ApiKeySecret}
|
||
alt="API Key Secret"
|
||
quality="100"
|
||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||
/>
|
||
|
||
<Note>
|
||
### 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.
|
||
</Note>
|
||
|
||
### 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' }}
|
||
|
||
<Row>
|
||
<Col>
|
||
|
||
Get the product details and environment type of your account.
|
||
|
||
### Mandatory Headers
|
||
|
||
<Properties>
|
||
<Property name="x-Api-Key" type="string">
|
||
Your Formbricks API key.
|
||
</Property>
|
||
</Properties>
|
||
|
||
### 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.
|
||
|
||
</Col>
|
||
<Col sticky>
|
||
|
||
<CodeGroup title="Request" tag="GET" label="/api/v1/me">
|
||
|
||
```bash {{ title: 'cURL' }}
|
||
curl --location \
|
||
'https://app.formbricks.com/api/v1/me' \
|
||
--header \
|
||
'x-api-key: <your-api-key>'
|
||
```
|
||
|
||
</CodeGroup>
|
||
|
||
<CodeGroup title="Response">
|
||
|
||
```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"
|
||
},
|
||
"appSetupCompleted": false,
|
||
"websiteSetupCompleted": false,
|
||
}
|
||
```
|
||
```json {{ title: '401 Not Authenticated' }}
|
||
Not authenticated
|
||
```
|
||
</CodeGroup>
|
||
|
||
</Col>
|
||
</Row>
|
||
|
||
Can’t figure it out? Join our [Discord](https://discord.com/invite/3YFcABF2Ts) and we'd be glad to assist you!
|
||
|
||
---
|