Shortenify GraphQL API

Welcome to the Shortenify GraphQL API documentation. Here you'll be able to navigate through the API.

API Endpoints
https://api.shortenify.com/graphql
Version

1.0.0

Queries

Mutations

shortenify

Description

Takes an URL and returns a short link, such as https://shortenify.com/NpUyc url: The URL for which you want to generate a short one. Throws the following error(s): TOO_MANY_REQUESTS: if you have hit the quota per minute/hour for the API key you have used or if you have reached the maximum number of links you can create per day.

Response

Returns a Link

Arguments
Name Description
input - ShortenifyInput!

Example

Query
mutation shortenify($input: ShortenifyInput!) {
  shortenify(input: $input) {
    created
    id
    lastOpened
    opened
    protected
    qrCode {
      type
      value
    }
    redirectTo
    segments {
      countries {
        ...LinkSegmentsCountryFragment
      }
      devices {
        ...LinkSegmentsDeviceFragment
      }
      platforms {
        ...LinkSegmentsPlatformFragment
      }
    }
    statistics {
      items {
        ...LinkStatisticsFragment
      }
      nextToken
      totalCount
    }
    todayStatistics {
      date
      id
      lastOpened
      opened
      segments {
        ...LinkSegmentsFragment
      }
    }
    url
  }
}
Variables
{"input": ShortenifyInput}
Response
{
  "data": {
    "shortenify": {
      "created": AWSDateTime,
      "id": "4",
      "lastOpened": AWSDateTime,
      "opened": 987,
      "protected": false,
      "qrCode": LinkQrCode,
      "redirectTo": AWSURL,
      "segments": LinkSegments,
      "statistics": LinkStatisticsConnection,
      "todayStatistics": LinkStatistics,
      "url": AWSURL
    }
  }
}

updateApiKeyStatistics

Description

Internally used for updating the subscriptions for the API key.

Response

Returns an ApiKeyStatistics

Arguments
Name Description
input - UpdateApiKeyStatisticsInput!

Example

Query
mutation updateApiKeyStatistics($input: UpdateApiKeyStatisticsInput!) {
  updateApiKeyStatistics(input: $input) {
    id
    links {
      clicked
      opened
      total
    }
  }
}
Variables
{"input": UpdateApiKeyStatisticsInput}
Response
{
  "data": {
    "updateApiKeyStatistics": {
      "id": "xyz789",
      "links": ApiKeyLinks
    }
  }
}

updateLinkStatistics

Description

Internally used for updating the subscriptions for the link.

Response

Returns a LinkStatistics

Arguments
Name Description
input - UpdateLinkStatisticsInput!

Example

Query
mutation updateLinkStatistics($input: UpdateLinkStatisticsInput!) {
  updateLinkStatistics(input: $input) {
    date
    id
    lastOpened
    opened
    segments {
      countries {
        ...LinkSegmentsCountryFragment
      }
      devices {
        ...LinkSegmentsDeviceFragment
      }
      platforms {
        ...LinkSegmentsPlatformFragment
      }
    }
  }
}
Variables
{"input": UpdateLinkStatisticsInput}
Response
{
  "data": {
    "updateLinkStatistics": {
      "date": AWSDate,
      "id": "abc123",
      "lastOpened": AWSDateTime,
      "opened": 987,
      "segments": LinkSegments
    }
  }
}

Subscriptions

onUpdatedApiKeyStatistics

Description

Subscribes to the updates for a given API key. N.B.: You can only subscribe to your own API updates, ie you have to pass the same id as in the authorization header. id: The ID of the API key you want to receive updates about.

Response

Returns an ApiKeyStatistics

Arguments
Name Description
id - String!

Example

Query
subscription onUpdatedApiKeyStatistics($id: String!) {
  onUpdatedApiKeyStatistics(id: $id) {
    id
    links {
      clicked
      opened
      total
    }
  }
}
Variables
{"id": "xyz789"}
Response
{
  "data": {
    "onUpdatedApiKeyStatistics": {
      "id": "abc123",
      "links": ApiKeyLinks
    }
  }
}

onUpdatedLinkStatistics

Description

