Tags de contato
Adicionar uma tag a um contato
Vincule uma tag reutilizável existente a um contato do Instagram pelo ID e retorne o conjunto completo de tags atuais do contato como confirmação.
PUT
/
api
/
v1
/
contacts
/
{contactId}
/
tags
/
{tagId}
Add a tag to a contact
curl --request PUT \
--url https://levios.app/api/v1/contacts/{contactId}/tags/{tagId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({account_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://levios.app/api/v1/contacts/{contactId}/tags/{tagId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://levios.app/api/v1/contacts/{contactId}/tags/{tagId}"
payload = { "account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"error": {
"code": "api_invalid_content_length",
"message": "Invalid Content-Length.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_unauthorized",
"message": "Authentication required.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_account_not_granted",
"message": "This credential is not authorized for the request.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_contact_tag_not_found",
"message": "The requested contact tag was not found.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_contact_tag_limit_reached",
"message": "The contact tag limit has been reached.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_body_too_large",
"message": "The JSON request body exceeds 1 MiB.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_unsupported_media_type",
"message": "Content-Type must be application/json.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_validation_error",
"message": "The request does not match the declared schema.",
"correlation_id": "<string>",
"details": {
"issues": [
{
"code": "<string>",
"path": [
1
]
}
]
}
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_contact_tag_response_unavailable",
"message": "The contact tag changed, but its response could not be verified. Do not retry automatically.",
"correlation_id": "<string>",
"details": {
"committed": true,
"retryable": false
}
}
}{
"error": {
"code": "api_account_resolution_unavailable",
"message": "The reachable account set could not be read.",
"correlation_id": "<string>"
}
}Adicione
A resposta contém
tagId ao contato identificado por contactId. Os dois UUIDs devem
pertencer à conta do Instagram selecionada.
Sua chave de API precisa do escopo contacts:write. Envie account_id como o
único campo do corpo da requisição.
curl --request PUT \
--url "https://levios.app/api/v1/contacts/${LEVIOS_CONTACT_ID}/tags/${LEVIOS_TAG_ID}" \
--header "Authorization: Bearer ${LEVIOS_API_KEY}" \
--header 'Content-Type: application/json' \
--data @- <<JSON
{
"account_id": "${LEVIOS_ACCOUNT_ID}"
}
JSON
contact_id e o array tags completo e atual do contato.
Cada tag contém id e name.
Adicionar uma tag já atribuída não cria uma duplicata. A operação é
idempotente. Um contato pode ter até 100 tags atribuídas.
Se a API retornar
api_contact_tag_response_unavailable com
committed: true e retryable: false, a atribuição mudou, mas não foi
possível verificar a resposta. Não tente novamente de forma automática. Leia
o contato para conferir as tags atuais.Add a tag to a contact
curl --request PUT \
--url https://levios.app/api/v1/contacts/{contactId}/tags/{tagId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({account_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://levios.app/api/v1/contacts/{contactId}/tags/{tagId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://levios.app/api/v1/contacts/{contactId}/tags/{tagId}"
payload = { "account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"error": {
"code": "api_invalid_content_length",
"message": "Invalid Content-Length.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_unauthorized",
"message": "Authentication required.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_account_not_granted",
"message": "This credential is not authorized for the request.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_contact_tag_not_found",
"message": "The requested contact tag was not found.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_contact_tag_limit_reached",
"message": "The contact tag limit has been reached.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_body_too_large",
"message": "The JSON request body exceeds 1 MiB.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_unsupported_media_type",
"message": "Content-Type must be application/json.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_validation_error",
"message": "The request does not match the declared schema.",
"correlation_id": "<string>",
"details": {
"issues": [
{
"code": "<string>",
"path": [
1
]
}
]
}
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_contact_tag_response_unavailable",
"message": "The contact tag changed, but its response could not be verified. Do not retry automatically.",
"correlation_id": "<string>",
"details": {
"committed": true,
"retryable": false
}
}
}{
"error": {
"code": "api_account_resolution_unavailable",
"message": "The reachable account set could not be read.",
"correlation_id": "<string>"
}
}
