Authentication overview
Authentication for the Jotform API provides a mechanism to verify the identity of the application or user making requests, ensuring that only authorized entities can access or modify Jotform resources. The Jotform API facilitates programmatic interaction with forms, submissions, and user data, enabling developers to build custom integrations and automate workflows. All requests to the Jotform API must include valid authentication credentials, typically an API key, to be processed successfully. This security measure helps protect sensitive information and maintain the integrity of user data.
The API key acts as a unique identifier and secret token that grants specific permissions based on its configured access level. Without proper authentication, API requests will be rejected, preventing unauthorized access. Understanding and correctly implementing Jotform API authentication is fundamental for any developer aiming to integrate with the platform effectively and securely.
Supported authentication methods
The Jotform API primarily supports API key authentication. This method is straightforward to implement and manage, making it suitable for a wide range of integration scenarios, from server-side applications to client-side scripts where appropriate security measures are in place. Jotform's system does not currently support more complex token-based authentication flows like OAuth 2.0 directly for API access, focusing instead on the simplicity and directness of API keys.
API Key Authentication
API key authentication involves passing a unique, secret key with each API request. This key identifies the user account and dictates the level of access granted to the API. Jotform allows users to generate multiple API keys, each with configurable permissions, which enhances security by enabling granular control over access rights. For example, one key might have 'Read Access' only, while another might have 'Full Access'.
How API Keys Work
When an application makes a request to the Jotform API, the API key is included as a query parameter or in the request header. The Jotform API then validates this key against its records. If the key is valid and has the necessary permissions for the requested operation, the API processes the request. If the key is invalid, expired, or lacks sufficient permissions, the API returns an authentication error.
The following table summarizes the primary authentication method for the Jotform API:
| Authentication Method | When to Use | Security Level |
|---|---|---|
| API Key | Server-side applications, scripts, or controlled environments where the key can be kept secret. Suitable for direct access to account resources. | Moderate to High, depending on key management and access control. Requires careful handling to prevent exposure. |
Getting your credentials
To interact with the Jotform API, you need to generate an API key from your Jotform account. This process is initiated through the Jotform website, specifically within your account settings. Each API key generated is unique to your account and can be configured with specific access levels.
Steps to get your Jotform API Key:
- Log in to your Jotform Account: Navigate to the Jotform homepage and log in with your credentials.
- Access API Settings: Once logged in, go to your My API Keys page. This page is typically found under your account settings or directly via the URL provided.
- Generate a New Key: On the My API Keys page, you will see an option to 'Create New Key' or similar. Click this button to generate a new API key.
- Configure Access Permissions: Before or after generating the key, you can set its access level. Jotform offers different access levels, such as 'Full Access', 'Read Access', 'Edit Access', 'Delete Access', and 'Submission Access'. It is a best practice to grant only the minimum necessary permissions for the task the API key will perform. For example, if an integration only needs to retrieve form submissions, 'Read Access' or 'Submission Access' would be appropriate.
- Copy Your API Key: Once generated, the API key will be displayed. Copy this key immediately and store it in a secure location. Jotform typically does not display the full key again for security reasons after you leave the page.
It is recommended to generate a new API key for each distinct application or integration to simplify key rotation and revocation if a key is compromised. For detailed instructions on managing API keys and understanding permission levels, refer to the official Jotform API Documentation.
Authenticated request example
After obtaining your API key, you can include it in your API requests. The Jotform API expects the API key to be passed as a query parameter named apiKey. Here's an example of how to make an authenticated request to list your forms using curl, a common command-line tool for making HTTP requests:
curl -X GET "https://api.jotform.com/user/forms?apiKey=YOUR_API_KEY"
In this example:
-X GETspecifies the HTTP GET method.https://api.jotform.com/user/formsis the API endpoint to retrieve a list of forms associated with your account.?apiKey=YOUR_API_KEYis the query parameter whereYOUR_API_KEYshould be replaced with the actual API key you generated from your Jotform account.
For programmatic access in various languages, the principle remains the same: append the apiKey query parameter to your request URL. Here's a conceptual example in Python:
import requests
api_key = "YOUR_API_KEY"
base_url = "https://api.jotform.com"
endpoint = "/user/forms"
url = f"{base_url}{endpoint}?apiKey={api_key}"
response = requests.get(url)
if response.status_code == 200:
print("Forms:")
for form in response.json()['content']:
print(f" - {form['title']} (ID: {form['id']})")
else:
print(f"Error: {response.status_code} - {response.text}")
This Python snippet demonstrates how to construct the URL with the API key and make a GET request using the requests library. It then parses the JSON response to display form titles and IDs. Always replace "YOUR_API_KEY" with your actual, securely stored API key.
Security best practices
Securing your API keys is paramount to protect your Jotform data from unauthorized access. Adhering to security best practices helps mitigate risks associated with credential exposure and misuse.
1. Restrict API Key Permissions
Always grant the least privilege necessary to each API key. If an application only needs to read form submissions, assign 'Read Access' or 'Submission Access' instead of 'Full Access'. This minimizes the impact if a key is compromised, as the attacker's capabilities will be limited to the granted permissions.
2. Store API Keys Securely
API keys are sensitive credentials and should be treated with the same level of security as passwords. Avoid hardcoding API keys directly into your source code, especially for client-side applications where they can be easily extracted. Instead, use:
- Environment Variables: For server-side applications, store API keys as environment variables. This keeps them out of your codebase and configuration files.
- Secret Management Services: Utilize services like AWS Secrets Manager, Google Secret Manager, or Azure Key Vault for robust key management, rotation, and access control.
- Configuration Files: If using configuration files, ensure they are not committed to version control systems like Git. Use
.gitignoreor similar mechanisms.
3. Avoid Exposing Keys in Client-Side Code
Directly embedding API keys in client-side JavaScript or mobile applications is generally discouraged unless the key is specifically designed for public use with strict rate limits and scope. For Jotform API keys, which grant significant access, it is best to route requests through a secure backend server that can securely hold and use the API key.
4. Implement Key Rotation
Regularly rotate your API keys. This means generating a new key, updating your applications to use the new key, and then revoking the old key. Frequent rotation reduces the window of opportunity for a compromised key to be exploited. Jotform's API key management interface allows you to generate new keys and revoke old ones easily.
5. Monitor API Usage
Keep an eye on your API usage patterns. Unusual spikes in requests, requests from unexpected geographical locations, or attempts to access unauthorized resources could indicate a compromised key. While Jotform's platform provides some usage metrics, integrating with external monitoring tools can offer more comprehensive oversight. For example, Cloudflare API Shield can help monitor and protect API endpoints.
6. Use HTTPS
Always ensure that all API communications occur over HTTPS. Jotform API endpoints enforce HTTPS, which encrypts data in transit, protecting your API key and other sensitive information from eavesdropping during transmission. This is a fundamental security practice for any web-based API interaction, as described in W3C security recommendations.
7. IP Whitelisting (if available and applicable)
While Jotform API keys do not currently support IP whitelisting directly on the key itself, if your infrastructure allows, restrict outbound API calls from your servers to only Jotform's API endpoints. This adds a layer of network security, ensuring that even if your server is compromised, an attacker cannot easily use your API key to make requests from an unauthorized IP address.
By diligently following these security best practices, developers can significantly enhance the protection of their Jotform API integrations and the data they manage.