Atualizar ativação de país por entidade
curl --request PATCH \
--url http://api.gu1.ai/entities/{id}/country-activations/{countryCode} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "<string>"
}
'import requests
url = "http://api.gu1.ai/entities/{id}/country-activations/{countryCode}"
payload = { "status": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({status: '<string>'})
};
fetch('http://api.gu1.ai/entities/{id}/country-activations/{countryCode}', 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 => "http://api.gu1.ai/entities/{id}/country-activations/{countryCode}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'status' => '<string>'
]),
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 := "http://api.gu1.ai/entities/{id}/country-activations/{countryCode}"
payload := strings.NewReader("{\n \"status\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("http://api.gu1.ai/entities/{id}/country-activations/{countryCode}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/entities/{id}/country-activations/{countryCode}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyReferência API
Atualizar ativação de país por entidade
Atualiza o status de ativação por país para um merchant. Idempotente se o status não mudar; emite webhook entity.country_activation_changed ao alterar.
PATCH
/
entities
/
{id}
/
country-activations
/
{countryCode}
Atualizar ativação de país por entidade
curl --request PATCH \
--url http://api.gu1.ai/entities/{id}/country-activations/{countryCode} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "<string>"
}
'import requests
url = "http://api.gu1.ai/entities/{id}/country-activations/{countryCode}"
payload = { "status": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({status: '<string>'})
};
fetch('http://api.gu1.ai/entities/{id}/country-activations/{countryCode}', 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 => "http://api.gu1.ai/entities/{id}/country-activations/{countryCode}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'status' => '<string>'
]),
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 := "http://api.gu1.ai/entities/{id}/country-activations/{countryCode}"
payload := strings.NewReader("{\n \"status\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("http://api.gu1.ai/entities/{id}/country-activations/{countryCode}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/entities/{id}/country-activations/{countryCode}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyOverview
Define o status operacional de ativação para um país em uma entidade merchant. Não altera o perfil da entidade — useGET /entities/{id} para reconsultar o dossiê após ativar.
Em cada mudança real de status, a Gu1 emite o webhook entity.country_activation_changed para endpoints inscritos. Transições entre status são livres (qualquer status pode ir para qualquer outro).
Valores suportados de countryCode: AR, BR, CL, CO, MX, US (case-insensitive).
Endpoint
PATCH http://api.gu1.ai/entities/{id}/country-activations/{countryCode}
Autenticação
Requerentities:edit (fallback legacy: entities:write).
Authorization: Bearer YOUR_API_KEY
Path Parameters
string
required
UUID da entidade (merchant).
string
required
País ISO 3166-1 alpha-2 a atualizar (
AR, BR, CL, CO, MX, US).Request Body
string
required
Um de:
deactivated, activation_requested, activation_in_progress, activated.Resposta
| Campo | Tipo | Descrição |
|---|---|---|
data.entityId | string | UUID da entidade |
data.countryCode | string | Código de país normalizado |
data.status | string | Novo status |
data.previousStatus | string | Status antes desta chamada |
data.changed | boolean | false se o status já era o solicitado (sem webhook) |
data.activatedAt | string | null | Timestamp da última vez em activated |
data.deactivatedAt | string | null | Timestamp da última vez em deactivated |
data.updatedAt | string | null | Timestamp da última alteração |
data.countries | array | Snapshot completo dos seis países do allowlist após esta chamada |
Exemplo
curl -X PATCH "https://api.gu1.ai/entities/550e8400-e29b-41d4-a716-446655440000/country-activations/CO" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"status":"activation_requested"}'
{
"success": true,
"data": {
"entityId": "550e8400-e29b-41d4-a716-446655440000",
"countryCode": "CO",
"status": "activation_requested",
"previousStatus": "deactivated",
"changed": true,
"activatedAt": null,
"deactivatedAt": null,
"updatedAt": "2026-07-03T15:00:00.000Z",
"countries": [
{ "countryCode": "AR", "status": "deactivated", "activatedAt": null, "deactivatedAt": null, "updatedAt": null },
{ "countryCode": "CO", "status": "activation_requested", "activatedAt": null, "deactivatedAt": null, "updatedAt": "2026-07-03T15:00:00.000Z" },
{ "countryCode": "MX", "status": "activated", "activatedAt": "2026-07-03T14:00:00.000Z", "deactivatedAt": null, "updatedAt": "2026-07-03T14:00:00.000Z" }
]
}
}
Payload do webhook (ao alterar)
Quandochanged é true, inscritos recebem:
{
"event": "entity.country_activation_changed",
"timestamp": "2026-07-03T15:00:00.000Z",
"organizationId": "org-uuid",
"payload": {
"entity": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"externalId": "merchant_123",
"name": "Acme Corp",
"type": "company",
"countryCode": "US"
},
"countryCode": "CO",
"status": "activation_requested",
"previousStatus": "deactivated",
"activeCountryCodes": ["MX"],
"countries": [
{ "countryCode": "AR", "status": "deactivated" },
{ "countryCode": "CO", "status": "activation_requested" },
{ "countryCode": "MX", "status": "activated" }
],
"timeline": [
{
"previousStatus": "deactivated",
"status": "activation_requested",
"changedAt": "2026-07-03T15:00:00.000Z"
}
],
"changedAt": "2026-07-03T15:00:00.000Z"
}
}
Erros
| HTTP | Code | Quando |
|---|---|---|
| 400 | UNSUPPORTED_COUNTRY_CODE | País fora do allowlist v1 |
| 404 | ENTITY_NOT_FOUND | A entidade não existe na organização atual |
Was this page helpful?
⌘I