Atualizar Estagio da Oportunidade
PATCH/external/v1/opportunities/:id/stageAtualiza apenas o status/estagio de uma oportunidade no pipeline.
Autenticacao
Requer permissao opportunities:write.
Parametros de Caminho
| Parametro | Tipo | Obrigatorio | Descricao |
|---|---|---|---|
id | string | Sim | O identificador unico da oportunidade |
Corpo da Requisicao
| Campo | Tipo | Obrigatorio | Descricao |
|---|---|---|---|
status | string | Sim | Novo status no pipeline |
Valores de Status Disponiveis
| Status | Descricao |
|---|---|
new | Novo lead, ainda nao contatado |
contacted | Primeiro contato realizado |
qualified | Lead qualificado |
proposal | Proposta enviada |
negotiation | Em negociacao ativa |
won | Negocio fechado com sucesso |
lost | Negocio perdido |
INFO
Ao definir o status como won, o timestamp won_at e definido automaticamente. Ao definir o status como lost, o timestamp lost_at e definido automaticamente.
Requisicao
bash
curl --request PATCH \
--url "https://app.getraze.com/external/v1/opportunities/opp_abc123def456/stage" \
--header "Content-Type: application/json" \
--header "X-API-Key: YOUR_API_KEY" \
--data '{
"status": "won"
}'javascript
const axios = require('axios');
const opportunityId = 'opp_abc123def456';
const response = await axios.patch(
`https://app.getraze.com/external/v1/opportunities/${opportunityId}/stage`,
{
status: 'won'
},
{
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
}
}
);
console.log(response.data);python
import requests
opportunity_id = 'opp_abc123def456'
response = requests.patch(
f'https://app.getraze.com/external/v1/opportunities/{opportunity_id}/stage',
headers={
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'status': 'won'
}
)
print(response.json())Resposta
json
{
"success": true,
"data": {
"id": "opp_abc123def456",
"name": "John Doe",
"status": "won",
"won_at": "2024-01-25T10:00:00Z",
"updated_at": "2024-01-25T10:00:00Z"
}
}Erros
| Status | Codigo | Descricao |
|---|---|---|
| 400 | INVALID_STATUS | Valor de status invalido |
| 404 | NOT_FOUND | Oportunidade nao encontrada |