Link API | How to Shorten Links using the Y.GY API

This is the main API to create new short links with y.gy.


POST/api/v1/link

Required attributes

  • Name
    destination_url
    Type
    string
    Description

    The short link will redirect to this destination URL

Optional attributes

  • Name
    domain
    Type
    string
    Description

    This is the root domain of the short link. If you don't send any values, we assume the root link is y.gy. You can add a custom link, but this has to be verified via the y.gy dashboard first.

  • Name
    suffix
    Type
    string
    Description

    The end of the domain. If the suffix is 123, the short link might look like y.gy/123

  • Name
    password
    Type
    string
    Description

    If you want to password protect you page, you can include a password here.

  • Name
    og_title
    Type
    string
    Description

    This is the title that shows on social link previews on social media.

  • Name
    og_description
    Type
    string
    Description

    This is the description that shows on social link previews on social media.

  • Name
    og_image
    Type
    string
    Description

    This is the image that shows on social link previews on social media. The image needs to be a URL to an image object, for example https://dev-test-bucket.s3.amazonaws.com/be2219f6-bc01-424d-b040-7e5f5f688f3c.png

  • Name
    expiration_date
    Type
    datetime
    Description

    If you want the link to inaccessible after a given date, you can add the datetime of that here.

  • Name
    qr_code_foreground_hex
    Type
    string
    Description

    We return a QR code with all short links. You can optionally add a foreground color for the QR PNG/SVG. Please add a full hex including the # -- for example: #CF245A.

  • Name
    qr_code_background_hex
    Type
    string
    Description

    We return a QR code with all short links. You can optionally add a background color for the QR PNG/SVG. Please add a full hex including the # -- for example: #CF245A.

Response

The response is an Link object as shown in the response.

Request

POST
/api/v1/signup
curl --request POST \
  --url https://api.y.gy/api/v1/link \
  --header 'Content-Type: application/json' \
  --data '{
    "destination_url": "x.com/getwaitlist",
    "domain": "wait.list",
    "suffix": "social"
  }'

