Skip to main content
POST
/
v1
/
prospects
Create a New Prospect
curl --request POST \
  --url https://api.trata.ai/v1/prospects \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "John Doe",
  "email": "john.doe@example.com",
  "phoneNumber": "1234567890",
  "externalReference": [
    {
      "providerName": "Google Analytics",
      "id": "GA-123456",
      "providerProps": "abcdefg"
    }
  ],
  "prospectProps": "software"
}
'
import requests

url = "https://api.trata.ai/v1/prospects"

payload = {
    "name": "John Doe",
    "email": "john.doe@example.com",
    "phoneNumber": "1234567890",
    "externalReference": [
        {
            "providerName": "Google Analytics",
            "id": "GA-123456",
            "providerProps": "abcdefg"
        }
    ],
    "prospectProps": "software"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    name: 'John Doe',
    email: 'john.doe@example.com',
    phoneNumber: '1234567890',
    externalReference: [{providerName: 'Google Analytics', id: 'GA-123456', providerProps: 'abcdefg'}],
    prospectProps: 'software'
  })
};

fetch('https://api.trata.ai/v1/prospects', 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://api.trata.ai/v1/prospects",
  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' => 'John Doe',
    'email' => 'john.doe@example.com',
    'phoneNumber' => '1234567890',
    'externalReference' => [
        [
                'providerName' => 'Google Analytics',
                'id' => 'GA-123456',
                'providerProps' => 'abcdefg'
        ]
    ],
    'prospectProps' => 'software'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.trata.ai/v1/prospects"

	payload := strings.NewReader("{\n  \"name\": \"John Doe\",\n  \"email\": \"john.doe@example.com\",\n  \"phoneNumber\": \"1234567890\",\n  \"externalReference\": [\n    {\n      \"providerName\": \"Google Analytics\",\n      \"id\": \"GA-123456\",\n      \"providerProps\": \"abcdefg\"\n    }\n  ],\n  \"prospectProps\": \"software\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	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))

}
HttpResponse<String> response = Unirest.post("https://api.trata.ai/v1/prospects")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"John Doe\",\n  \"email\": \"john.doe@example.com\",\n  \"phoneNumber\": \"1234567890\",\n  \"externalReference\": [\n    {\n      \"providerName\": \"Google Analytics\",\n      \"id\": \"GA-123456\",\n      \"providerProps\": \"abcdefg\"\n    }\n  ],\n  \"prospectProps\": \"software\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.trata.ai/v1/prospects")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"John Doe\",\n  \"email\": \"john.doe@example.com\",\n  \"phoneNumber\": \"1234567890\",\n  \"externalReference\": [\n    {\n      \"providerName\": \"Google Analytics\",\n      \"id\": \"GA-123456\",\n      \"providerProps\": \"abcdefg\"\n    }\n  ],\n  \"prospectProps\": \"software\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "pro.1731301754.OZSMSU1S",
  "orgId": "org.1726902940.GZChqlpU",
  "name": "Hari",
  "phoneNumber": "96260-12778",
  "externalReference": [],
  "status": "SERVICE_ORDER_PLACED",
  "prospectProps": {},
  "createdBy": "trata-system",
  "createdAt": "2024-11-11T05:09:14.979287",
  "updatedBy": "trata-system",
  "updatedAt": "2024-11-11T05:09:14.979289"
}
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
status
enum<string>
required
Available options:
NEW,
GENERAL_ENQUIRY,
SCHEDULED_CALLBACK_WITH_BOT,
SCHEDULED_APPOINTMENT_WITH_PERSON,
SCHEDULED_APPOINTMENT_FOR_SERVICE,
NOT_INTERESTED,
PRODUCT_ORDER_PLACED,
SERVICE_ORDER_PLACED
name
string | null

Name of the prospect

Required string length: 1 - 512
Example:

"John Doe"

email
string<email> | null

Email of the prospect

Required string length: 1 - 512
Example:

"john.doe@example.com"

phoneNumber
string | null

Phone number of the prospect

Required string length: 1 - 512
Example:

"1234567890"

externalReference
ExternalReference · object[] | null

External references for the prospect

prospectProps
Prospectprops · object | null

Props for the prospect

Example:

"software"

Response

Prospect created successfully

Prospects are the potential customers for business

id
string
required
externalReference
ExternalReference · object[] | null
required
status
string
required
prospectProps
Prospectprops · object | null
required
orgId
string
name
string | null
email
string | null
phoneNumber
string | null
createdBy
string
createdAt
string<date-time>
updatedBy
string
updatedAt
string<date-time>