{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/en/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Idempotency","description":"Documentação oficial, guias e referência da API Auvo v2.","siteUrl":"https://developers.auvo.com.br","lang":"pt-BR","keywords":"auvo, api, documentação, developers, field service, workforce","meta":[{"name":"og:site_name","content":"Auvo Developers"},{"name":"og:locale","content":"pt_BR"},{"name":"og:locale:alternate","content":"es_ES"},{"name":"og:locale:alternate","content":"en_US"},{"name":"twitter:card","content":"summary_large_image"},{"name":"twitter:site","content":"@auvoapp"}],"llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"idempotency","__idx":0},"children":["Idempotency"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PUT"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["DELETE"]}," are idempotent by HTTP design. For ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST"]}," and"," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PATCH"]}," on sensitive resources (tasks, service orders, tickets) follow the"," ","practices below."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"correlate-with-externalid","__idx":1},"children":["Correlate with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["externalId"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Send a client-generated identifier in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["externalId"]}," (e.g. ERP ID). Before"," ","creating, run the matching ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET"]}," filtered by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["externalId"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If it exists, update via ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PATCH"]},"; otherwise create via ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"per-delivery-idempotency-webhooks","__idx":2},"children":["Per-delivery idempotency (Webhooks)"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Use the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["deliveryId"]}," from the payload to deduplicate on your side (write-once"," ","into a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["webhook_deliveries"]}," table)."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"safe-retry-policy","__idx":3},"children":["Safe retry policy"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"ts","header":{"controls":{"copy":{}}},"source":"async function postWithSafety(body) {\n  const existing = await findByExternalId(body.externalId);\n  if (existing) return existing;\n  try {\n    return await api.post('/tasks', body);\n  } catch (err) {\n    if (err.status === 409) {\n      return findByExternalId(body.externalId);\n    }\n    throw err;\n  }\n}\n","lang":"ts"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"roadmap","__idx":4},"children":["Roadmap"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Native ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Idempotency-Key"]}," support (Stripe-like) — watch the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/changelog"},"children":["changelog"]},"."]}]}]},"headings":[{"value":"Idempotency","id":"idempotency","depth":1},{"value":"Correlate with externalId","id":"correlate-with-externalid","depth":2},{"value":"Per-delivery idempotency (Webhooks)","id":"per-delivery-idempotency-webhooks","depth":2},{"value":"Safe retry policy","id":"safe-retry-policy","depth":2},{"value":"Roadmap","id":"roadmap","depth":2}],"frontmatter":{"title":"Idempotency","description":"How to make POST/PATCH retries safe.","seo":{"title":"Idempotency"}},"lastModified":"2026-04-24T13:01:34.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/en/guides/idempotency","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}