Creatopy Public API
  • Public API
    • Quickstart
    • Authentication
  • REST API
    • Overview
    • Auth
    • Exports
      • Creatives
    • Templates (Designs)
      • Elements
      • Template Sizes
      • Font variants
    • ShareLink
    • Projects
      • Project Users
    • Brand Kits
      • Brand kit assets
      • Brand kit logos
      • Brand kit media folders
      • Brand templates
    • Ad Networks
    • Ad Serving
    • Users
      • Team roles
    • Webhooks
      • Webhook action types
    • Design Versions
    • Folders
      • Move design to folder
    • Error codes
    • Designs
  • GraphQL API
    • Overview
    • Endpoints and queries
    • Postman Collection
Powered by GitBook
On this page
  • ShareLink
  • Request
  • Response
  • Generate ShareLink (with changes)
  • Request
  1. REST API

ShareLink

ShareLink

This endpoint retrieves the share link url for a specific templateHash, is working with generated Templates(variants).

Request

  • Method: GET

  • URL: https://api.creatopy.com/v1/shareLink/{{templateHash}}

Request example:

curl --location 'https://api.creatopy.com/v1/shareLink/zdow6r' \
--header 'Authorization: Bearer eyJ...'

Response

The response will be a JSON object with the following schema:

JSON

{
    "response": {
        "shareLinkUrl": "https://app.creatopy.com/share/d/5x6ze0x1q6zq",
        "comments": {
            "threads": []
        }
    }
}

Generate ShareLink (with changes)

This endpoint allows you to generate a preview based on the provided template and element changes.

Request

  • Method: POST

  • URL: https://api.creatopy.com/v1/shareLink/generate

  • Body:

  • templateHash (string, required): The hash of the creative.

  • elementsChanges (array, required):

    • elementName (string, required): The name of the element.

    • changes (array, required):

      • attribute (string, required): The attribute to be changed. (Available attributes are: "LABEL", "SOURCE", "CODE", "VISIBILITY", "FONTVARIANT" "TEXTMARKDOWN", "TEXTCOLOR", "BGCOLOR", "SVGCOLORS", "LINEHEIGHT" and "LETTERSPACING")

      • value (string, required): The new value for the attribute.

  • generalChanges (object, optional):

    • backgroundColor (string, optional): Any valid hexadecimal color code. The valid hexadecimal color code must satisfy the following conditions. It should start from '#' symbol. It should be followed by the letters from a-f, A-F and/or digits from 0-9. The length of the hexadecimal color code should be either 6 or 3, excluding '#' symbol

Valid values for elementChanges are (depending on attribute):

  • LABEL: any valid string

  • SOURCE: any valid public media file link

  • CODE: valid embed code

  • VISIBILITY: 'true' or 'false' (as string)

  • FONTVARIANT: any existing font weight value from the result of the endpoint templates/fontVariants for ex: '300italic' , '400', '700italic', etc.

  • TEXTMARKDOWN: 4 markdowns could be added to text elements

    • [This is the text](This will be the link)

    • text between one star - italic text (* will be transformed as italic text *)

    • text between two pair of stars - bold text (* * will be transformed as bold text * *) ( no spaces between those 2 stars)

    • text between two group of three stars - bold italic text (* * * will be bold transformed as italic text * * *) (no spaces between those 3 stars)

  • TEXTCOLOR: valid hexadecimal color code (#FFF or #FFFFFF) - used with TEXT and BUTTON layers

  • BGCOLOR: valid hexadecimal color code (#FFF or #FFFFFF) - used for changing background for BUTTON or SHAPE layers

  • SVGCOLORS: valid hexadecimal color list ("#123456", "#FFFFFF", "#AAAAAA") - used for layers which has svg file as source

  • LINEHEIGHT - used with TEXT layers

  • LETTERSPACING - used with TEXT and BUTTON layers

Response The response for this request is a JSON object following the schema below:

{
  "type": "object",
  "properties": {
    "previewUrl": {
      "type": "string"
    },
    "previewId": {
      "type": "string"
    }
  }
}
curl --location 'https://api.creatopy.local/v1/sharelink/generate' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJ...' \
--data '{
    "templateHash": "2kzq51",
    "elementsChanges": [
        {
            "elementName": "Headline",
            "changes": [
                {
                    "attribute": "LABEL",
                    "value": "Enjoy a $0 annual \nfee and 1.5% \n cashback on purchases"
                },
                {
                    "attribute": "VISIBILITY",
                    "value: "false"
                }         
            ]
        },
        {
            "elementName": "Description",
            "changes": [
                {
                    "attribute": "LABEL",
                    "value": "Plus, earn a $300 bonus"
                },
                {
                    "attribute": "FONTVARIANT",
                    "value": "italic300"
                }
            ]
        },
        {
            "elementName": "Logo",
            "changes": [
                {
                    "attribute": "SOURCE",
                    "value": "https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/eff.svg"
                }
            ]
        },
        {
            "elementName": "shape2",
            "changes": [
                {
                    "attribute": "SOURCE",
                    "value": "https://cdn.pixabay.com/photo/2012/04/24/16/43/targets-40383_1280.png"
                }
            ]
        },
        {
            "elementName": "Image",
            "changes": [
                {
                    "attribute": "SOURCE",
                    "value": "https://cdn.pixabay.com/photo/2012/04/24/16/43/targets-40383_1280.png"
                }
            ]
        }
    ]
}'
{
    "response": {
        "shareLinkUrl": "https://app.creatopy.com/share/d/dp7ke1g347o5"
    }
}
PreviousFont variantsNextProjects

Last updated 1 month ago