> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.morphiaone.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.morphiaone.ai/_mcp/server.

# Read the calling API key

GET https://api.morphiaone.ai/v1/api-key

The API key that made the request: its id, its environment (`test` or `live`)
and the scopes it holds. Never its secret or prefix. Needs no scope, so any valid
key may read itself; use it to offer only the actions the key allows. The scopes
are still enforced on every call.

Reference: https://docs.morphiaone.ai/api-reference/endpoints/api-key/get

## Authentication

- `X-API-Key` header (required) — API key for one environment of your account. Keep server-side; never expose in browser clients.

## Response

### 200

Successful Response

- `environment` (enum, required) — `test` for a `pk_test_` key: fixture results, nothing charged.
  - Allowed values: `test`, `live`
- `id` (string, required, nullable) — The key's id, as the Platform's API keys page lists it. Null for a key configured outside the Platform.
- `scopes` (list of string, required) — The scopes the key holds, sorted.
- `object` ("api_key", optional, default: api_key) — Always `api_key`.

## Errors

### 401 Unauthorized Error

Missing or invalid API key

- `error` (ErrorDetail, required)

### 403 Forbidden Error

API key is not allowed from this network

- `error` (ErrorDetail, required)

## Types

### ErrorDetail

- `code` (string, required)
- `message` (string, required)
- `request_id` (string, required)
- `details` (ErrorDetailDetails, optional)
- `doc_url` (string, optional, nullable)
- `retryable` (boolean, optional, nullable)

### ErrorDetailDetails

- map from string to any
- list of map from string to any

## Examples

**Response**

```json
{
  "environment": "test",
  "id": "6f1c2a9e-4b7d-4e0a-9c3b-2d8e5f7a1b04",
  "scopes": [
    "catalogue.read",
    "digitisation.read"
  ],
  "object": "api_key"
}
```

**SDK Code**

```python API key_get_example
import requests

url = "https://api.morphiaone.ai/v1/api-key"

headers = {"X-API-Key": "<apiKey>"}

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

print(response.json())
```

```javascript API key_get_example
const url = 'https://api.morphiaone.ai/v1/api-key';
const options = {method: 'GET', headers: {'X-API-Key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go API key_get_example
package main

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

func main() {

	url := "https://api.morphiaone.ai/v1/api-key"

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

	req.Header.Add("X-API-Key", "<apiKey>")

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

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

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby API key_get_example
require 'uri'
require 'net/http'

url = URI("https://api.morphiaone.ai/v1/api-key")

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

request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java API key_get_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.morphiaone.ai/v1/api-key")
  .header("X-API-Key", "<apiKey>")
  .asString();
```

```php API key_get_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.morphiaone.ai/v1/api-key', [
  'headers' => [
    'X-API-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp API key_get_example
using RestSharp;

var client = new RestClient("https://api.morphiaone.ai/v1/api-key");
var request = new RestRequest(Method.GET);
request.AddHeader("X-API-Key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift API key_get_example
import Foundation

let headers = ["X-API-Key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.morphiaone.ai/v1/api-key")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```