Link Response Example

 {
  "id": 12,
  "created_at": "2023-09-11_03-33-06",
  "domain": "https://wait.list",
  "suffix": "social",
  "organization_id": 11,
  "og_title": None,
  "og_description": None,
  "og_image": None,
  "destination_url": "https://x.com/getwaitlist",
  "qr_code_svg": "<svg width=\"29mm\" height=\"29mm\" version=\"1.1\" viewBox=\"0 0 29 29\" xmlns=\"http://www.w3.org/2000/svg\"><rect width=\"100%\" height=\"100%\" x=\"3\" y=\"3\" fill=\"#ffffff\" /><path d=\"M4,4H5V5H4zM5,4H6V5H5zM6,4H7V5H6zM7,4H8V5H7zM8,4H9V5H8zM9,4H10V5H9zM10,4H11V5H10zM12,4H13V5H12zM18,4H19V5H18zM19,4H20V5H19zM20,4H21V5H20zM21,4H22V5H21zM22,4H23V5H22zM23,4H24V5H23zM24,4H25V5H24zM4,5H5V6H4zM10,5H11V6H10zM14,5H15V6H14zM15,5H16V6H15zM16,5H17V6H16zM18,5H19V6H18zM24,5H25V6H24zM4,6H5V7H4zM6,6H7V7H6zM7,6H8V7H7zM8,6H9V7H8zM10,6H11V7H10zM14,6H15V7H14zM15,6H16V7H15zM16,6H17V7H16zM18,6H19V7H18zM20,6H21V7H20zM21,6H22V7H21zM22,6H23V7H22zM24,6H25V7H24zM4,7H5V8H4zM6,7H7V8H6zM7,7H8V8H7zM8,7H9V8H8zM10,7H11V8H10zM12,7H13V8H12zM14,7H15V8H14zM16,7H17V8H16zM18,7H19V8H18zM20,7H21V8H20zM21,7H22V8H21zM22,7H23V8H22zM24,7H25V8H24zM4,8H5V9H4zM6,8H7V9H6zM7,8H8V9H7zM8,8H9V9H8zM10,8H11V9H10zM12,8H13V9H12zM13,8H14V9H13zM14,8H15V9H14zM16,8H17V9H16zM18,8H19V9H18zM20,8H21V9H20zM21,8H22V9H21zM22,8H23V9H22zM24,8H25V9H24zM4,9H5V10H4zM10,9H11V10H10zM12,9H13V10H12zM14,9H15V10H14zM15,9H16V10H15zM18,9H19V10H18zM24,9H25V10H24zM4,10H5V11H4zM5,10H6V11H5zM6,10H7V11H6zM7,10H8V11H7zM8,10H9V11H8zM9,10H10V11H9zM10,10H11V11H10zM12,10H13V11H12zM14,10H15V11H14zM16,10H17V11H16zM18,10H19V11H18zM19,10H20V11H19zM20,10H21V11H20zM21,10H22V11H21zM22,10H23V11H22zM23,10H24V11H23zM24,10H25V11H24zM12,11H13V12H12zM13,11H14V12H13zM14,11H15V12H14zM15,11H16V12H15zM16,11H17V12H16zM4,12H5V13H4zM8,12H9V13H8zM10,12H11V13H10zM11,12H12V13H11zM12,12H13V13H12zM13,12H14V13H13zM14,12H15V13H14zM15,12H16V13H15zM17,12H18V13H17zM18,12H19V13H18zM19,12H20V13H19zM20,12H21V13H20zM21,12H22V13H21zM24,12H25V13H24zM5,13H6V14H5zM6,13H7V14H6zM7,13H8V14H7zM13,13H14V14H13zM14,13H15V14H14zM16,13H17V14H16zM20,13H21V14H20zM21,13H22V14H21zM22,13H23V14H22zM5,14H6V15H5zM6,14H7V15H6zM8,14H9V15H8zM9,14H10V15H9zM10,14H11V15H10zM11,14H12V15H11zM12,14H13V15H12zM13,14H14V15H13zM14,14H15V15H14zM15,14H16V15H15zM17,14H18V15H17zM18,14H19V15H18zM19,14H20V15H19zM20,14H21V15H20zM21,14H22V15H21zM23,14H24V15H23zM5,15H6V16H5zM8,15H9V16H8zM12,15H13V16H12zM13,15H14V16H13zM14,15H15V16H14zM17,15H18V16H17zM4,16H5V17H4zM7,16H8V17H7zM10,16H11V17H10zM14,16H15V17H14zM15,16H16V17H15zM19,16H20V17H19zM20,16H21V17H20zM21,16H22V17H21zM23,16H24V17H23zM12,17H13V18H12zM13,17H14V18H13zM17,17H18V18H17zM20,17H21V18H20zM21,17H22V18H21zM22,17H23V18H22zM23,17H24V18H23zM4,18H5V19H4zM5,18H6V19H5zM6,18H7V19H6zM7,18H8V19H7zM8,18H9V19H8zM9,18H10V19H9zM10,18H11V19H10zM12,18H13V19H12zM13,18H14V19H13zM14,18H15V19H14zM19,18H20V19H19zM20,18H21V19H20zM21,18H22V19H21zM23,18H24V19H23zM4,19H5V20H4zM10,19H11V20H10zM13,19H14V20H13zM16,19H17V20H16zM19,19H20V20H19zM23,19H24V20H23zM4,20H5V21H4zM6,20H7V21H6zM7,20H8V21H7zM8,20H9V21H8zM10,20H11V21H10zM12,20H13V21H12zM14,20H15V21H14zM15,20H16V21H15zM17,20H18V21H17zM20,20H21V21H20zM21,20H22V21H21zM4,21H5V22H4zM6,21H7V22H6zM7,21H8V22H7zM8,21H9V22H8zM10,21H11V22H10zM13,21H14V22H13zM14,21H15V22H14zM19,21H20V22H19zM20,21H21V22H20zM22,21H23V22H22zM23,21H24V22H23zM24,21H25V22H24zM4,22H5V23H4zM6,22H7V23H6zM7,22H8V23H7zM8,22H9V23H8zM10,22H11V23H10zM14,22H15V23H14zM18,22H19V23H18zM19,22H20V23H19zM20,22H21V23H20zM21,22H22V23H21zM4,23H5V24H4zM10,23H11V24H10zM13,23H14V24H13zM14,23H15V24H14zM16,23H17V24H16zM17,23H18V24H17zM4,24H5V25H4zM5,24H6V25H5zM6,24H7V25H6zM7,24H8V25H7zM8,24H9V25H8zM9,24H10V25H9zM10,24H11V25H10zM12,24H13V25H12zM13,24H14V25H13zM16,24H17V25H16zM17,24H18V25H17zM21,24H22V25H21zM24,24H25V25H24z\" id=\"qr-path\" fill=\"#000000\" fill-opacity=\"1\" fill-rule=\"nonzero\" stroke=\"none\"/></svg>",
  "qr_code_png": "https://dev-yotto.s3.amazonaws.com/be2219f6-bc01-424d-b040-7e5f5f688f3c.png",
  "url": "https://wait.list/social"
  "expiration_date": None,
  "qr_code_foreground_hex": "#ffffff",
  "qr_code_background_hex": "#000000",
  "has_password": False
}

