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
getLink
Description
Returns the link with the given id if it exists or if you own it. id
: The ID of the link, for example: "NpUyc". Throws the following errors: RESOURCE_NOT_FOUND
: if the link does not exist, or it does no belong to you. TOO_MANY_REQUESTS
: if you have hit the quota per minute/hour for the API key you have used.
Example
Query
query getLink($id: String!) {
getLink(id: $id) {
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
{"id": "abc123"}
Response
{
"data": {
"getLink": {
"created": AWSDateTime,
"id": 4,
"lastOpened": AWSDateTime,
"opened": 987,
"protected": false,
"qrCode": LinkQrCode,
"redirectTo": AWSURL,
"segments": LinkSegments,
"statistics": LinkStatisticsConnection,
"todayStatistics": LinkStatistics,
"url": AWSURL
}
}
}
getLinks
Description
Returns the links you have created so far. after
: Token to fetch the links after. Throws the following errors: TOO_MANY_REQUESTS
: if you have hit the quota per minute/hour for the API key you have used.
Response
Returns a LinkConnection
Example
Query
query getLinks(
$after: String,
$limit: Int
) {
getLinks(
after: $after,
limit: $limit
) {
items {
created
id
lastOpened
opened
protected
qrCode {
...LinkQrCodeFragment
}
redirectTo
segments {
...LinkSegmentsFragment
}
statistics {
...LinkStatisticsConnectionFragment
}
todayStatistics {
...LinkStatisticsFragment
}
url
}
nextToken
totalCount
}
}
Variables
{"after": "xyz789", "limit": 123}
Response
{
"data": {
"getLinks": {
"items": [Link],
"nextToken": "abc123",
"totalCount": 123
}
}
}
Mutations
deleteLink
Description
Deletes a link that you own. Be careful as this action is irreversible, meaning that you will never get that link from the query endpoints and any customer having this link won't be able to be redirected to the target you had defined (it's as if the link does not exist).
Response
Returns a Link
Arguments
Name | Description |
---|---|
input - DeleteLinkInput!
|
Example
Query
mutation deleteLink($input: DeleteLinkInput!) {
deleteLink(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": DeleteLinkInput}
Response
{
"data": {
"deleteLink": {
"created": AWSDateTime,
"id": "4",
"lastOpened": AWSDateTime,
"opened": 987,
"protected": false,
"qrCode": LinkQrCode,
"redirectTo": AWSURL,
"segments": LinkSegments,
"statistics": LinkStatisticsConnection,
"todayStatistics": LinkStatistics,
"url": AWSURL
}
}
}
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
ApiKeyLinks
Description
Represents the information about the links of an API key
Fields
Field Name | Description |
---|---|
clicked - Int!
|
Represents the number of links that have been clicked. Each time a link is opened, this number is incremented by 1. |
opened - Int!
|
Represents the number of different links that have been opened. This number is only incremented by 1 the very first time a link is opened. |
total - Int!
|
Represents the total number of links created by this API key. |
Example
{"clicked": 987, "opened": 123, "total": 123}
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.
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
Link
Description
Data structure storing the information about a link.
Fields
Field Name | Description |
---|---|
created - AWSDateTime!
|
Date of the creation. |
id - ID!
|
Auto-generated ID. |
lastOpened - AWSDateTime
|
Last time the link was opened. |
opened - Int!
|
Total number of times the link has been opened. |
protected - Boolean
|
Indicates if the Link is protected by a username and a password. (They are not saved and thus can not be retrieved) |
qrCode - LinkQrCode
|
QR code representtion of the shorten URL. It can be a data URI of the image or an SVG. |
redirectTo - AWSURL!
|
The URL to which the user will be redirected to. |
segments - LinkSegments
|
Statistics about the link. |
statistics - LinkStatisticsConnection
|
Get the statistics for a given period of time and granularity. |
Arguments |
|
todayStatistics - LinkStatistics
|
Statistics for the current day. |
url - AWSURL!
|
The generated shortened URL. |
Example
{
"created": AWSDateTime,
"id": 4,
"lastOpened": AWSDateTime,
"opened": 987,
"protected": true,
"qrCode": LinkQrCode,
"redirectTo": AWSURL,
"segments": LinkSegments,
"statistics": LinkStatisticsConnection,
"todayStatistics": LinkStatistics,
"url": AWSURL
}
LinkConnection
Description
Represents the pagination for querying 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
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.
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 |
---|---|
|
|
|
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 |
---|---|
|
|
|
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
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
UpdateLinkSegmentsDevice
Fields
Input Field | Description |
---|---|
OS - UpdateLinkSegmentsDeviceOS
|
Example
{"OS": UpdateLinkSegmentsDeviceOS}
UpdateLinkSegmentsDeviceOS
UpdateLinkSegmentsPlatform
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
}