Create an Access Token

post

/api/v2/tokens/

Make a POST request to this resource with the following access token fields to create a new access token:

  • 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
Body ()
Root Schema : schema
Example:
{
    "application":"1",
    "scope":"read"
}
Back to Top

Response

Supported Media Types

201 Response

Body
Example Response (application/json)
{
    "application":"1",
    "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":"GKsBi0R8bbZudSDMwMc0F8MGfysdTL",
    "related":{
        "activity_stream":"/api/v2/tokens/2/activity_stream/",
        "application":"/api/v2/applications/1/",
        "user":"/api/v2/users/1/"
    },
    "scope":"read",
    "summary_fields":{
        "application":{
            "id":"1",
            "name":"test app"
        },
        "user":{
            "first_name":"",
            "id":"1",
            "last_name":"",
            "username":"admin"
        }
    },
    "token":"9YLQPoG50MeyktoWlZvTdn9XUTnDK8",
    "type":"o_auth2_access_token",
    "url":"/api/v2/tokens/2/",
    "user":"1"
}
Back to Top