Introduction

The KPN Short URL API helps you to create short, unique URLs that will redirect to the specific website of your choosing.


API specification

Test the API on SwaggerHub


Base URL

https://api-prd.kpn.com//security/kpn/short-url


Conceptual Model

Conceptual model


API workflow

API workflow


Prerequisites

Make sure you've read Getting Started for more info on how to register your application and start trying out our APIs.

Authentication

Go to the Authentication tab for more information on how to obtain an access token.


Features and constraints

Features

Shortened URLs

All shortened URLs will have the domain "ga.kpn". Example: https://ga.kpn/He5ABk.


Constraints

URL length

The URL that you want to be shortened must contain less than 300 characters.

Sandbox limitation

The sandbox version of this API will overwrite the submitted url with https://developer.kpn.com, so every short URL generated and returned by the API, will link to the KPN API Store (https://developer.kpn.com).


How to...

Shorten an URL

This endpoint allows you to shorten an URL.

The request body uses the following parameters:

Parameter Type Description
url string The URL you want to shorten. This field is mandatory. Example: https://verylongandcomplicatedurl.com
slug string This is the postfix of the short URL. The default is random. Example: SnfUW6
expiry_date string Date time in ISO 8601 format. The default is 14 days from the time of request. Example: 020-03-05T14:58:39.961284+01:00


^^Example request body^^
{
  "url": "https://verylongandcomplicatedurl.com",
  "slug": "SnfUW6",
  "expiry_date": "2020-03-05T14:58:39.961284+01:00"
}
^^Example response^^
{
  "slug": "SnfUW6",
  "url": "https://verylongandcomplicatedurl.com",
  "short_url": "https://ga.kpn/SnfUW6",
  "expiry_date": "2020-03-05T14:58:39.961284+01:00"
}


Return codes

Code Description
200 Success.
201 Created.
202 Accepted.
302 Found. Link in location header.
400 Bad request.
401 Unauthorized.
403 Forbidden.
404 Not found.
405 Method not allowed.
412 Precondition failed.
429 Too many requests.
500 Internal server error.
502 Bad gateway.
503 Service unavailable.

Mopinion feedback