ProjectFlow Pre-launch

Idempotency

Networks are unreliable. Here is how to retry writes without creating anything twice.

On this page
  1. What you can retry
  2. External keys
  3. Idempotency-Key

What you can retry

CallRetrying
GETAlways safe.
PATCH, DELETESafe as long as you send the same values. A second DELETE answers 404.
POST …/upsert-by-external-keySafe: the same externalKey hits the same object.
POST /feedbackSafe with Idempotency-Key.
Any other POSTNot 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.

Create or update a task by key
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 409 with Retry-After.
  • The same key with a different report gets 422.

Incoming webhooks in Flows understand the same header: one key starts only one run.

Recognising a replayHTTP
POST /v1/feedback
Authorization: Bearer pff_YOUR_KEY
Idempotency-Key: 3f2c1a9e-6c0a-4b77-9a51-2c1f0b7e4d10

HTTP/1.1 201 Created
Idempotent-Replay: true

↑↓ to select, Enter to open, Esc to close