Skip to main content
PUT
/
v1
/
prospects
/
{prospect_id}
Update a Specific Prospect by ID
curl --request PUT \
  --url https://api.trata.ai/v1/prospects/{prospect_id} \
  --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/{prospect_id}"

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.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
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/{prospect_id}', 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/{prospect_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
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/{prospect_id}"

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("PUT", 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.put("https://api.trata.ai/v1/prospects/{prospect_id}")
.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/{prospect_id}")

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

request = Net::HTTP::Put.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.

Path Parameters

prospect_id
string
required

ID of the prospect

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