POST/api/v4/posts

Criar uma publicação de anúncio

Cria uma publicação social do tipo ANNOUNCEMENT e a publica nos sites escolhidos para um ou mais locais.

Requer uma chave de API. Consulte Autenticação para ver o formato do cabeçalho e a rotação de chaves.

Parâmetros

Corpo

NomeTipoObrigatórioDescrição
inputobjectobrigatórioWrapper object. Every field below is a property of `input`, the entire body must be nested under it.
input.postNamestringobrigatórioInternal name for the campaign (not shown to customers).
input.locationIdsarray of stringsobrigatórioBase64-encoded location IDs to publish to (e.g. `TG9jYXRpb246MTgwMDI4OQ==`).
input.postTypestringobrigatórioMust be `ANNOUNCEMENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT.
input.postSitesarray of stringsobrigatórioSites to publish to: `GOOGLE`, `FACEBOOK`.
input.postMessagearray of objectsopcionalPer-site body text: `{ site, message }`. Provide one entry per site in `postSites`.
input.postCtaarray of objectsopcionalOptional call-to-action button per site: `{ site, type, url }`. `type` is one of BOOK, ORDER, SHOP, LEARN_MORE, SIGN_UP, GET_OFFER.
input.postMediaUrlarray of objectsopcionalOptional media per site: `{ site, url, type }` where `type` is IMAGE or VIDEO.
input.clientMutationIdstringopcionalOptional client token returned unchanged in the response for correlation.

Exemplo de requisição

Corpo pronto para colar. Substitua os IDs e valores de exemplo pelos seus.

Request body
{  "input": {    "postName": "Grand Opening Announcement",    "locationIds": ["TG9jYXRpb246MTgwMDI4OQ=="],    "postType": "ANNOUNCEMENT",    "postSites": ["GOOGLE"],    "postMessage": [      { "site": "GOOGLE", "message": "We are now open! Visit Jenny Home this week for our grand opening." }    ],    "postCta": [      { "site": "GOOGLE", "type": "LEARN_MORE", "url": "https://jennyhome.example/opening" }    ],    "postMediaUrl": [      { "site": "GOOGLE", "url": "https://cdn.example.com/opening.jpg", "type": "IMAGE" }    ]  }}

Respostas

200Post accepted. Publishing runs asynchronously, the returned post starts as INPROGRESS.
Response
{  "data": {    "createSocialPost": {      "clientMutationId": null,      "success": true,      "errors": [],      "socialPost": {        "id": "U29jaWFsUG9zdDo0NDEyMg==",        "name": "Grand Opening Announcement",        "status": "INPROGRESS",        "type": "ANNOUNCEMENT",        "createdAt": "2026-06-28",        "sites": ["GOOGLE"],        "message": [          { "site": "GOOGLE", "message": "We are now open! Visit Jenny Home this week for our grand opening." }        ],        "cta": [          { "type": { "value": "LEARN_MORE", "label": "Learn more" }, "url": "https://jennyhome.example/opening", "site": "GOOGLE", "tinyUrl": null }        ],        "contextInfo": null,        "mediaUrl": [          { "url": "https://cdn.example.com/opening.jpg", "site": "GOOGLE", "type": "IMAGE" }        ],        "publishDetails": [          { "site": "GOOGLE", "status": "PUBLISHING", "createdDate": "2026-06-28", "submissionError": null }        ],        "postLinks": [],        "locationIds": [1800289]      }    }  }}
400Bad request, the body was not wrapped in `input` (error message: `Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided`).
401Unauthenticated, missing or invalid API key.

Cria um anúncio: o tipo mais simples de publicação. Um anúncio contém uma mensagem simples (e, opcionalmente, uma CTA e uma imagem), sem datas de evento nem detalhes de oferta. Passe postType: "ANNOUNCEMENT" e uma entrada postMessage por site em postSites.

Caso de uso: "Estamos abertos" em suas lojas. Anuncie uma inauguração ou novos horários no Google (e no Facebook) para um conjunto de locais em uma única chamada. Forneça uma CTA LEARN_MORE com um link para seu site e uma imagem para enriquecer o cartão. A chamada retorna imediatamente com status: INPROGRESS; consulte GET /posts/{postId} periodicamente com o socialPost.id retornado até que indique SUCCESS e leia publishDetails[].submissionError se houver falha em algum site.

Observações.

  • O corpo da requisição deve estar encapsulado em um objeto input: cada campo (postName, locationIds, postType, postSites, …) é uma propriedade de input. Um corpo sem esse encapsulamento é rejeitado com HTTP 400 (Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided).
  • postSites e cada postMessage.site usam o enum de sites (GOOGLE, FACEBOOK); forneça uma entrada de mensagem para cada site em que você pretende publicar.
  • Para publicar o mesmo anúncio em muitos locais, passe todos os IDs em locationIds aqui ou use POST /bulk-posts para publicações em larga escala em vários locais.
  • Para publicações com datas, use eventos; para cupons/descontos, use ofertas.

Operação de gravação: não executada na conta em produção. A requisição e a resposta exibidas são construídas a partir do esquema da API; quando executada, esta operação publica em perfis reais do Google/Facebook.

Request
curl -X POST 'https://listingsapi.com/api/v4/posts' \  -H "Authorization: API $LISTINGSAPI_KEY" \  -H 'Content-Type: application/json' \  -d '{    "input": {      "postName": "Grand Opening Announcement",      "locationIds": [        "TG9jYXRpb246MTgwMDI4OQ=="      ],      "postType": "ANNOUNCEMENT",      "postSites": [        "GOOGLE"      ],      "postMessage": [        {          "site": "GOOGLE",          "message": "We are now open! Visit Jenny Home this week for our grand opening."        }      ],      "postCta": [        {          "site": "GOOGLE",          "type": "LEARN_MORE",          "url": "https://jennyhome.example/opening"        }      ],      "postMediaUrl": [        {          "site": "GOOGLE",          "url": "https://cdn.example.com/opening.jpg",          "type": "IMAGE"        }      ]    }  }'