Idempotency
Networks are unreliable. Here is how to retry writes without creating anything twice.
On this page
What you can retry
| Call | Retrying |
|---|---|
GET | Always safe. |
PATCH, DELETE | Safe as long as you send the same values. A second DELETE answers 404. |
POST …/upsert-by-external-key | Safe: the same externalKey hits the same object. |
POST /feedback | Safe with Idempotency-Key. |
Any other POST | Not idempotent: a retry creates a second object. |
A general Idempotency-Key header for all POST routes is not available yet.
External keys
Tasks and initiatives can be created idempotently through externalKey. If the key already exists, the existing object is updated. That lets you sync data from another system without storing IDs.
Details: tasks and initiatives.
curl -X POST "https://api.getprojectflow.com/v1/projects/PROJECT_ID/tasks/upsert-by-external-key" \
-H "Authorization: Bearer pfat_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"externalKey": "ticket-4711",
"title": "Answer support ticket 4711"
}'const res = await fetch('https://api.getprojectflow.com/v1/projects/PROJECT_ID/tasks/upsert-by-external-key', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.PROJECTFLOW_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
externalKey: 'ticket-4711',
title: 'Answer support ticket 4711'
}),
});
const data = await res.json();import os
import requests
res = requests.post(
"https://api.getprojectflow.com/v1/projects/PROJECT_ID/tasks/upsert-by-external-key",
headers={
"Authorization": f"Bearer {os.environ['PROJECTFLOW_TOKEN']}",
},
json={
"externalKey": "ticket-4711",
"title": "Answer support ticket 4711"
},
)
data = res.json()var request = URLRequest(url: URL(string: "https://api.getprojectflow.com/v1/projects/PROJECT_ID/tasks/upsert-by-external-key")!)
request.httpMethod = "POST"
request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
let body: [String: Any] = [
"externalKey": "ticket-4711",
"title": "Answer support ticket 4711",
]
request.httpBody = try JSONSerialization.data(withJSONObject: body)
let (data, response) = try await URLSession.shared.data(for: request)
Idempotency-Key
The feedback ingest accepts the Idempotency-Key header, a UUID you generate. It is kept for 24 hours.
- The same request with the same key returns the original result with the header
Idempotent-Replay: true. - While the first request is still running, you get
409withRetry-After. - The same key with a different report gets
422.
Incoming webhooks in Flows understand the same header: one key starts only one run.
POST /v1/feedback
Authorization: Bearer pff_YOUR_KEY
Idempotency-Key: 3f2c1a9e-6c0a-4b77-9a51-2c1f0b7e4d10
HTTP/1.1 201 Created
Idempotent-Replay: true