Via-Alias API (0.1.12)

Download OpenAPI specification:

License: MIT

API for Via-Alias. This API can be used to create and manage redirects as well as users.

Authentication:
Most Endpoints require a Bearer token obtained from POST /api/auth/login. Include it in the Authorization header as Bearer <token>.

Auth

Endpoints that handle user authentication.

Login

Authenticates a user with their credentials and returns a signed JWT access token on success. The token should be included in subsequent requests as a Bearer token in the Authorization header.

Request Body schema: application/json
required
name
required
string
pw
required
string

Responses

Request samples

Content type
application/json
{
  • "name": "luke",
  • "pw": "superjedimeister1337"
}

Response samples

Content type
application/json
{
  • "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoiMjE1ZDU3YzAtMDM1My00Nzc2LWFjNTYtZDBiZWY5YTUxZTJjIiwiaXNfYWRtaW4iOmZhbHNlLCJleHAiOjE3NzI4OTczOTMsImp0aSI6IjRiZTcyNTUwLTZlYTUtNGQ3NS1iM2Q4LTdiNzJiYTEwZjE1MiJ9.qwy7zLn611SkZzI5mFJPwtRGjvjD0xmprSoMUII7xjcxRPjAbTEKH9gFIewYRGdwtcg0I-EhnttYMNZkqlmZNQ",
  • "expires_in": 900,
  • "token_type": "Bearer"
}

Redirects

These endpoints handle redirect management.

Get redirects

Returns a list of all redirects owned by the current user. Requires authentication. Pass a JWT as a bearer token in the Authorization header.

Authorizations:
bearer_auth

Responses

Response samples

Content type
application/json
{}

Create redirect

Creates a new redirect. Requires authentication. Pass a JWT as a bearer token in the Authorization header.

Authorizations:
bearer_auth
Request Body schema: application/json
required
alias
required
string
url
required
string

Responses

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
{}

Delete redirect

Deletes a redirect via its alias. Users can only delete redirects they have created. Requires authentication. Pass a JWT as a bearer token in the Authorization header.

Authorizations:
bearer_auth
path Parameters
alias
required
string

The redirect alias.

Responses

Update redirect

Updates the registered url of a redirect. Changing the alias requires deleting the redirect and recreating it with the desired alias. Requires authentication. Pass a JWT as a bearer token in the Authorization header.

Authorizations:
bearer_auth
path Parameters
alias
required
string

The redirect alias.

Request Body schema: application/json
required
url
required
string

Responses

Request samples

Content type
application/json

Response samples

Content type
application/json
{}

Follow redirect

Returns a tomporary redirect response with the registered redirect url in the location header. Supposed to be opened in a browser.

path Parameters
alias
required
string

The redirect alias.

Responses

Users

These endpoints handle user management.

Get own userdata

Returns userdata about the current user. Requires authentication. Pass a JWT as a bearer token in the Authorization header.

Authorizations:
bearer_auth

Responses

Response samples

Content type
application/json
{
  • "id": "b208ae42-2ab8-47b9-9c69-bdd7300e5847",
  • "name": "vader"
}

Change password

Changes the user-password. Requires authentication. Pass a JWT as a bearer token in the Authorization header.

Authorizations:
bearer_auth
Request Body schema: application/json
required
current_pw
required
string
new_pw
required
string

Responses

Request samples

Content type
application/json
{
  • "current_pw": "superjedimeister1337",
  • "new_pw": "kfdslfoi32j4ekil32jm"
}

Register new user

Registers a new user. Requires a generated user registration token.

Request Body schema: application/json
required
name
required
string
pw
required
string
token
required
string

Responses

Request samples

Content type
application/json
{
  • "name": "vader",
  • "pw": "deathstar_pilot_extra_ordinaire1337",
  • "token": "8162f4c7-e32e-45bc-9089-bfd9d024e39e"
}

Response samples

Content type
application/json
{
  • "id": "b208ae42-2ab8-47b9-9c69-bdd7300e5847",
  • "name": "vader"
}

Admin

Admin management endpoints. All these endpoints require a valid JWT with admin claims.

Get all redirects

Returns a list of all currently created redirects. Requires authentication. Pass a JWT as a bearer token in the Authorization header.

Authorizations:
bearer_auth

Responses

Response samples

Content type
application/json
{
  • "redirects": [
    ]
}

Delete redirect via id

Deletes a redirect via its id. Requires authentication. Pass a JWT as a bearer token in the Authorization header.

Authorizations:
bearer_auth
path Parameters
id
required
string

The redirect id.

Responses

Generate user registration token

Requests a user registration token. This token is only valid for one-time use and has an expiration time in seconds. Requires authentication. Pass a JWT as a bearer token in the Authorization header.

Authorizations:
bearer_auth

Responses

Response samples

Content type
application/json
{
  • "registration_token": "85e83a5a-4f49-4ea7-9df9-93c2c2cc9b8f",
  • "token_ttl": 1800
}

Get all users

Returns a list of all users. Requires authentication. Pass a JWT as a bearer token in the Authorization header.

Authorizations:
bearer_auth

Responses

Response samples

Content type
application/json
{
  • "users": [
    ]
}

Get user data

Returns data about a specific user. Requires authentication. Pass a JWT as a bearer token in the Authorization header.

Authorizations:
bearer_auth
path Parameters
id
required
string

The user id.

Responses

Response samples

Content type
application/json
{
  • "id": "d64bcaad-8d86-48d2-b1f3-f1c03ac30fa3",
  • "is_admin": false,
  • "name": "luke"
}

Delete a user

Deletes a user via its uiserid. This will also delete all of the users registered redirects. Requires authentication. Pass a JWT as a bearer token in the Authorization header.

Authorizations:
bearer_auth
path Parameters
id
required
string

The user id.

Responses

Response samples

Content type
application/json
{
  • "deleted": {
    },
  • "user_id": "d64bcaad-8d86-48d2-b1f3-f1c03ac30fa3"
}

healthcheck

healtcheck

Check if the service is running

Responses

Metrics

Prometheus scrapable metrics

Provides prometheus metrics for http access as counter and a summary for latency.

Responses