Create links with preview using the API

Links with preview are the links shared on social media and displayed as a card with an image. Here is an example:

Example of a Facebook post with a link with preview

To create links with preview through the API, you can do a POST HTTP request to the http://social.cards/api/links/full endpoint. You need two things:

  • Authorization header
  • Body with a JSON like this:
{ 
	"url": "https://example.com", 
	"title": "My title", 
	"description": "My description", 
	"imgGuid": "IMG_GUID", 
	"variables": { 
		"title": "My title" 
	} 
}

To get the imgGuid parameter, open a saved image and you will be redirected to an URL like this: https://social.cards/img/IMG_GUID. IMG_GUID is the imgGuid parameter.

Here is full cURL example:

curl -X POST "http://social.cards/api/links/full" \ 
	-H "Content-Type: application/json" \ 
	-H "Authorization: Bearer YOUR_API_TOKEN" \ 
	-d '{ "url": "https://example.com", "title": "My title", "description": "My description", "imgGuid": "IMG_GUID", "variables": { "title": "My title" } }'