Return to enstrayed.com

# API Documentation

This page was last updated 2025-07-08.

Source Code & Issue Tracker: github.com/enstrayed/enstrayedapi

## /api/nowplaying

nowplaying.js
GET

Returns whatever I'm listening to via the Last.fm API in JSON. If `?format=html` is used in the URL it will return the same but in HTML. If nothing is playing the JSON response will just have `"playing": false`.

## /api/nowplayingbeta

nowplaying.js
GET

Beta verison of the /nowplaying endpoint. This version will change frequently but presently queries my Jellyfin for what I'm listening to and will return that as JSON. If `?format=html` is appended to the URL it will return the same but in HTML. Each line in the HTML response has a class `nowPlayingLine[1-4]` that can be used to style the text using CSS. See libnowplaying.js:63 for the format of the result.

## /api/etyd/*

etyd.js
GET POST DELETE

Retrieves, creates or deletes entries for the etyd.cc URL shortener. Replace * in the URL for the target of the request.

Required Headers (POST, DELETE):

- `Authorization`: A token with the `etyd` scope

Required Body (POST):

    {
            "url": "urlValue"
    }

## /api/sendemail

mailjet.js
POST

Sends an email to the specified recipient, intended for application & automation use.

Required Headers:

- `Authorization`: A token with the `mailjet` scope

Required Body:

    {
            "recipient": "recipientEmailHere",
            "subject": "emailSubjectHere",
            "message": "emailBodyHere"
    }

## /api/ip

ip.js
GET

Returns the IP, country and Cloudflare ray of the request in JSON.

## /api/headers

ip.js
GET

Returns all request headers in JSON.

## /api/auth/whoami

auth.js:6
GET

Returns JSON with the username of the token owner as well as what scopes the token has access to.

## /api/auth/login

auth.js:23
GET

Redirects the user to ECLS to login. The `state` parameter can be used to specify how the login flow will behave. The accepted "states" are:

- `redirect` - Redirects the user to a page after logging in. This paramter requires the `destination` paramter to also be set with the URL the user will be redirected to.
- `display` - Displays the generated token to the user after login. Currently, this still writes the new token to the `APIToken` cookie, though this is planned to change.
- `close` - This will close the page after logging in. This requires the page to be opened with JavaScript otherwise it will not automatically close.

## /api/auth/logout

auth.js:40
GET

Invalidates the token used to access the endpoint.

## /api/auth/callback

auth.js:57
GET

Internal Use Only. This is the endpoint used by ECLS to finish the login flow. It will write the newly created token to the `APIToken` cookie as well as performing the action set by `state`, see login endpoint.

## /api/helpdesk/forms/*

helpdesk.js:15
GET

Internal Use Only. Serves all files in the `website/helpdesk/forms` directory for use in the Helpdesk frontend.