JavaScript
import { TrophyApiClient } from '@trophyso/node';
const trophy = new TrophyApiClient({
apiKey: 'YOUR_API_KEY'
});
const response = await trophy.admin.applicationApiKeys.create([
{ userId: 'user_123' }
]);from trophy import TrophyApi
client = TrophyApi(api_key='YOUR_API_KEY')
response = client.admin.applicationApiKeys.create([
{ "userId": "user_123" }
])import (
"context"
api "github.com/trophyso/trophy-go"
trophyclient "github.com/trophyso/trophy-go/client"
"github.com/trophyso/trophy-go/option"
)
client := trophyclient.NewClient(
option.WithApiKey("YOUR_API_KEY"),
)
response, err := client.Admin.ApplicationApiKeys.Create(context.TODO(), api.CreateApplicationKeysRequest{})curl --request POST \
--url https://admin.trophy.so/v1/application-api-keys \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
[
{
"userId": "user_123"
},
{
"userId": "user_456"
}
]
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://admin.trophy.so/v1/application-api-keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
[
'userId' => 'user_123'
],
[
'userId' => 'user_456'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://admin.trophy.so/v1/application-api-keys")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"userId\": \"user_123\"\n },\n {\n \"userId\": \"user_456\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://admin.trophy.so/v1/application-api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"userId\": \"user_123\"\n },\n {\n \"userId\": \"user_456\"\n }\n]"
response = http.request(request)
puts response.read_body{
"created": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"userId": "user_123",
"key": "app_XXXXX.YOUR_API_KEY",
"prefix": "app_XXXXX"
}
],
"issues": [
{
"severity": "warning",
"message": "Would exceed maximum freeze limit",
"id": "550e8400-e29b-41d4-a716-446655440000",
"userId": "user-123",
"boostId": "550e8400-e29b-41d4-a716-446655440000",
"index": 0
}
]
}{
"created": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"userId": "user_123",
"key": "app_XXXXX.YOUR_API_KEY",
"prefix": "app_XXXXX"
}
],
"issues": []
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Admin
Create application API keys for users
Create application API keys scoped to specific users. Each key can only perform operations on behalf of the user it was created for.
POST
/
application-api-keys
JavaScript
import { TrophyApiClient } from '@trophyso/node';
const trophy = new TrophyApiClient({
apiKey: 'YOUR_API_KEY'
});
const response = await trophy.admin.applicationApiKeys.create([
{ userId: 'user_123' }
]);from trophy import TrophyApi
client = TrophyApi(api_key='YOUR_API_KEY')
response = client.admin.applicationApiKeys.create([
{ "userId": "user_123" }
])import (
"context"
api "github.com/trophyso/trophy-go"
trophyclient "github.com/trophyso/trophy-go/client"
"github.com/trophyso/trophy-go/option"
)
client := trophyclient.NewClient(
option.WithApiKey("YOUR_API_KEY"),
)
response, err := client.Admin.ApplicationApiKeys.Create(context.TODO(), api.CreateApplicationKeysRequest{})curl --request POST \
--url https://admin.trophy.so/v1/application-api-keys \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
[
{
"userId": "user_123"
},
{
"userId": "user_456"
}
]
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://admin.trophy.so/v1/application-api-keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
[
'userId' => 'user_123'
],
[
'userId' => 'user_456'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://admin.trophy.so/v1/application-api-keys")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"userId\": \"user_123\"\n },\n {\n \"userId\": \"user_456\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://admin.trophy.so/v1/application-api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"userId\": \"user_123\"\n },\n {\n \"userId\": \"user_456\"\n }\n]"
response = http.request(request)
puts response.read_body{
"created": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"userId": "user_123",
"key": "app_XXXXX.YOUR_API_KEY",
"prefix": "app_XXXXX"
}
],
"issues": [
{
"severity": "warning",
"message": "Would exceed maximum freeze limit",
"id": "550e8400-e29b-41d4-a716-446655440000",
"userId": "user-123",
"boostId": "550e8400-e29b-41d4-a716-446655440000",
"index": 0
}
]
}{
"created": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"userId": "user_123",
"key": "app_XXXXX.YOUR_API_KEY",
"prefix": "app_XXXXX"
}
],
"issues": []
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Body
application/json
Array of users to create application API keys for. Maximum 100 users per request.
Required array length:
1 - 100 elementsThe user ID to scope the application API key to.
Maximum string length:
255Example:
"user_123"
Response
Successful operation (no keys created)
Was this page helpful?
⌘I