Token

Endpoints:

Get or delete the current user's authenticated token.

GET /token

Token: user

Scope: any

Retrieve an object with the currently authenticated token, username, and user ID.

Includes data.email if email scope is authorized. Includes markdown_text in user object.

Example
curl "https://api.pnut.io/v1/token" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "X-Pretty-Json: 1"

Returns the requested token

{
    "meta": {
        "code": 200
    },
    "data": {
        "app": {
            "id": "String",
            "url": "https://example.com",
            "name": "String"
        },
        "scopes": [
            "String",
            "String",
            "String"
        ],
        "user": {"...User Object..."},
        "storage": {
            "available": 0,
            "total": 0
        }
    }
}

DELETE /token

Token: user

Scope: any

Delete the currently authenticated token.

Note that this only deletes the currently authenticated token, and the user will still not be required to reauthorize scopes in the future that have been authorized. For the user to revoke all access tokens for the client, they must do so manually from their account on pnut.io, or all of their tokens for the client must be deleted to reset scopes.

Example
curl "https://api.pnut.io/v1/token" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "X-Pretty-Json: 1" \
    -X DELETE

Returns the deleted token

{
    "meta": {
        "code": 200
    },
    "data": {
        "app": {
            "id": "String",
            "url": "https://example.com",
            "name": "String"
        },
        "scopes": [
            "String",
            "String",
            "String"
        ],
        "user": {"...User Object...."},
        "storage": {
            "available": 0,
            "total": 0
        }
    }
}