API Keys
Show API Key
Retrieve a specific API key by its ID for the authenticated user.
Show API Key
Authentication Required
This endpoint requires authentication via Sanctum token.
HTTP Method & URL
GET
https://dev.mytpe.app/api/api-keys/{id}Retrieve a specific API key by its ID for the authenticated user.
Authentication
Authentication: Bearer Token (Authorization header)
You must include a valid Bearer token in the Authorization header.
Authorization: Bearer {your_token}Request Parameters
Path Parameters
Prop
Type
Query Parameters
No query parameters required.
Request Body
No request body required.
Example Request
const apiKeyId = 1;
const response = await fetch(`https://dev.mytpe.app/api/api-keys/${apiKeyId}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer {your_token}',
'Accept': 'application/json'
}
});
const data = await response.json();
console.log(data);interface ApiKeyResponse {
success: boolean;
message: string;
data: {
id: number;
user_id: number;
key: string;
permissions: string[];
expires_at: string | null;
created_at: string;
updated_at: string;
};
}
const apiKeyId: number = 1;
const response = await fetch(`https://dev.mytpe.app/api/api-keys/${apiKeyId}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer {your_token}',
'Accept': 'application/json'
}
});
const data: ApiKeyResponse = await response.json();
console.log(data);import requests
api_key_id = 1
response = requests.get(
f'https://dev.mytpe.app/api/api-keys/{api_key_id}',
headers={
'Authorization': 'Bearer {your_token}',
'Accept': 'application/json'
}
)
data = response.json()
print(data)use Illuminate\Support\Facades\Http;
$apiKeyId = 1;
$response = Http::withHeaders([
'Accept' => 'application/json',
])->withToken('{your_token}')
->get("https://dev.mytpe.app/api/api-keys/{$apiKeyId}");
$data = $response->json();<?php
$apiKeyId = 1;
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://dev.mytpe.app/api/api-keys/' . $apiKeyId,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer {your_token}',
'Accept: application/json',
],
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
print_r($data);const axios = require('axios');
const apiKeyId = 1;
axios.get(`https://dev.mytpe.app/api/api-keys/${apiKeyId}`, {
headers: {
'Authorization': 'Bearer {your_token}',
'Accept': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error.response.data);
});Example Success Response
200 OK
{
"success": true,
"message": "API key fetched successfully",
"data": {
"id": 1,
"user_id": 123,
"key": "MTP_KEY_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"permissions": [],
"expires_at": "2026-12-17T00:00:00.000000Z",
"created_at": "2025-12-17T00:00:00.000000Z",
"updated_at": "2025-12-17T00:00:00.000000Z"
}
}Response Fields
Prop
Type
Error Responses
401 Unauthorized
{
"success": false,
"message": "Unauthenticated."
}404 Not Found
{
"success": false,
"message": "API key not found",
"code": 404
}Important
Users can only retrieve API keys that belong to their own account. Attempting to access another user's API key will result in a 404 error.