Skip to main content
GET
/
preview
/
v2
/
me
Get the authenticated account and logged-in user
curl --request GET \
  --url https://api.sfcompute.com/preview/v2/me \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.sfcompute.com/preview/v2/me"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.sfcompute.com/preview/v2/me', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sfcompute.com/preview/v2/me",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.sfcompute.com/preview/v2/me"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.sfcompute.com/preview/v2/me")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.sfcompute.com/preview/v2/me")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "object": "account",
  "account_id": "acme-corp",
  "created_at": 1738972800,
  "user": {
    "object": "user",
    "id": "<string>",
    "resource_path": "<string>",
    "created_at": 1738972800,
    "email": "<string>",
    "first_name": "<string>",
    "last_name": "<string>"
  }
}
{
"error": {
"type": "authentication_error",
"message": "<string>"
}
}
{
"error": {
"type": "not_found",
"message": "<string>"
}
}
{
"error": {
"type": "api_error",
"message": "<string>"
}
}

Authorizations

Authorization
string
header
required

Create an API token using sf tokens create or at https://sfcompute.com/account/api-keys.

Response

Account and logged-in user information.

Response body for GET /v2/me: the authenticated account plus, when the caller is a human user, details about the logged-in user that issued the calling token.

object
string
default:account
required
read-only
Allowed value: "account"
account_id
string
required

The account identifier.

Example:

"acme-corp"

created_at
integer<int64>
required

When the account was created, as a Unix epoch timestamp in seconds.

Example:

1738972800

entity_type
null | enum<string>

Whether the account is for personal use or a business, or null if it hasn't been set yet.

Available options:
personal,
business
user
null | object

The logged-in user that issued the calling token. null when authenticated with a service token, which acts on behalf of the account rather than an individual user.