← All ideas

Link: Add an upsert endpoint to the v1 API that creates or updates a link in one call

NewLinkIdea

Dub offers PUT /links/upsert, which creates the link or updates the one with the same URL (https://dub.co/docs/api-reference/endpoint/upsert-a-link). Today an integration must GET by externalId, then POST or PATCH (app/api/v1/links/route.ts and lib/routes/v1/links/[id]/route.ts), with a race between the two calls. For a small team syncing links from a CMS or a database, one idempotent call is simpler and safer. First scope: PUT /api/v1/links/upsert keyed on externalId, falling back to destination URL, returning 200 when updated and 201 when created.

Comments 0

No comments yet.