Get an Access Token List

GET /v1/access_tokens

Get a list of all access tokens owned by the current user.

Request Parameters

Location Parameter Type Required/ Optional Description
query offset number optional The numeric offset of the first record to return. May be a value between 1 and 1000 inclusive.
query cursor number optional The cursor ID of the first record to return. May be a value between 1 and 100 inclusive.
query length number optional The number of records to return. May be a value between 1 and 100 inclusive. If a value is not specified, the default is ten.
query sort string optional Criteria for sorting the returned data.

For a description of how to use these query parameters, see Pagination.

Sort Value Description
date_access Sort by access date, ascending
-date_access Sort by access date, descending
date_create Sort by creation date, ascending
-date_create Sort by creation date, descending
display_name Sort by display name, ascending
-display_name Sort by display name, descending

Multiple sort fields can be specified by concatenating values with commas (,). Combinations that do not make logical sense are not allowed.

Example Request

GET /v1/access_tokens?offset=0&length=20 HTTP/1.1
Host: api.ampermusic.com
Authorization: Basic abcxyz

Response Data

Location Data Item Type Description
body data array
body data[].type string The type of data (access_tokens in this case).
body data[].id string The permanent ID of this access token.
body data[].attributes object
body data[].attributes.access_token_redacted string A short, redacted snippet of the beginning of the secret token.
body data[].attributes.display_name string A human-readable name for this access token, to allow for easier identification.
body data[].attributes.date_create string The date when this access token was created.
body data[].attributes.date_access string The date when this access token was last used to perform any API request.
body data[].links object
body data[].links.self string The token URL.

Note: All dates are formatted as ISO-8601 date and time strings. For example, 2018-08-08T08:08:08+00:00.

Example Response

Header

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
ETag: W/"f95facc8c4ec3bc5d3ada00091996f4573f29c9e"

Body

{
    "data": [
        {
            "type": "access_tokens",
            "id": "abcd1234",
            "attributes": {
                "access_token_redacted": "abcd1234***",
                "display_name": "Token for my very first app",
                "date_create": "2018-10-04T00:00:00.000000+00:00",
                "date_access": null            
            },
            "links": {
                "self": "https://api.ampermusic.com/v1/access_tokens/abcd1234"
            }
        },
        {
            "type": "access_tokens",
            "id": "efgh5678",
            "attributes": {
                "access_token_redacted": "efgh5678***",
                "display_name": "Token for my very second app",
                "date_create": "2018-10-04T00:00:00.000000+00:00",
                "date_access": null            
            },
            "links": {
                "self": "https://api.ampermusic.com/v1/access_tokens/efgh5678"
            }
        },
        { ... }
    ],
    "links": {
        "self": "https://api.ampermusic.com/v1/access_tokens",
        "first": "https://api.ampermusic.com/v1/access_tokens",
        "prev": null,
        "next": "https://api.ampermusic.com/v1/access_tokens?offset=20"
    }
}