---
title: "API"
date: 2023-06-26
author: "Al Mizan"
---

# API

# Bit form API

An **API (Application Protocol Interface)** defines a set of functions that interact with other software components or applications or you can call microservices between web applications. If any web application or software needs any information from another software, they have to make a **call** or **request** to get the information. This specific call or request is called **API**.

To simplify this context, we can take an example that a user installed a form plugin from which he/she wants to deliver form data to our Bit Form plugin where the user has already made a form. What the user has to do is to make an API request to Bit Form. In response, users will get all the data that they have requested will be stored in Bit Form.

## API Key Option​

1. Go to Bit form **Settings** and then navigate to **API**
2. Copy your `API Key` then use it in the request header.

## API Endpoints​

### Get Forms

To fetch all forms.

- Request
- Response

**Parameters**

NameTypeInDescription`Bitform-Api-Key`stringHeaderSpecify your secret key to get access.**GET Request**

```
https://{base_url}/wp-json/bitform/v1/formsCopy
```



```
{"forms": [{"form_name": "Contact Form""id": "1"}],"status": 200,"code": 4000,"sucess":true}Copy
```









### Fetch Entries​

Fetch all entries by specific form ID.

- Request
- Response

**Parameters**

NameTypeInDefaultDescription`Bitform-Api-Key`stringHeaderSpecify your secret key to get access.required`form_id`IntegerPathSepecify form ID.required`per_page`IntegerPath200How many data fetch in each request.optional`page`IntegerPath1Page offset.optional**GET Request**

```
https://{base_url}/wp-json/bitform/v1/form/response/{form_id}Copy
```



```
{"data": {"count":"95","entries":[{"entry_id":"12","bf1-1":"test data"},…]},"status": 200,"sucess": true}Copy
```









### Get Form Fields​

Fetch all fields of a specific form.

- Request
- Response

**Parameters**

NameTypeInDescription`Bitform-Api-Key`stringHeaderSpecify your secret key to get access.`form_id`IntegerPathSepecify form ID.**GET Request**

```
https://{base_url}/wp-json/bitform/v1/fields/{form_id}Copy
```



```
{
  "data": {
    "fields": {
      "bf1-1-": {
        "typ": "txt",
        "lbl": "First Name",
        "ph": "Enter Your First Name",
        "valid": {}
      }
    },
    "fieldkeys": {
      "bf1-1-": "bf1-1-"
    },
    "workflows": [
      {
        "workflow_name": "workflow 2",
        "id": "2"
      }
    ],
    "workflow_key_name": "workflow"
  },
  "status": 200,
  "code": 4000,
  "sucess": true
}Copy
```

In this API request user have to indicate the specific id to ***form\_id*** in which fields will be used to fetch information. Suppose a client sent an API request, under a specific form some field’s information will be inserted where , ***typ = field type***, ***lbl = field label name***, ***ph = a indicator of the fields action***. The ***valid : {}*** denotes ***True/False***. If the required field is enabled then ***valid : {}*** will return ***True*** otherwise ***valid : {}*** will be empty. Then ***fieldkeys***is the key name of the input field. Clients can also run workflows using conditional logic by sending API requests. As example, if a client wants any records to be created &amp; submitted, an email notification will be sent. Clients have to set this workflow &amp; have to mention that specific workflow name on their API request. They can set actions like : ***Success Message***, ***Redirect URL***, ***Web hook***, ***Integration*** and run those actions through our API request. The ***workflow\_key\_name*** is the input key name of all the created workflows.









### Add record/entries​

Add entries to a specific form.

- Request
- Response

**Parameters**

NameTypeInDescription`Bitform-Api-Key`stringHeaderSpecify your secret key to get access.`form_id`IntegerPathSepecify form ID.`field_key`stringBodySpecify field key and value.**Note:** `field_key` is form field key, e.g: `bf1-2`

**POST Request**

```
https://{base_url}/wp-json/bitform/v1/entry/{form_id}Copy
```



```
{
  "status": 200,
  "code": 4000,
  "message": "Data Added Successfully.",
  "sucess": true
}Copy
```









### Edit record/entries

- Request
- Response

**Parameters**

NameTypeInDescription`Bitform-Api-Key`stringHeaderSpecify your secret key to get access.required`form_id`IntegerPathSepecify form ID.required`field_key_1`stringBodySpecify the value for the field.optional`field_key_2`stringBodySpecify the value for the field.optional**Note:** `field_key` is form field key, e.g: `bf1-2`

**POST/PUT Request**

```
https://{base_url}/wp-json/bitform/v1/entry_update/{form_id}Copy
```



```
{
  "status": 200,
  "code": 4000,
  "message": "Data Updated Successfully",
  "sucess": true
}Copy
```









## Delete records/entries

- Request
- Response

**Parameters**

NameTypeInDescription`Bitform-Api-Key`stringHeaderSpecify your secret key to get access.required`form_id`IntegerPathSpecify form ID.required**DELETE Request**

```
https://{base_url}/wp-json/bitform/v1/entry_delete/{form_id}Copy
```



```
{
  "status": 200,
  "code": 4000,
  "message": "Data Deleted Successfully",
  "sucess": true
}Copy
```













### Get workflow or conditional logic

This api is used to get the list of all the workflow in the system.

- Request
- Response

**Parameters**

NameTypeInDescription``form_id``IntegerPathThe id of the form for which the workflow is to be fetched.required`Bitform-Api-Key`stringHeaderThe api key of the form for which the workflow is to be fetched.required**Get Request:**

```
https://{base_url}/wp-json/bitform/v1/workflow/{form_id}Copy
```



```
Response:
{
    "workflow": [
        {
            "id": "72",
            "workflow_name": "Action 2",
            "workflow_type": "onsubmit",
            "workflow_run": "create_edit",
            "workflow_behaviour": "always"
        },
        {...}
}Copy
```













### Add Record/Entries with workflow or conditional logic

This api is used to add record/entries in the form with workflow or conditional logic.

- Request
- Response

**Parameters**

NameTypeInDescription``form_id``IntegerPathThe id of the form for which the record/entries is to be added.required`Bitform-Api-Key`stringHeaderThe api key of the form for which the record/entries is to be added.required`field_key_1`stringBodySpecify field key and value.required`field_key_2`stringBodySpecify the value for the field.requiredworkflowInteger/array of IntegersBodySingle onsubmit workflow id or array of multiple onsubmit workflow IDs.required**Post Request:**

```
https://{base_url}/wp-json/bitform/v1/entry/{form_id}Copy
```



```
Response:
{
    "success": true,
    "data": {
        "entry_id": 530,
        "message": "Form Submitted Successfully",
        "msg_id": 0
    }
}
Copy
```













## API Status Codes​

The success or failure of an API request is conveyed by the code and message in its response.

Http Status CodeHTTP StatusCodeMessage`200`OK4000Successfully data submitted`200`OK3910No forms available`200`OK3920No fields available`200`OK3710No field named {field} found. Please check and try again.`200`OK3120Data type mismatch`200`OK3970The get records API can fetch up to 200 records per request. You’ll have to use the from parameter in your requests to fetch records 1-200, 201-400, and so on`400`Not Found3030The API request’s body content is missing`404`Not Found3100No Entry with ID`404`Not Found3200No Form with ID`404`Not Found3130No form was found. Please check and try again`422`Validation Error3070Data validation failure**Watch a demo tutorial here!**



**🖐 Let us know if you have any feedback or any API requests** at **`<a contenteditable="false" href="mailto:support@bitapps.pro" style="cursor: pointer;">support@bitapps.pro</a>`.**