API Documentation

REST API

The REST API allows you to send and fetch data from a ByteForms form. You can use the API from a script, server, or anywhere other than a browser that can make HTTP requests.

API Keys

The API uses API Key, that allows you to access the ByteForms API. You can create an API Key from the Account Page. API Key is a secret key that should be kept secure and should not be shared with anyone. You can create multiple API Keys with different names for identifying purposes.

Authentication

ByteForms uses basic authentication for API requests. You need to send the API Key in the Authorization header of the request. There is no need to prefix the API Key with "Bearer". Here is an example of how to send the API Key in the Authorization header using curl:

curl -X GET "https://api.forms.bytesuite.io/api/form" -H "Authorization: YOUR_API_KEY"

Errors

API errors will return a JSON response with the following structure:

{ "message": "You are not logged in", "status": "fail" }

Endpoints

GET /api/form

Returns all the forms created by the user.

curl -X GET "https://api.forms.bytesuite.io/api/form" -H "Authorization: YOUR_API_KEY"

The output will be an array of FormItems

{ "data": [ "FormItems" ], "status": "success" }

GET /api/form/{formId}

Get a specific form using its Id.

curl -X GET "https://api.forms.bytesuite.io/api/form/{formId}" -H "Authorization: YOUR_API_KEY"

The output will be an FormItem

{ "data": "FormItem", "status": "success" }

GET /api/form/responses/{formId}

Get responses for a specific form using its Id. You can add additional query parameters like limit (number), order ('asc'/'desc'), query (string), after/before(cursor), etc. to paginate and filter the responses.

curl -X GET "https://api.forms.bytesuite.io/api/form/responses/{formId}" -H "Authorization: YOUR_API_KEY"

The output will be an array of FormResponseItems.

{ "count": 1, "cursor": { "after": null, "before": null }, "data": [ "FormResponseItems" ], "status": "success" }

Models

Form Item

{ "id": 1, "public_id": "U9bWSax8xO", "name": "My awesome form", "body": [ { "component": "input", "type": "text", "label": "Text", "placeholder": "Text", "page": 1, "index": 0, "id": "text", "required": true }, { "component": "input", "type": "tel", "label": "Phone", "minLength": 5, "maxLength": 15, "placeholder": "Phone", "page": 1, "index": 1, "id": "phone", "includeCountryCode": false }, { "component": "input", "type": "email", "label": "Email", "placeholder": "Email", "page": 1, "index": 3, "id": "email" } ], "pages": null, "is_custom": false, "options": "FormOptions", "user_id": 1, "created_at": "2024-01-31T13:23:51.300722Z", "updated_at": "2024-03-08T04:18:09.322579Z", "deleted_at": null }

Form Options

{ "one_submission_per_email": false, "thank_you_message": "Thank you! Your response has been submitted.", "max_submissions": 0, "stop_submissions_after": null, "submit_button_text": "Submit", "form_width": "centered", "redirect_url": "", "password": "", "theme": "light", "visibility": "public", "page_behaviour": "scroll", "custom_code": "", "draft_submissions": true, "remove_branding": false, "email_notifications": false }

Form Response Item

{ id: 1, form_id: 1, response: { "Field_key": "Field_Value", ...Other form fields and values }, options: { ip: "IP_ADDRESS", }, created_at: "2024-04-15T17:36:40.577929Z", updated_at: "2024-04-15T17:36:40.577929Z", deleted_at: null, }

Certain fields like File, ReCaptcha, Calendly, etc have a different structure in response property, in the form of a JSON Object.