Select programming language for code examples

linkProfiles

linkWho Am I?

Retrieves the details of the currently authenticated bearer i.e. the resource who the current API token belongs to. Utilize this to determine who the current user is, what token they used, to retrieve information on who made the API request.

linkAuthentication

  • linkBearer

    required

    An authentication token.

linkURL Parameters

  • link<account>

    stringrequired

    The identifier (UUID) or slug of your Keygen account.

linkReturns

A 200 OK response will be returned along with the token bearer, as well as the current token used for the request within the included data.

Upon error, an errors object will be returned along with an HTTP status code indicating the type of error. When an error occurs, the data property will not be included.

Definition

https://api.keygen.sh/v1/accounts/<account>/me

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/<account>/me", {
method: "GET",
headers: {
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
}
})
 
const { data, errors } = await response.json()
import requests
import json
 
res = requests.get(
"https://api.keygen.sh/v1/accounts/<account>/me",
headers={
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
}
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/<account>/me",
headers: [
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
]
).responseJSON { response in
let json = JSON(data: response.data!)
}
using RestSharp;
 
var client = new RestClient("https://api.keygen.sh/v1/accounts/<account>");
var request = new RestRequest("me", Method.GET);
 
request.AddHeader("Accept", "application/vnd.api+json");
request.AddHeader("Authorization", "Bearer <token>");
 
var response = client.Execute(request);
import com.mashape.unirest.http.exceptions.*
import com.mashape.unirest.http.*
 
val res = Unirest.get("https://api.keygen.sh/v1/accounts/<account>/me")
.header("Authorization", "Bearer <token>")
.header("Accept", "application/vnd.api+json")
.asJson()
import com.mashape.unirest.http.exceptions.*;
import com.mashape.unirest.http.*;
 
HttpResponse<JsonNode> res = Unirest.get("https://api.keygen.sh/v1/accounts/<account>/me")
.header("Authorization", "Bearer <token>")
.header("Accept", "application/vnd.api+json")
.asJson();
#include <iostream>
#include <string>
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
 
using namespace std;
using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace utility;
 
http_client client("https://api.keygen.sh/v1/accounts/<account>");
http_request req;
 
req.headers().add("Authorization", "Bearer <token>");
req.headers().add("Accept", "application/json");
 
req.set_request_uri("/me");
req.set_method(methods::GET);
 
client.request(req)
.then([](http_response res) {
auto data = res.extract_json().get();
})
.wait();
curl https://api.keygen.sh/v1/accounts/<account>/me \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer <token>'

Example response / 200 OK

{
"data": {
"id": "31b757c9-50de-4afa-80df-32f3a693976e",
"type": "users",
"attributes": {
"fullName": "John Doe",
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"status": "ACTIVE",
"role": "user",
"metadata": {},
"created": "2017-01-02T20:26:53.464Z",
"updated": "2017-01-02T20:26:53.464Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"products": {
"links": {
"related": "/v1/accounts/<account>/users/31b757c9-50de-4afa-80df-32f3a693976e/products"
}
},
"licenses": {
"links": {
"related": "/v1/accounts/<account>/users/31b757c9-50de-4afa-80df-32f3a693976e/licenses"
}
},
"machines": {
"links": {
"related": "/v1/accounts/<account>/users/31b757c9-50de-4afa-80df-32f3a693976e/machines"
}
},
"tokens": {
"links": {
"related": "/v1/accounts/<account>/users/31b757c9-50de-4afa-80df-32f3a693976e/tokens"
}
}
},
"links": {
"self": "/v1/accounts/<account>/users/31b757c9-50de-4afa-80df-32f3a693976e"
}
},
"included": [
{
"id": "8ec30d6a-f201-4f5c-9b78-5fd942b8cb95",
"type": "tokens",
"attributes": {
"kind": "user-token",
"expiry": "2022-03-15T19:27:50.440Z",
"created": "2017-01-02T20:26:53.464Z",
"updated": "2017-01-02T20:26:53.464Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"bearer": {
"links": {
"related": "/v1/accounts/<account>/users/31b757c9-50de-4afa-80df-32f3a693976e"
},
"data": {
"type": "users",
"id": "31b757c9-50de-4afa-80df-32f3a693976e"
}
}
},
"links": {
"self": "/v1/accounts/<account>/tokens/8ec30d6a-f201-4f5c-9b78-5fd942b8cb95"
}
}
]
}