var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
name: "John Doe",
email: "name@company.com",
phone: 1234567890,
enquiry: true,
message: "This is a test message",
});
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow",
};
fetch("https://api.mailpigeon.app/api/v1/submit", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
curl --location --request POST 'https://api.mailpigeon.app/api/v1/submit' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <apikey>' \
--data-raw '{
"name": "John Doe",
"email": "name@company.com",
"phone": 1234567890,
"enquiry": true,
"message": "This is a test message"
}'
import requests
import json
url = "https://api.mailpigeon.app/api/v1/submit"
payload = json.dumps({
"name": "John Doe",
"email": "name@company.com",
"phone": 1234567890,
"enquiry": true,
"message": "This is a test message"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.mailpigeon.app/api/v1/submit',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"name": "John Doe",
"email": "name@company.com",
"phone": 1234567890,
"enquiry": true,
"message": "This is a test message"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"data": {
"message": "Submission successful"
},
"status": {
"code": 201,
"message": "Created"
}
}
{
"data": {
"message": "Submission failed",
"error": {
"message": "No fields found for this project"
}
},
"status": {
"code": 400,
"message": "Bad Request"
}
}
{
"data": {
"message": "Submission failed",
"error": {
"message": "Invalid API Key"
}
},
"status": {
"code": 401,
"message": "Unauthorized"
}
}
{
"data": {
"message": "Submission failed",
"errors": ["Field 'email' is not of type string"]
},
"status": {
"code": 400,
"message": "Bad Request"
}
}
Endpoints
Submit
This endpoint submits validates and saves your form submissions. Assuming you have a form set up with the fields - name, email, phone, enquiry and message, you would send a POST request to this endpoint with the following body
POST
/
api
/
v1
/
submit
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
name: "John Doe",
email: "name@company.com",
phone: 1234567890,
enquiry: true,
message: "This is a test message",
});
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow",
};
fetch("https://api.mailpigeon.app/api/v1/submit", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
curl --location --request POST 'https://api.mailpigeon.app/api/v1/submit' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <apikey>' \
--data-raw '{
"name": "John Doe",
"email": "name@company.com",
"phone": 1234567890,
"enquiry": true,
"message": "This is a test message"
}'
import requests
import json
url = "https://api.mailpigeon.app/api/v1/submit"
payload = json.dumps({
"name": "John Doe",
"email": "name@company.com",
"phone": 1234567890,
"enquiry": true,
"message": "This is a test message"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.mailpigeon.app/api/v1/submit',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"name": "John Doe",
"email": "name@company.com",
"phone": 1234567890,
"enquiry": true,
"message": "This is a test message"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"data": {
"message": "Submission successful"
},
"status": {
"code": 201,
"message": "Created"
}
}
{
"data": {
"message": "Submission failed",
"error": {
"message": "No fields found for this project"
}
},
"status": {
"code": 400,
"message": "Bad Request"
}
}
{
"data": {
"message": "Submission failed",
"error": {
"message": "Invalid API Key"
}
},
"status": {
"code": 401,
"message": "Unauthorized"
}
}
{
"data": {
"message": "Submission failed",
"errors": ["Field 'email' is not of type string"]
},
"status": {
"code": 400,
"message": "Bad Request"
}
}
Body
string
This can be used in any context you like.
string
This can be used in any context you like.
integer
This can be used in any context you like.
boolean
This can be used in any context you like.
string
This can be used in any context you like.
Response
object
object
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
name: "John Doe",
email: "name@company.com",
phone: 1234567890,
enquiry: true,
message: "This is a test message",
});
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow",
};
fetch("https://api.mailpigeon.app/api/v1/submit", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
curl --location --request POST 'https://api.mailpigeon.app/api/v1/submit' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <apikey>' \
--data-raw '{
"name": "John Doe",
"email": "name@company.com",
"phone": 1234567890,
"enquiry": true,
"message": "This is a test message"
}'
import requests
import json
url = "https://api.mailpigeon.app/api/v1/submit"
payload = json.dumps({
"name": "John Doe",
"email": "name@company.com",
"phone": 1234567890,
"enquiry": true,
"message": "This is a test message"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.mailpigeon.app/api/v1/submit',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"name": "John Doe",
"email": "name@company.com",
"phone": 1234567890,
"enquiry": true,
"message": "This is a test message"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"data": {
"message": "Submission successful"
},
"status": {
"code": 201,
"message": "Created"
}
}
{
"data": {
"message": "Submission failed",
"error": {
"message": "No fields found for this project"
}
},
"status": {
"code": 400,
"message": "Bad Request"
}
}
{
"data": {
"message": "Submission failed",
"error": {
"message": "Invalid API Key"
}
},
"status": {
"code": 401,
"message": "Unauthorized"
}
}
{
"data": {
"message": "Submission failed",
"errors": ["Field 'email' is not of type string"]
},
"status": {
"code": 400,
"message": "Bad Request"
}
}
⌘I