GET/api/v1/link

Optional attributes

  • Name
    id
    Type
    string
    Description

    The ID of the link as returned by the y.gy API originally

Response

The response is a link object, as shown in the response.

Request

GET
/api/v1/signup
curl --request GET \
  --url https://api.y.gy/api/v1/signup?id=12\
  --header 'Content-Type: application/json' \

Link Response Example

{
  "id": 12,
  "created_at": "2023-09-11_03-33-06",
  "domain": "https://wait.list",
  "suffix": "social",
  "organization_id": 11,
  "og_title": None,
  "og_description": None,
  "og_image": None,
  "destination_url": "https://x.com/getwaitlist",
  "qr_code_svg": "<svg width=\"29mm\" height=\"29mm\" version=\"1.1\" viewBox=\"0 0 29 29\" xmlns=\"http://www.w3.org/2000/svg\"><rect width=\"100%\" height=\"100%\" x=\"3\" y=\"3\" fill=\"#ffffff\" /><path d=\"M4,4H5V5H4zM5,4H6V5H5zM6,4H7V5H6zM7,4H8V5H7zM8,4H9V5H8zM9,4H10V5H9zM10,4H11V5H10zM12,4H13V5H12zM18,4H19V5H18zM19,4H20V5H19zM20,4H21V5H20zM21,4H22V5H21zM22,4H23V5H22zM23,4H24V5H23zM24,4H25V5H24zM4,5H5V6H4zM10,5H11V6H10zM14,5H15V6H14zM15,5H16V6H15zM16,5H17V6H16zM18,5H19V6H18zM24,5H25V6H24zM4,6H5V7H4zM6,6H7V7H6zM7,6H8V7H7zM8,6H9V7H8zM10,6H11V7H10zM14,6H15V7H14zM15,6H16V7H15zM16,6H17V7H16zM18,6H19V7H18zM20,6H21V7H20zM21,6H22V7H21zM22,6H23V7H22zM24,6H25V7H24zM4,7H5V8H4zM6,7H7V8H6zM7,7H8V8H7zM8,7H9V8H8zM10,7H11V8H10zM12,7H13V8H12zM14,7H15V8H14zM16,7H17V8H16zM18,7H19V8H18zM20,7H21V8H20zM21,7H22V8H21zM22,7H23V8H22zM24,7H25V8H24zM4,8H5V9H4zM6,8H7V9H6zM7,8H8V9H7zM8,8H9V9H8zM10,8H11V9H10zM12,8H13V9H12zM13,8H14V9H13zM14,8H15V9H14zM16,8H17V9H16zM18,8H19V9H18zM20,8H21V9H20zM21,8H22V9H21zM22,8H23V9H22zM24,8H25V9H24zM4,9H5V10H4zM10,9H11V10H10zM12,9H13V10H12zM14,9H15V10H14zM15,9H16V10H15zM18,9H19V10H18zM24,9H25V10H24zM4,10H5V11H4zM5,10H6V11H5zM6,10H7V11H6zM7,10H8V11H7zM8,10H9V11H8zM9,10H10V11H9zM10,10H11V11H10zM12,10H13V11H12zM14,10H15V11H14zM16,10H17V11H16zM18,10H19V11H18zM19,10H20V11H19zM20,10H21V11H20zM21,10H22V11H21zM22,10H23V11H22zM23,10H24V11H23zM24,10H25V11H24zM12,11H13V12H12zM13,11H14V12H13zM14,11H15V12H14zM15,11H16V12H15zM16,11H17V12H16zM4,12H5V13H4zM8,12H9V13H8zM10,12H11V13H10zM11,12H12V13H11zM12,12H13V13H12zM13,12H14V13H13zM14,12H15V13H14zM15,12H16V13H15zM17,12H18V13H17zM18,12H19V13H18zM19,12H20V13H19zM20,12H21V13H20zM21,12H22V13H21zM24,12H25V13H24zM5,13H6V14H5zM6,13H7V14H6zM7,13H8V14H7zM13,13H14V14H13zM14,13H15V14H14zM16,13H17V14H16zM20,13H21V14H20zM21,13H22V14H21zM22,13H23V14H22zM5,14H6V15H5zM6,14H7V15H6zM8,14H9V15H8zM9,14H10V15H9zM10,14H11V15H10zM11,14H12V15H11zM12,14H13V15H12zM13,14H14V15H13zM14,14H15V15H14zM15,14H16V15H15zM17,14H18V15H17zM18,14H19V15H18zM19,14H20V15H19zM20,14H21V15H20zM21,14H22V15H21zM23,14H24V15H23zM5,15H6V16H5zM8,15H9V16H8zM12,15H13V16H12zM13,15H14V16H13zM14,15H15V16H14zM17,15H18V16H17zM4,16H5V17H4zM7,16H8V17H7zM10,16H11V17H10zM14,16H15V17H14zM15,16H16V17H15zM19,16H20V17H19zM20,16H21V17H20zM21,16H22V17H21zM23,16H24V17H23zM12,17H13V18H12zM13,17H14V18H13zM17,17H18V18H17zM20,17H21V18H20zM21,17H22V18H21zM22,17H23V18H22zM23,17H24V18H23zM4,18H5V19H4zM5,18H6V19H5zM6,18H7V19H6zM7,18H8V19H7zM8,18H9V19H8zM9,18H10V19H9zM10,18H11V19H10zM12,18H13V19H12zM13,18H14V19H13zM14,18H15V19H14zM19,18H20V19H19zM20,18H21V19H20zM21,18H22V19H21zM23,18H24V19H23zM4,19H5V20H4zM10,19H11V20H10zM13,19H14V20H13zM16,19H17V20H16zM19,19H20V20H19zM23,19H24V20H23zM4,20H5V21H4zM6,20H7V21H6zM7,20H8V21H7zM8,20H9V21H8zM10,20H11V21H10zM12,20H13V21H12zM14,20H15V21H14zM15,20H16V21H15zM17,20H18V21H17zM20,20H21V21H20zM21,20H22V21H21zM4,21H5V22H4zM6,21H7V22H6zM7,21H8V22H7zM8,21H9V22H8zM10,21H11V22H10zM13,21H14V22H13zM14,21H15V22H14zM19,21H20V22H19zM20,21H21V22H20zM22,21H23V22H22zM23,21H24V22H23zM24,21H25V22H24zM4,22H5V23H4zM6,22H7V23H6zM7,22H8V23H7zM8,22H9V23H8zM10,22H11V23H10zM14,22H15V23H14zM18,22H19V23H18zM19,22H20V23H19zM20,22H21V23H20zM21,22H22V23H21zM4,23H5V24H4zM10,23H11V24H10zM13,23H14V24H13zM14,23H15V24H14zM16,23H17V24H16zM17,23H18V24H17zM4,24H5V25H4zM5,24H6V25H5zM6,24H7V25H6zM7,24H8V25H7zM8,24H9V25H8zM9,24H10V25H9zM10,24H11V25H10zM12,24H13V25H12zM13,24H14V25H13zM16,24H17V25H16zM17,24H18V25H17zM21,24H22V25H21zM24,24H25V25H24z\" id=\"qr-path\" fill=\"#000000\" fill-opacity=\"1\" fill-rule=\"nonzero\" stroke=\"none\"/></svg>",
  "qr_code_png": "https://dev-yotto.s3.amazonaws.com/be2219f6-bc01-424d-b040-7e5f5f688f3c.png",
  "url": "https://wait.list/social"
  "expiration_date": None,
  "qr_code_foreground_hex": "#ffffff",
  "qr_code_background_hex": "#000000",
  "has_password": False
}