Api
Forms
How to use the form API endpoints
The forms endpoints are what you use to interact with forms through the API. You can list existing forms, create a new form, view an already existing form.
End-points
These are the endpoints you can interact with.
Action | Method | URL |
---|---|---|
Retrieve all forms on the account | GET |
/api/v1/forms |
Create a new Form | POST |
/api/v1/forms |
View a form | GET |
/api/v1/forms/:identifier |
Check if a value has already been submitted | GET |
/api/v1/forms/:identifier/value_exists/?field=email&[email protected] |
Object
The form object returned by the endpoints has the following structure.
{
"id":1,
"name":"my new form",
"identifier":"e007c41afeaf82d8",
"submission_text":"Thanks for your submission",
"webhook_url":null,
"redirect_url":null,
"notify_submitter":true,
"notify_submitter_from":"[email protected]",
"notify_submitter_subject":"Thanks for your submission",
"notify_submitter_body":"Thanks for your submission",
"notify_owner_on_submission":true,
"notify_owner_emails":"[email protected],[email protected]",
"show_submitted_values":false,
"bg_color":"#fff",
"text_color":"#000",
"link_color":"red",
"whitelisted_domains":null
}
List all forms
If you want to list all existing forms, you can hit the following endpoint
curl -H 'Authorization: Bearer exampletoken' -X POST https://www.formbackend.com/api/v1/forms
{
"forms": [
{
"id": 1,
"name": "My test form",
"identifier": "2fc637ed03b374c5",
"submission_count": 4
},
{
"id": 5,
"name": "Contact form",
"identifier": "5ce8efebad6ae0a4",
"submission_count": 27
}
]
}
Create a new form
curl -H 'Authorization: Bearer exampletoken' -X POST \
-d '{"form": {"name":"My form"}}' -H "Content-Type: application/json" \
https://www.formbackend.com/api/v1/forms/
View a form
curl -H 'Authorization: Bearer exampletoken' -X POST https://www.formbackend.com/api/v1/forms/uniquetoken
{
"id": 1,
"name": "sdfsdf",
"identifier": "2fc637ed03b374c5",
"submission_text": "Thank you for your submission",
"webhook_url": null,
"redirect_url": null,
"notify_submitter": null,
"notify_submitter_from": null,
"notify_submitter_from_name": null,
"notify_submitter_subject": null,
"notify_submitter_body": null,
"notify_owner_on_submission": false,
"notify_owner_emails": null,
"show_submitted_values": false,
"bg_color": null,
"text_color": null,
"link_color": null,
"whitelisted_domains": null,
"submission_count": 4
}
Check if value has already been submitted
curl -H 'Authorization: Bearer exampletoken' \
-X POST https://www.formbackend.com/api/v1/forms/uniquetoken/value_exists?field=email&value=[email protected]
{
"field": "email",
"value": "[email protected]",
"exists": true
}