Create Email Task - SuperAI Flows
Create Email Task
cURL
curl --request POST \
--url https://flows.super.ai/api/integrations/email/tasks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"flow_id": "<string>",
"task_name": "<string>"
}
'```
### Python
```python
import requests
url = "https://flows.super.ai/api/integrations/email/tasks"
payload = {
"name": "<string>",
"description": "<string>",
"flow_id": "<string>",
"task_name": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
JavaScript (Fetch)
const options = {
method: 'POST',
headers: {
'X-API-Key': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
description: '<string>',
flow_id: '<string>',
task_name: '<string>'
})
};
fetch('https://flows.super.ai/api/integrations/email/tasks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://flows.super.ai/api/integrations/email/tasks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'flow_id' => '<string>',
'task_name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://flows.super.ai/api/integrations/email/tasks"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"flow_id\": \"<string>\",\n \"task_name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
Response Examples
Successful Response (200)
{
"email_address": "<string>",
"name": "<string>",
"task_id": "<string>",
"description": "<string>",
"status": "active"
}
Error Response (422)
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
Authorizations
X-API-Key
- Type: string
- Location: header
- Required: Yes
Include your API key in the X-API-Key header as:
X-API-Key: YOUR_API_KEY
Authorization
- Type: string
- Location: header
- Required: Yes
Include your access token in the Authorization header as:
Authorization: Bearer YOUR_ACCESS_TOKEN
Body Parameters
- name: string, required
- description: string | null
- flow_id: string | null
- task_name: string | null
Response Fields
- email_address: string, required
- name: string, required
- task_id: string, required
- description: string | null
- status: string, default: active