Skip to content

Links

Create tracked links.

Create links

POST/v1/links/
links:writeIdempotency-Key required

Parameters

NameInTypeNotes
Idempotency-Keyrequiredheaderstring (uuid)UUID4 identifying one intended write. Reuse it only when retrying that same write.

Request body

FieldTypeNotes
destination_urlrequiredstring (uri)max length 2048
namerequiredstringmax length 255
og_descriptionstringmax length 5000
og_image_urlstring (uri)max length 2048
og_titlestringmax length 255
slugstringmax length 255
Response fields (201)
FieldTypeNotes
created_atstring (date-time)read-only
destination_urlstringread-only
domainstringread-only
idstringread-only
namestringread-only
og_descriptionstringread-only
og_image_urlstringread-only
og_titlestringread-only
short_urlstringread-only
slugstringread-only

Responses

  • 201Success
  • 400The request is invalid.
  • 401Authentication is missing, invalid, or revoked.
  • 403The authenticated identity lacks the required scope or capability.
  • 404The resource is unavailable or not visible to this organization.
  • 409The write conflicts with current state or an identical request is still running.
  • 422The write contains fields outside its closed input schema.
  • 429The request-rate budget is exhausted.

Example request

curl
curl -X POST "https://api.themochi.app/v1/links/" \
  -H "Authorization: Bearer $MOCHI_API_KEY" \
  -H "Idempotency-Key: $(uuidgen | tr A-Z a-z)" \
  -H "Content-Type: application/json" \
  -d '{"destination_url":"string","name":"string"}'