Back

Typeform API Essential Guide

Jul 31, 20246 minute read

What type of API does Typeform provide?

Typeform primarily uses RESTful APIs for its services. The Create and Responses APIs are RESTful, allowing users to interact with Typeform programmatically. These APIs enable functionalities such as creating typeforms, retrieving responses on demand, and integrating with webhooks for automatic delivery of submissions.

REST (Representational State Transfer) APIs operate based on standard HTTP methods, such as GET, POST, PUT, and DELETE, and exchange data in a format that is easy to understand and use, typically JSON.

Key characteristics of REST APIs, as demonstrated by Typeform's implementation, include:

  • Statelessness
  • Client-Server Architecture
  • Cacheable
  • Layered System
  • Uniform Interface

Typeform's use of RESTful APIs offers a scalable, flexible, and efficient way for developers to integrate Typeform's functionalities into their applications or services.

Does the Typeform API have webhooks?

Yes, the Typeform API supports webhooks. Webhooks notify you automatically when a specific event occurs, primarily when a new response is submitted to a form. The webhook sends a notification containing the response data to your designated URL or web application. Your webhook should respond with a 2XX HTTP status code to acknowledge receipt.

To work with Typeform webhooks:

  1. Create a Webhook: Send a PUT request to the Typeform API with the form's form_id, your webhook URL, and set enabled to true.
curl --request PUT \ --url https://api.typeform.com/forms/{form_id}/webhooks/{tag} \ --header 'Authorization: bearer {your_access_token}' \ --header 'Content-Type: application/json' \ -d '{"url":"https://{your_webhook_url}.com", "enabled":true}'
  1. Update a Webhook: Send another PUT request with the new webhook URL, keeping enabled set to true.

  2. Delete a Webhook: Send a DELETE request to the Typeform API with the form's form_id and the webhook tag.

curl --request DELETE \ --url https://api.typeform.com/forms/{form_id}/webhooks/{tag} \ --header 'Authorization: bearer {your_access_token}'

Typeform supports security measures for webhooks, such as payload signing and HTTPS, and implements a retry mechanism for failed webhook deliveries.

Rate Limits and other limitations

The Typeform API imposes rate limits on the usage of its services to ensure fair usage and maintain service quality. Specifically, for the Create and Responses APIs, users are allowed to send two requests per second per Typeform account. It's important to note that these rate limits apply to the Create and Responses APIs only. For other components such as Webhooks and Embed, since they do not require you to actively make requests, rate limits do not apply to them.

This means that when integrating with Typeform's API, especially when creating new forms or fetching responses, developers need to design their applications to stay within this limit to avoid potential throttling or temporary blocking of their requests. Implementing efficient request handling and possibly caching mechanisms can help manage the rate limits effectively.

Additionally, when working with the Responses API, it's worth noting that by default, retrieving responses will yield 25 responses per request. However, this can be adjusted using the page_size parameter, with a maximum value of 1000 responses per request. This allows for more granular control over how much data is retrieved in each call, which can be particularly useful for managing rate limits and optimizing performance.

In summary, the Typeform API rate limits are as follows:

  • Create and Responses APIs: Two requests per second per Typeform account.
  • Webhooks and Embed: No rate limits apply as they do not involve active requests from the user's side.

Understanding and adhering to these limits is crucial for maintaining a smooth operation of applications integrated with Typeform's services.

Latest API Version

The most recent update to the Typeform API, based on the provided changelog, occurred on July 1st, 2024. This update introduced the ability to set enrichment settings for forms via the API for accounts with access to the responses enrichment feature. Additionally, it allowed for creating or updating milestones within a form definition through the Create API. The Responses API was enhanced to fetch partial responses, introducing a new response_type query parameter for more detailed control over the responses retrieved.

How to get a Typeform developer account and API Keys?

To get a developer account for Typeform to create an API integration, you don't need a special developer account. All you need is a regular Typeform account. Some features require a PRO or PRO+ account, but basic developer features and API access are available for standard Typeform accounts.

Here's a step-by-step guide to setting up API integration with Typeform:

1. Sign Up for a Typeform Account

If you don't already have a Typeform account, sign up for one. A standard Typeform account grants you access to their APIs.

2. Register Your Application

To use Typeform's APIs, you'll need to register your application in the Typeform admin panel. During registration, you'll specify your application's website URL and redirect URI(s), and upon completion, you'll receive a client_id and client_secret for your application.

3. Obtain Access Token

After registering your application, you'll need to obtain an access token to authenticate your API requests. This involves implementing OAuth 2.0 authentication in your application. You'll make an authorization request to https://api.typeform.com/oauth/authorize with parameters including your client_id, redirect_uri, and the scope of access your application requires. Upon successful authorization, you'll exchange the temporary authorization code for an access token by making a POST request to https://api.typeform.com/oauth/token.

Example OAuth 2.0 Authorization Request URL

Here's an example of what the authorization request URL might look like:

https://api.typeform.com/oauth/authorize?state=xyz789&client_id={your_client_id}&redirect_uri=https://results-example.herokuapp.com/callback&scope={scope1}+{scope2}+{scope3}

Replace {your_client_id}, {scope1}+{scope2}+{scope3}, and https://results-example.herokuapp.com/callback with your actual client ID, scopes, and redirect URI.

Security Note

Keep your access tokens, refresh tokens, client_id, and client_secret secure. Do not commit them to source control or expose them publicly. Use placeholders in your code and store these credentials securely.

What can you do with the Typeform API?

Based on the information gathered from the sources, here's a breakdown of the data models you can interact with using the Typeform API and what is possible for each:

  • Access all the questions and responses from a form or survey.
  • Retrieve information about the structure and content of your forms.

  • Obtain all the responses submitted by users for a particular form or survey.
  • Filter responses based on criteria such as submission date and time.
  • Programmatically retrieve responses on demand in JSON format.

  • Gather information about the users who have responded to a form or survey, including names, email addresses, and other contact details.
  • Analyze user engagement and demographics.

  • Extract data related to the performance of a form or survey, such as the number of responses, completion rates, and other metrics.
  • Utilize this data for optimizing form designs and improving response rates.

  • Access information about the visual appearance of a form or survey, including colors, fonts, and other design elements.
  • Customize the look and feel of your forms programmatically.

  • Manage data related to the integration of a form or survey with other applications.
  • Configure webhooks to trigger actions in third-party applications upon form submission.

Each of these data models opens up a variety of possibilities for interacting with and analyzing the data collected through Typeform. Whether you're looking to perform advanced analytics, consolidate data across platforms, analyze historical trends, enhance data security, scale your data handling capabilities, apply machine learning, or simply report and visualize your findings, the Typeform API provides the necessary tools and endpoints to achieve these goals.