Skip to main content

Projects API

A project groups together related pages, dashboards, and team members. The Projects API lets you create, list, and delete projects programmatically.

You'll need an Admin API key for these endpoints, rather than a project-level API key.

Create a project

const { DebugBear } = require("debugbear");
const debugbear = new DebugBear(process.env.DEBUGBEAR_API_KEY);

const project = await debugbear.projects.create({ name: "My project" });
console.log(project);

Using cURL

curl https://www.debugbear.com/api/v1/projects \
-X POST \
-H "x-api-key: API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Project Name"}'

The response:

{ "id": "123456", "name": "Project Name", "pages": [] }

List projects

const projects = await debugbear.projects.list();

Each project in the response includes its pages, devices, and schedules.

[
{
"id": "123456789",
"name": "My project",
"pages": [
{
"id": "999999",
"name": "Example",
"url": "http://example.com/",
"region": "germany",
"testSchedules": [
{
"id": "22222",
"name": "Every 12 hours",
"days": [0, 1, 2, 3, 4, 5, 6],
"times": []
}
],
"device": {
"id": "25321",
"name": "Mobile",
"rtt": 150,
"bandwidthKbps": 1638,
"formFactor": "mobile",
"cpuThrottling": 4
}
}
]
}
]

Using cURL

curl https://www.debugbear.com/api/v1/projects \
-H "x-api-key: API_KEY"

Get a project

const project = await debugbear.projects.get(projectId);

The response shape matches one entry in the list response above.

Using cURL

curl https://www.debugbear.com/api/v1/projects/PROJECT_ID \
-H "x-api-key: API_KEY"

Delete a project

await debugbear.projects.delete(projectId);

Using cURL

curl https://www.debugbear.com/api/v1/projects/PROJECT_ID \
-X DELETE \
-H "x-api-key: API_KEY"