Links
On this page:
Get a specific link
The /api/links/<uuid> endpoint allows you to retrieve the URL and click statistics for a specific link by its UUID.
This is useful when you receive a webhook notification for a link click and want to look up which URL was clicked.
$ MAILCOACH_TOKEN="your API token" $ curl https://<your-mailcoach-domain>/api/links/e2cf1b63-6505-3d7a-9c51-a9eb67d97a48 \ -H "Authorization: Bearer $MAILCOACH_TOKEN" \ -H 'Accept: application/json' \ -H 'Content-Type: application/json'
Response:
{ "data": { "uuid": "e2cf1b63-6505-3d7a-9c51-a9eb67d97a48", "url": "https://example.com/my-link", "unique_click_count": 42, "click_count": 156, "clicks": [ { "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "send_uuid": "b2c3d4e5-f6a7-8901-bcde-f23456789012", "link_uuid": "e2cf1b63-6505-3d7a-9c51-a9eb67d97a48", "subscriber_uuid": "c3d4e5f6-a7b8-9012-cdef-345678901234", "created_at": "2024-01-15T10:30:00.000000Z", "updated_at": "2024-01-15T10:30:00.000000Z" } ] } }
The response includes:
uuid: The unique identifier for the linkurl: The actual URL that was clickedunique_click_count: Number of unique subscribers who clicked this linkclick_count: Total number of clicks on this linkclicks: An array of individual click records with subscriber and send information
Error handling
If the link is not found, you’ll receive a 404 response:
{ "message": "No query results for model [Link]." }
If an authentication error occurs, you’ll receive a 401 response:
{ "message": "Unauthorized." }