Pull Bluejay As Code
curl --request GET \
--url https://api.getbluejay.ai/v1/bluejay-as-code/{root_type}/{root_id} \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://api.getbluejay.ai/v1/bluejay-as-code/{root_type}/{root_id}"
headers = {"X-API-Key": "<x-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<x-api-key>'}};
fetch('https://api.getbluejay.ai/v1/bluejay-as-code/{root_type}/{root_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getbluejay.ai/v1/bluejay-as-code/{root_type}/{root_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.getbluejay.ai/v1/bluejay-as-code/{root_type}/{root_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.getbluejay.ai/v1/bluejay-as-code/{root_type}/{root_id}")
.header("X-API-Key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getbluejay.ai/v1/bluejay-as-code/{root_type}/{root_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"agents": [
{}
],
"simulations": [
{}
],
"digital_humans": [
{}
],
"custom_metrics": [
{}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Bluejay as Code
Pull Bluejay as Code
Export a Bluejay configuration as a JSON payload, rooted at any of four entity types.
GET
/
v1
/
bluejay-as-code
/
{root_type}
/
{root_id}
Pull Bluejay As Code
curl --request GET \
--url https://api.getbluejay.ai/v1/bluejay-as-code/{root_type}/{root_id} \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://api.getbluejay.ai/v1/bluejay-as-code/{root_type}/{root_id}"
headers = {"X-API-Key": "<x-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<x-api-key>'}};
fetch('https://api.getbluejay.ai/v1/bluejay-as-code/{root_type}/{root_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getbluejay.ai/v1/bluejay-as-code/{root_type}/{root_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.getbluejay.ai/v1/bluejay-as-code/{root_type}/{root_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.getbluejay.ai/v1/bluejay-as-code/{root_type}/{root_id}")
.header("X-API-Key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getbluejay.ai/v1/bluejay-as-code/{root_type}/{root_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"agents": [
{}
],
"simulations": [
{}
],
"digital_humans": [
{}
],
"custom_metrics": [
{}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Integration Prompt for AI Agents
# Bluejay — Testing & Monitoring Platform for Conversational AI Agents
You are a senior backend engineer integrating the Bluejay API. Think step-by-step: first understand the endpoint, then plan the integration, then implement with minimal changes.
## Pull Bluejay as Code — GET /v1/bluejay-as-code/{root_type}/{root_id}
> **What this endpoint does:** Export a Bluejay configuration as a JSON payload, rooted at any of four entity types. The simulation root (`/v1/bluejay-as-code/simulation/{id}`) is the most common — it returns the simulation, its agent, all linked Digital Humans, and all associated custom metrics, each with `bluejay_as_code_id` populated. Use this payload as the starting point for version-controlled config management.
**Endpoint:** GET `https://api.getbluejay.ai/v1/bluejay-as-code/{root_type}/{root_id}`
**Auth:** `X-API-Key` header
### Required Parameters
| Name | Type | Description |
|------|------|-------------|
| X-API-Key | string | API key required to authenticate requests. |
| root_type | string (path) | One of `simulation`, `agent`, `digital-human`, `custom-metric`. Determines which entity anchors the bundle. |
| root_id | string (path) | The Bluejay ID (or `bluejay_as_code_id` UUID) of the root entity to export. |
Review the full parameter list at https://docs.getbluejay.ai/api-reference/endpoint/pull-bluejay-as-code.
### Response Shape
```json
{
"agents": [ { "bluejay_as_code_id": "...", ... } ],
"simulations": [ { "bluejay_as_code_id": "...", ... } ],
"digital_humans": [ { "bluejay_as_code_id": "...", ... } ],
"custom_metrics": [ { "bluejay_as_code_id": "...", ... } ]
}
```
### Example
```python
import requests
def pull_bluejay_as_code(simulation_id: str, api_key: str) -> dict:
# Most integrations anchor on a simulation. You can also use root_type
# "agent", "digital-human", or "custom-metric" to anchor on those entities.
url = f"https://api.getbluejay.ai/v1/bluejay-as-code/simulation/{simulation_id}"
headers = {"X-API-Key": api_key}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
```
### Constraints
- Minimal changes — only add/change files needed for this integration.
- Match existing codebase patterns (naming, file structure, error handling).
- Commit the returned `bluejay_as_code_id` values into your config file — do not auto-generate them at runtime.
### Integration Checklist
Before writing code, verify:
1. Which module/service owns this API domain in the codebase?
2. What HTTP client and error-handling patterns does the project use?
3. Are there existing types/interfaces to extend?
Then implement the integration, export it, and confirm it compiles/passes lint.
Path Parameters
Available options:
simulation, agent, digital-human, custom-metric