JavaScript
import Cerca from '@cerca-dev/sdk';
const client = new Cerca({
apiKey: process.env['CERCA_API_KEY'], // This is the default and can be omitted
});
const authContextResponse = await client.auth.context();
console.log(authContextResponse.keyId);import os
from cerca import Cerca
client = Cerca(
api_key=os.environ.get("CERCA_API_KEY"), # This is the default and can be omitted
)
auth_context_response = client.auth.context()
print(auth_context_response.key_id)package main
import (
"context"
"fmt"
"github.com/matrices/cerca-go"
"github.com/matrices/cerca-go/option"
)
func main() {
client := cercago.NewClient(
option.WithAPIKey("My API Key"),
)
authContextResponse, err := client.Auth.Context(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", authContextResponse.KeyID)
}require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
auth_context_response = cerca.auth.context
puts(auth_context_response)cerca auth context \
--api-key 'My API Key'curl --request GET \
--url https://api.cerca.dev/auth/context \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/auth/context",
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;
}HttpResponse<String> response = Unirest.get("https://api.cerca.dev/auth/context")
.header("Authorization", "Bearer <token>")
.asString();{
"keyId": "<string>",
"orgId": "<string>"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}Auth
Retrieve context
GET
/
auth
/
context
JavaScript
import Cerca from '@cerca-dev/sdk';
const client = new Cerca({
apiKey: process.env['CERCA_API_KEY'], // This is the default and can be omitted
});
const authContextResponse = await client.auth.context();
console.log(authContextResponse.keyId);import os
from cerca import Cerca
client = Cerca(
api_key=os.environ.get("CERCA_API_KEY"), # This is the default and can be omitted
)
auth_context_response = client.auth.context()
print(auth_context_response.key_id)package main
import (
"context"
"fmt"
"github.com/matrices/cerca-go"
"github.com/matrices/cerca-go/option"
)
func main() {
client := cercago.NewClient(
option.WithAPIKey("My API Key"),
)
authContextResponse, err := client.Auth.Context(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", authContextResponse.KeyID)
}require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
auth_context_response = cerca.auth.context
puts(auth_context_response)cerca auth context \
--api-key 'My API Key'curl --request GET \
--url https://api.cerca.dev/auth/context \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/auth/context",
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;
}HttpResponse<String> response = Unirest.get("https://api.cerca.dev/auth/context")
.header("Authorization", "Bearer <token>")
.asString();{
"keyId": "<string>",
"orgId": "<string>"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}⌘I