Create an Access Token for a User

post

/api/v2/users/{id}/tokens/

Make a POST request to this resource with the following access token fields to create a new access token associated with this user.

  • description: Optional description of this access token. (string, default="")

  • application: (id, default=``)

  • scope: Allowed scopes, further restricts user's permissions. Must be a simple space-separated string with allowed scopes ['read', 'write']. (string, default="write")

Request

Supported Media Types
Path Parameters
Body ()
Root Schema : schema
Example:
{
    "scope":"read"
}
Back to Top

Response

Supported Media Types

201 Response

Body
Example Response (application/json)
{
    "application":null,
    "created":"2018-02-01T08:00:00.000000Z",
    "description":"",
    "expires":"2018-02-01T08:00:00.000000Z",
    "id":"2",
    "modified":"2018-02-01T08:00:00.000000Z",
    "refresh_token":null,
    "related":{
        "activity_stream":"/api/v2/tokens/2/activity_stream/",
        "user":"/api/v2/users/2/"
    },
    "scope":"read",
    "summary_fields":{
        "user":{
            "first_name":"",
            "id":"2",
            "last_name":"",
            "username":"alice"
        }
    },
    "token":"FpF1NgKXIOg96dze9U18abH6gf1xgi",
    "type":"o_auth2_access_token",
    "url":"/api/v2/tokens/2/",
    "user":"2"
}
Back to Top