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

# Get Environment State

> Retrieves the environment state to be used in Formbricks SDKs **Cache Behavior**: This endpoint uses server-side caching with a **5-minute TTL (Time To Live)**. Any changes to surveys, action classes, project settings, or other environment data will take up to 5 minutes to reflect in the API response. This caching is implemented to improve performance for high-frequency SDK requests.



## OpenAPI

````yaml /api-reference/openapi.json get /api/v1/client/{environmentId}/environment
openapi: 3.0.0
info:
  description: >-
    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](https://formbricks.com/docs/api/management/api-key-setup) - to access
    the Management APIs wit an API Key.


    > If you have forked the collection & running it, we recommend you to
    atleast update `apiKey` & `environmentId` the Collection variables as per
    your values! We also have a lot of post-run scripts written to help you
    navigate through auto-assigning variables when running scripts. 
      

    Need more help, visit our: [Website](https://formbricks.com) or join our
    [Discord](https://formbricks.com/discord)!
  title: API Documentation
  version: 1.0.0
servers:
  - url: https://{baseurl}
    variables:
      baseurl:
        default: app.formbricks.com
security: []
tags:
  - description: >-
      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.

      - Displays API - Mark Survey as Displayed or Responded for a Person

      - Responses API - Create & update responses for a survey

      - Environment API - Get the environment state to be used in Formbricks
      SDKs

      - Contacts API - Identify & update contacts (e.g. attributes)

      - User API - Identify & track users based on their attributes, device
      type, etc.
    name: Client API
  - description: >-
      Displays are metrics used to measure the number of times a survey was
      viewed both by unidentified or identified users.
    name: Client API - Display
  - description: >-
      Responses are captured whenever a user fills in your survey either
      partially or completely.
    name: Client API - Response
  - description: Get the environment state to be used in Formbricks SDKs
    name: Client API - Environment
  - description: >-
      Contacts are the identified users on Formbricks app that get initated when
      you pass a userId and have user activation enabled. This now allows you to
      track & show them targeted surveys based on their attributes, device type,
      etc.
    name: Client API - Contacts
  - description: >-
      Users are the identified users on Formbricks app that get initated when
      you pass a userId and have user activation enabled. This now allows you to
      track & show them targeted surveys based on their attributes, device type,
      etc. Currently, this api is only being used in the react-native sdk.
    name: Client API - User
  - description: >-
      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.


      > **For Auth:** we use the `x-api-key` header 
        

      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 app.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](https://formbricks.com/docs/api/management/api-key-setup).
    name: Management API
  - description: >-
      Action Classes allow you to set behaviour methods such as when a user
      clicks on a buy now button, or when a user leaves the page, etc. These
      allow you to trigger specific surveys to these users.


      Methods: Get All, Get, Create, Update, and Delete Action Classes
    name: Management API - Action Class
  - description: >-
      Attribute Classes help you categorize attributes so that you can target
      users based on specific values of their attributes. They are associated
      with a Person. Read more
      [here](https://formbricks.com/docs/in-app-surveys/attributes)
    name: Management API - Attribute Class
  - description: >-
      The Contacts API allows you to retrieve information about contacts in your
      environment. Contacts represent users who have interacted with your
      surveys or forms.
    name: Management API - Contacts
  - description: >-
      The Contact Attributes API allows you to retrieve information about
      attributes associated with contacts in your environment. These attributes
      can include custom properties and values assigned to your contacts.
    name: Management API - Contact Attributes
  - description: >-
      The Contact Attribute Keys API allows you to retrieve information about
      the defined attribute keys in your environment. These keys define the
      structure and properties that can be assigned to contacts, such as email,
      name, or custom attributes.
    name: Management API - Contact Attribute Keys
  - description: Retrieve Account Information
    name: Management API - Me
  - description: >-
      Enable User Identification in Formbricks to granularly target users to
      show surveys to without spraying across them. This API will help you
      utilise Formbricks User Identification to its maximum.


      Methods: Get All, Get, and Delete Persons
    name: Management API - People
  - description: >-
      Responses are what your users fill in as answers to a survey. Use this
      cautiosly and make sure you handle this data carefully.


      Methods allowed: Get All, Get by Survey, Get, Update, and Delete Responses
    name: Management API - Response
  - description: >-
      Surveys are the core of user data & feedback collection. We have various
      types of surveys to cater to you:


      - In-App Surveys
          
      - Website Surveys
          
      - Link Surveys
          

      Create surveys & then trigger them as per your actions & attribute
      filterings that you have set to make the most of them.


      Methods allowed: Get All, Get, Create, Update, and Delete Surveys
    name: Management API - Survey
  - description: >-
      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".
          

      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.

        

      Methods allowed: Get All, Get ,Create, and Delete Webhooks
    name: Management API - Webhook
paths:
  /api/v1/client/{environmentId}/environment:
    get:
      tags:
        - Client API - Environment
      summary: Get Environment State
      description: >-
        Retrieves the environment state to be used in Formbricks SDKs **Cache
        Behavior**: This endpoint uses server-side caching with a **5-minute TTL
        (Time To Live)**. Any changes to surveys, action classes, project
        settings, or other environment data will take up to 5 minutes to reflect
        in the API response. This caching is implemented to improve performance
        for high-frequency SDK requests.
      parameters:
        - description: The ID of the environment
          in: path
          name: environmentId
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    properties:
                      actionClasses:
                        example:
                          - id: cm6orqtdd000b19wjec82bpp2
                            key: null
                            name: New Session
                            noCodeConfig: null
                            type: automatic
                          - id: cm6oryki3000i19wj860utcnn
                            key: code
                            name: code action
                            noCodeConfig: null
                            type: code
                        items:
                          properties:
                            id:
                              example: cm6orqtdd000b19wjec82bpp2
                              type: string
                            key:
                              example: null
                              nullable: true
                              type: string
                            name:
                              example: New Session
                              type: string
                            noCodeConfig:
                              example: null
                              nullable: true
                              type: object
                            type:
                              example: automatic
                              type: string
                          type: object
                        type: array
                      project:
                        properties:
                          clickOutsideClose:
                            example: true
                            type: boolean
                          id:
                            example: cm6orqtcl000319wj9wb7dltl
                            type: string
                          inAppSurveyBranding:
                            example: true
                            type: boolean
                          overlay:
                            enum:
                              - none
                              - light
                              - dark
                            example: none
                            type: string
                          placement:
                            example: bottomRight
                            type: string
                          recontactDays:
                            example: 7
                            type: integer
                          styling:
                            properties:
                              allowStyleOverwrite:
                                example: true
                                type: boolean
                              brandColor:
                                properties:
                                  light:
                                    example: '#64748b'
                                    type: string
                                type: object
                            type: object
                        type: object
                      surveys:
                        description: List of surveys in the environment
                        items:
                          properties:
                            autoClose:
                              example: null
                              type: boolean
                            delay:
                              example: 0
                              type: integer
                            displayLimit:
                              example: 5
                              type: integer
                            displayOption:
                              example: respondMultiple
                              type: string
                            displayPercentage:
                              example: null
                              type: integer
                            endings:
                              items:
                                properties:
                                  buttonLabel:
                                    example: Create your own Survey
                                    type: string
                                  buttonLink:
                                    example: https://formbricks.com
                                    type: string
                                  headline:
                                    example: Thank you!
                                    type: string
                                  id:
                                    example: o729tod5klhix62njmk262dk
                                    type: string
                                  subheader:
                                    example: We appreciate your feedback.
                                    type: string
                                  type:
                                    example: endScreen
                                    type: string
                                type: object
                              type: array
                            hiddenFields:
                              properties:
                                enabled:
                                  example: true
                                  type: boolean
                                fieldIds:
                                  items:
                                    type: string
                                  type: array
                              type: object
                            id:
                              example: cm6orr901000g19wjwwa690eo
                              type: string
                            languages:
                              items:
                                type: string
                              type: array
                            name:
                              example: Start from scratch
                              type: string
                            questions:
                              items:
                                properties:
                                  buttonLabel:
                                    example: Next
                                    type: string
                                  charLimit:
                                    example: false
                                    type: boolean
                                  headline:
                                    example: What would you like to know?
                                    type: string
                                  id:
                                    example: dd5c8w2a4ttkbnjb9nwhtb17
                                    type: string
                                  inputType:
                                    example: text
                                    type: string
                                  placeholder:
                                    example: Type your answer here...
                                    type: string
                                  required:
                                    example: true
                                    type: boolean
                                  type:
                                    example: openText
                                    type: string
                                type: object
                              type: array
                            recontactDays:
                              example: 0
                              type: integer
                            segment:
                              properties:
                                createdAt:
                                  example: '2025-02-03T08:08:33.377Z'
                                  type: string
                                description:
                                  example: null
                                  type: string
                                filters:
                                  items:
                                    type: string
                                  type: array
                                id:
                                  example: cm6orr90h000h19wj1lnwoxwg
                                  type: string
                                isPrivate:
                                  example: true
                                  type: boolean
                                title:
                                  example: cm6orr901000g19wjwwa690eo
                                  type: string
                                updatedAt:
                                  example: '2025-02-03T08:08:33.377Z'
                                  type: string
                              type: object
                            showLanguageSwitch:
                              example: null
                              type: boolean
                            status:
                              example: inProgress
                              type: string
                            styling:
                              example: null
                              type: object
                            triggers:
                              items:
                                properties:
                                  actionClass:
                                    example: code action
                                    type: string
                                type: object
                              type: array
                            type:
                              example: app
                              type: string
                            variables:
                              items:
                                type: string
                              type: array
                            welcomeCard:
                              properties:
                                buttonLabel:
                                  example: Next
                                  type: string
                                enabled:
                                  example: false
                                  type: boolean
                                headline:
                                  example: Welcome!
                                  type: string
                                html:
                                  example: >-
                                    Thanks for providing your feedback - let's
                                    go!
                                  type: string
                                showResponseCount:
                                  example: false
                                  type: boolean
                                timeToFinish:
                                  example: false
                                  type: boolean
                              type: object
                          type: object
                        type: array
                    type: object
                type: object
          description: HTTP Status 200
        '404':
          content:
            application/json:
              schema:
                properties:
                  code:
                    example: not_found
                    type: string
                  details:
                    properties:
                      resource_id:
                        example: tpywklouw2p7tebdu4zv01an
                        type: string
                      resource_type:
                        example: environment
                        type: string
                    type: object
                  message:
                    example: Environment not found
                    type: string
                type: object
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                properties:
                  code:
                    example: internal_server_error
                    type: string
                  details:
                    type: object
                  message:
                    example: >-
                      Unable to complete request: Expected property name or '}'
                      in JSON at position 29
                    type: string
                type: object
          description: Internal Server Error

````