Edição de oportunidade
curl --request POST \
--url https://fretatech.com.br/api/opportunity/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": "primeira",
"customer": {
"name": "Maria da Silva",
"email": "email@email.com",
"phone": null
},
"fields": [
{
"label": "Data de ida",
"value": "20/05/2026"
}
],
"external_id": "abc123",
"description": "a"
}
'import requests
url = "https://fretatech.com.br/api/opportunity/{id}"
payload = {
"source": "primeira",
"customer": {
"name": "Maria da Silva",
"email": "email@email.com",
"phone": None
},
"fields": [
{
"label": "Data de ida",
"value": "20/05/2026"
}
],
"external_id": "abc123",
"description": "a"
}
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({
source: 'primeira',
customer: {name: 'Maria da Silva', email: 'email@email.com', phone: null},
fields: [{label: 'Data de ida', value: '20/05/2026'}],
external_id: 'abc123',
description: 'a'
})
};
fetch('https://fretatech.com.br/api/opportunity/{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://fretatech.com.br/api/opportunity/{id}",
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([
'source' => 'primeira',
'customer' => [
'name' => 'Maria da Silva',
'email' => 'email@email.com',
'phone' => null
],
'fields' => [
[
'label' => 'Data de ida',
'value' => '20/05/2026'
]
],
'external_id' => 'abc123',
'description' => 'a'
]),
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://fretatech.com.br/api/opportunity/{id}"
payload := strings.NewReader("{\n \"source\": \"primeira\",\n \"customer\": {\n \"name\": \"Maria da Silva\",\n \"email\": \"email@email.com\",\n \"phone\": null\n },\n \"fields\": [\n {\n \"label\": \"Data de ida\",\n \"value\": \"20/05/2026\"\n }\n ],\n \"external_id\": \"abc123\",\n \"description\": \"a\"\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://fretatech.com.br/api/opportunity/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": \"primeira\",\n \"customer\": {\n \"name\": \"Maria da Silva\",\n \"email\": \"email@email.com\",\n \"phone\": null\n },\n \"fields\": [\n {\n \"label\": \"Data de ida\",\n \"value\": \"20/05/2026\"\n }\n ],\n \"external_id\": \"abc123\",\n \"description\": \"a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://fretatech.com.br/api/opportunity/{id}")
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 \"source\": \"primeira\",\n \"customer\": {\n \"name\": \"Maria da Silva\",\n \"email\": \"email@email.com\",\n \"phone\": null\n },\n \"fields\": [\n {\n \"label\": \"Data de ida\",\n \"value\": \"20/05/2026\"\n }\n ],\n \"external_id\": \"abc123\",\n \"description\": \"a\"\n}"
response = http.request(request)
puts response.read_body{
"msg": "Oportunidade criada com sucesso",
"opportunity": {
"id": 12,
"external_id": "abc123",
"description": "a",
"source": "primeira",
"customer": {
"name": "Maria da Silva",
"email": "email@email.com",
"phone": null
},
"fields": [
{
"label": "Data de ida",
"value": "20/05/2026"
}
]
}
}{
"msg": "Erro interno no servidor",
"error": "Internal Server Error"
}Oportunidades
Edição de oportunidade
Atualiza uma oportunidade existente
POST
/
opportunity
/
{id}
Edição de oportunidade
curl --request POST \
--url https://fretatech.com.br/api/opportunity/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": "primeira",
"customer": {
"name": "Maria da Silva",
"email": "email@email.com",
"phone": null
},
"fields": [
{
"label": "Data de ida",
"value": "20/05/2026"
}
],
"external_id": "abc123",
"description": "a"
}
'import requests
url = "https://fretatech.com.br/api/opportunity/{id}"
payload = {
"source": "primeira",
"customer": {
"name": "Maria da Silva",
"email": "email@email.com",
"phone": None
},
"fields": [
{
"label": "Data de ida",
"value": "20/05/2026"
}
],
"external_id": "abc123",
"description": "a"
}
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({
source: 'primeira',
customer: {name: 'Maria da Silva', email: 'email@email.com', phone: null},
fields: [{label: 'Data de ida', value: '20/05/2026'}],
external_id: 'abc123',
description: 'a'
})
};
fetch('https://fretatech.com.br/api/opportunity/{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://fretatech.com.br/api/opportunity/{id}",
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([
'source' => 'primeira',
'customer' => [
'name' => 'Maria da Silva',
'email' => 'email@email.com',
'phone' => null
],
'fields' => [
[
'label' => 'Data de ida',
'value' => '20/05/2026'
]
],
'external_id' => 'abc123',
'description' => 'a'
]),
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://fretatech.com.br/api/opportunity/{id}"
payload := strings.NewReader("{\n \"source\": \"primeira\",\n \"customer\": {\n \"name\": \"Maria da Silva\",\n \"email\": \"email@email.com\",\n \"phone\": null\n },\n \"fields\": [\n {\n \"label\": \"Data de ida\",\n \"value\": \"20/05/2026\"\n }\n ],\n \"external_id\": \"abc123\",\n \"description\": \"a\"\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://fretatech.com.br/api/opportunity/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": \"primeira\",\n \"customer\": {\n \"name\": \"Maria da Silva\",\n \"email\": \"email@email.com\",\n \"phone\": null\n },\n \"fields\": [\n {\n \"label\": \"Data de ida\",\n \"value\": \"20/05/2026\"\n }\n ],\n \"external_id\": \"abc123\",\n \"description\": \"a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://fretatech.com.br/api/opportunity/{id}")
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 \"source\": \"primeira\",\n \"customer\": {\n \"name\": \"Maria da Silva\",\n \"email\": \"email@email.com\",\n \"phone\": null\n },\n \"fields\": [\n {\n \"label\": \"Data de ida\",\n \"value\": \"20/05/2026\"\n }\n ],\n \"external_id\": \"abc123\",\n \"description\": \"a\"\n}"
response = http.request(request)
puts response.read_body{
"msg": "Oportunidade criada com sucesso",
"opportunity": {
"id": 12,
"external_id": "abc123",
"description": "a",
"source": "primeira",
"customer": {
"name": "Maria da Silva",
"email": "email@email.com",
"phone": null
},
"fields": [
{
"label": "Data de ida",
"value": "20/05/2026"
}
]
}
}{
"msg": "Erro interno no servidor",
"error": "Internal Server Error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
ID da oportunidade
Body
application/json
Atualiza oportunidade existente
⌘I