Get API Keys
Users can access a list of their all existing API keys by sending a request to this endpoint. This feature allows them to manage and monitor the API keys associated with their account.
Endpoint: https://api.amlwatcher.com/api/api-keys
Method: GET
- HTTP
- Javascript
- PHP
- Python
- Ruby
- Java
- cURL
- C#
- Go
Sample Request
GET /api/api-keys HTTP/1.1
Host: api.amlwatcher.com
Authorization: Bearer Token
Sample Request
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer Token");
var requestOptions = {
method: "GET",
headers: myHeaders,
redirect: "follow",
};
fetch("https://api.amlwatcher.com/api/api-keys", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
Sample Request
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.amlwatcher.com/api/api-keys',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer Token'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Sample Request
import requests
url = "https://api.amlwatcher.com/api/api-keys"
payload = {}
headers = {
'Authorization': 'Bearer Token'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
Sample Request
require "uri"
require "net/http"
url = URI("https://api.amlwatcher.com/api/api-keys")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer Token"
response = https.request(request)
puts response.read_body
Sample Request
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) {
HttpURLConnection connection = null;
BufferedReader in = null;
try {
// Define the URL
URL url = new URL("https://api.amlwatcher.com/api/api-keys");
// Open a connection to the URL
connection = (HttpURLConnection) url.openConnection();
// Set the request method to GET
connection.setRequestMethod("GET");
// Set the request headers
connection.setRequestProperty("Authorization", "Bearer Token");
connection.setRequestProperty("Accept", "application/json");
// Get the response code
int responseCode = connection.getResponseCode();
System.out.println("Response Code: " + responseCode);
// Read the response
in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
StringBuilder response = new StringBuilder();
String inputLine;
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
// Print the response
System.out.println("Response Body: " + response.toString());
} catch (IOException e) {
e.printStackTrace();
// Print the error response if available
if (connection != null) {
try (BufferedReader errorReader = new BufferedReader(new InputStreamReader(connection.getErrorStream()))) {
StringBuilder errorResponse = new StringBuilder();
String errorLine;
while ((errorLine = errorReader.readLine()) != null) {
errorResponse.append(errorLine);
}
System.out.println("Error Response: " + errorResponse.toString());
} catch (IOException ignored) {
}
}
} finally {
// Close resources
try {
if (in != null) in.close();
} catch (IOException ignored) {
}
}
}
}
Sample Request
curl --location --request GET 'https://api.amlwatcher.com/api/api-keys'
--header 'Authorization: Bearer Token'
Sample Request
using System;
using System.Threading.Tasks;
using RestSharp;
public class Program
{
public static async Task Main(string[] args)
{
var options = new RestClientOptions("https://api.amlwatcher.com")
{
Timeout = TimeSpan.FromSeconds(30)
};
var client = new RestClient(options);
var request = new RestRequest("/api/api-keys", Method.Get);
request.AddHeader("Authorization", "Bearer Token");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
if (response.IsSuccessful)
{
Console.WriteLine("Request successful");
}
else
{
Console.WriteLine($"Error: {response.StatusCode} - {response.StatusDescription}");
Console.WriteLine(response.Content);
}
}
}
Sample Request
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.amlwatcher.com/api/api-keys"
method := "GET"
client := &http.Client{}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Set("Authorization", "Bearer token")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Response
Parameters | Description |
---|---|
error | Whenever there is an error in your request, this param will have details of that error; otherwise it’ll remain empty. |
status | The status field is set to either “SUCCESS” or “FAIL”, indicating that the API request resulted in a successful or failure/error condition respectively. |
data | An array containing the actual response elements. |
Sample Response
{
"data": {
"api_keys": [
{
"created_at": "Wed, 04 Oct 2023 09:31:44 GMT",
"expires_at": "Fri, 10 Sep 2123 09:31:44 GMT",
"key": "sr-4d634862658df53e618b486924d634862658df53e618b48692"
},
{
"created_at": "Wed, 04 Oct 2023 09:31:58 GMT",
"expires_at": "Thu, 05 Oct 2023 09:31:58 GMT",
"key": "sr-4d634862658df53e618b486924d634862658df53e618b48692"
},
{
"created_at": "Mon, 09 Oct 2023 15:05:53 GMT",
"expires_at": "Wed, 11 Oct 2023 15:05:53 GMT",
"key": "sr-4d634862658df53e618b486924d634862658df53e618b48692"
}
]
},
"error": false,
"status": "SUCCESS"
}