Subscribes to the updates for a given link. id: The ID of the link you want to receive updates about Example of a payload that you will receive: { "data": { "onUpdatedLinkStatistics": { "date": "2024-06-27", "segments": { "countries": [ { "country": "FR", "opened": 10 } ], "devices": { "OS": { "android": null, "iOS": 8 } }, "platforms": { "desktop": 2, "mobile": 8, "tablet": null } } } }

Response

Returns a LinkStatistics

Arguments
Name Description
id - String!

Example

Query
subscription onUpdatedLinkStatistics($id: String!) {
  onUpdatedLinkStatistics(id: $id) {
    date
    id
    lastOpened
    opened
    segments {
      countries {
        ...LinkSegmentsCountryFragment
      }
      devices {
        ...LinkSegmentsDeviceFragment
      }
      platforms {
        ...LinkSegmentsPlatformFragment
      }
    }
  }
}
Variables
{"id": "xyz789"}
Response
{
  "data": {
    "onUpdatedLinkStatistics": {
      "date": AWSDate,
      "id": "abc123",
      "lastOpened": AWSDateTime,
      "opened": 987,
      "segments": LinkSegments
    }
  }
}

Types

AWSDate

Description

The AWSDate scalar type provided by AWS AppSync, represents a valid extended ISO 8601 Date string. In other words, this scalar type accepts date strings of the form YYYY-MM-DD. The scalar can also accept "negative years" of the form -YYYY which correspond to years before 0000. For example, "-2017-05-01" and "-9999-01-01" are both valid dates. This scalar type can also accept an optional time zone offset. For example, "1970-01-01", "1970-01-01Z", "1970-01-01-07:00" and "1970-01-01+05:30" are all valid dates. The time zone offset must either be Z (representing the UTC time zone) or be in the format ±hh:mm:ss. The seconds field in the timezone offset will be considered valid even though it is not part of the ISO 8601 standard.

Example
AWSDate

AWSDateTime

Description

The AWSDateTime scalar type provided by AWS AppSync, represents a valid extended ISO 8601 DateTime string. In other words, this scalar type accepts datetime strings of the form YYYY-MM-DDThh:mm:ss.SSSZ. The scalar can also accept "negative years" of the form -YYYY which correspond to years before 0000. For example, "-2017-01-01T00:00Z" and "-9999-01-01T00:00Z" are both valid datetime strings. The field after the two digit seconds field is a nanoseconds field. It can accept between 1 and 9 digits. So, for example, "1970-01-01T12:00:00.2Z", "1970-01-01T12:00:00.277Z" and "1970-01-01T12:00:00.123456789Z" are all valid datetime strings. The seconds and nanoseconds fields are optional (the seconds field must be specified if the nanoseconds field is to be used). The time zone offset is compulsory for this scalar. The time zone offset must either be Z (representing the UTC time zone) or be in the format ±hh:mm:ss. The seconds field in the timezone offset will be considered valid even though it is not part of the ISO 8601 standard.

Example
AWSDateTime

AWSURL

Description

The AWSURL scalar type provided by AWS AppSync, represents a valid URL string (Ex: https://www.amazon.com/). The URL may use any scheme and may also be a local URL (Ex: http://localhost/). URLs without schemes like "amazon.com" or "www.amazon.com" are considered invalid. URLs which contain double slashes (two consecutive forward slashes) in their path are also considered invalid.

Example
AWSURL

ApiKeyStatistics

Description

Data structure storing the statistics about an API key.

Fields
Field Name Description
id - String! The ID of the API key. To be passed into the Authorization header.
links - ApiKeyLinks Statistics about the links generated.
Example
{
  "id": "abc123",
  "links": ApiKeyLinks
}

Boolean

Description

Built-in Boolean

Example
true

CredentialsInput

Description

Represents the credentials to use for protecting a link. It relies on the Basic access authentication.

Fields
Input Field Description
username - String! Username to fill for accessing the link.
password - String! Password to fill for accessing the link.
Example
{
  "username": "xyz789",
  "password": "abc123"
}

DeleteLinkInput

Description

Represents the input for deleting a link.

Fields
Input Field Description
linkId - ID! Id of the link to delete. This action cannot be reversed, so use it carefully.
Example
{"linkId": "4"}

ID

Description

Built-in ID

Example
"4"

Int

Description

Built-in Int

Example
987

LinkConnection

Description

Represents the pagination for querying links.

Fields
Field Name Description
items - [Link] The links for the given page.
nextToken - String The token to pass down for fetching the next page of links
totalCount - Int! The total number of links.
Example
{
  "items": [Link],
  "nextToken": "abc123",
  "totalCount": 987
}

LinkQrCode

Description

Data structure storing the QR code information about a link.

Fields
Field Name Description
type - QrCodeType! The QR code representation (base64 or svg).
value - String! The QR code value itself.
Example
{"type": "data", "value": "xyz789"}

LinkSegments

Description

Gives some details regarding a given link, such as the countries from which the link has been opened, or the platform(s).

Fields
Field Name Description
countries - [LinkSegmentsCountry] List of all the countries from which the link have been opened with the number.
devices - LinkSegmentsDevice List of all the devices from which the link have been opened with their respective values.
platforms - LinkSegmentsPlatform List of all the platforms from which the link have been opened with their respective values.
Example
{
  "countries": [LinkSegmentsCountry],
  "devices": LinkSegmentsDevice,
  "platforms": LinkSegmentsPlatform
}

LinkSegmentsCountry

Description

Represents insights about the countries.

Fields
Field Name Description
country - String! Country from which the link has been opened.
opened - Int! Number of times this link has been clicked from that country.
Example
{"country": "xyz789", "opened": 987}

LinkSegmentsDevice

Description

Represents insights about the devices.

Fields
Field Name Description
OS - LinkSegmentsDeviceOS Represents insights about the Operating Systems.
Example
{"OS": LinkSegmentsDeviceOS}

LinkSegmentsDeviceOS

Description

Represents insights about the Operating Systems.

Fields
Field Name Description
android - Int Number of times a link has been opened from an android device. It relies on cloudfront-is-android-viewer header.
iOS - Int Number of times a link has been opened from an iOS device. It relies on cloudfront-is-ios-viewer header.
Example
{"android": 123, "iOS": 123}

LinkSegmentsPlatform

Description

Represents insights about the platforms.

Fields
Field Name Description
desktop - Int Number of times a link has been opened from a desktop. It relies on cloudfront-is-desktop-viewer header.
mobile - Int Number of times a link has been opened from a mobile. It relies on cloudfront-is-mobile-viewer header.
tablet - Int Number of times a link has been opened from a tablet. It relies on cloudfront-is-tablet-viewer header.
Example
{"desktop": 987, "mobile": 987, "tablet": 123}

LinkStatistics

Description

Represents the statistics information about a link

Fields
Field Name Description
date - AWSDate Represents the date of this current statistic
id - String! Represents the generated ID of this link
lastOpened - AWSDateTime Represents the last time this link has been opened
opened - Int! Represents the total number of times this link has been opened
segments - LinkSegments Represents the segments information about this link
Example
{
  "date": AWSDate,
  "id": "abc123",
  "lastOpened": AWSDateTime,
  "opened": 123,
  "segments": LinkSegments
}

LinkStatisticsConnection

Description

Represents the pagination for querying link statistics.

Fields
Field Name Description
items - [LinkStatistics] The link statistics for the given page.
nextToken - String The token to pass down for fetching the next page of link statistics
totalCount - Int! The total number of links statistics.
Example
{
  "items": [LinkStatistics],
  "nextToken": "abc123",
  "totalCount": 987
}

LinkStatisticsPeriod

Description

Granularity of the statistics about a link

Values
Enum Value Description

daily

monthly

Example
"daily"

QrCodeType

Description

Kind of QR code. It can be stored as a base 64 image (ie data) or as an SVG representation

Values
Enum Value Description

data

svg

Example
"data"

ShortenifyInput

Description

Represents the input to give for creating a brand new link.

Fields
Input Field Description
url - String! The URL for which you want to create a link.
qrCodeType - QrCodeType Optional. The QR format associated to the new link.
credentials - CredentialsInput Optional. The credentials to fill for accessing the new link.
Example
{
  "url": "xyz789",
  "qrCodeType": "data",
  "credentials": CredentialsInput
}

String

Description

Built-in String

Example
"xyz789"

UpdateApiKeyLinkStatisticsInput

Fields
Input Field Description
clicked - Int
opened - Int
total - Int
Example
{"clicked": 123, "opened": 123, "total": 987}

UpdateApiKeyStatisticsInput

Fields
Input Field Description
id - String!
links - UpdateApiKeyLinkStatisticsInput!
Example
{
  "id": "abc123",
  "links": UpdateApiKeyLinkStatisticsInput
}

UpdateLinkLinkSegments

Fields
Input Field Description
countries - [UpdateLinkSegmentsCountry]
devices - UpdateLinkSegmentsDevice
platforms - UpdateLinkSegmentsPlatform
Example
{
  "countries": [UpdateLinkSegmentsCountry],
  "devices": UpdateLinkSegmentsDevice,
  "platforms": UpdateLinkSegmentsPlatform
}

UpdateLinkSegmentsCountry

Fields
Input Field Description
country - String
opened - Int
Example
{"country": "xyz789", "opened": 987}

UpdateLinkSegmentsDevice

Fields
Input Field Description
OS - UpdateLinkSegmentsDeviceOS
Example
{"OS": UpdateLinkSegmentsDeviceOS}

UpdateLinkSegmentsDeviceOS

Fields
Input Field Description
android - Int
iOS - Int
Example
{"android": 987, "iOS": 987}

UpdateLinkSegmentsPlatform

Fields
Input Field Description
desktop - Int
mobile - Int
tablet - Int
Example
{"desktop": 987, "mobile": 123, "tablet": 123}

UpdateLinkStatisticsInput

Fields
Input Field Description
id - String!
date - AWSDate!
lastOpened - AWSDateTime
segments - UpdateLinkLinkSegments
opened - Int!
Example
{
  "id": "xyz789",
  "date": AWSDate,
  "lastOpened": AWSDateTime,
  "segments": UpdateLinkLinkSegments,
  "opened": 123
}