Retrieve the API key's environment
Which environment, project and organization the API key belongs to, and the key itself. Any valid key can read its own environment (no permission needed): use it to check a key, show where it sends and what it may do.
bearerAuthAuthorizationBearer <token>A secret API key from the dashboard: coss_live_… for production environments, coss_test_… for sandbox environments.
Coss-Version?"2026-10-10"The API version (a date) to use for this request. Defaults to your organization's version, pinned to the latest one when it first used the API and upgraded from the dashboard. The SDK always sends the version it was built for.
"2026-10-10"The API key's environment.
application/json- response
- response
- …
The environment an API key belongs to, with its project and organization.
object*"environment""environment"id*stringThe environment's id.
name*stringThe environment's name.
slug*stringThe environment's slug, as in dashboard URLs.
mode*stringlive delivers email; sandbox (coss_test_ keys) never does.
"live""sandbox"project*The project it belongs to.
organization*The organization it belongs to.
api_key*The API key making this request.
import { Coss } from "coss";const coss = new Coss({ apiKey: process.env.COSS_API_KEY, baseUrl: "https://api.coss.com",});const { data, error } = await coss.environment.get();{ "object": "environment", "id": "env_01k7c8m4q2f3e9v6t5r1n0p8yz", "name": "Development", "slug": "development", "mode": "sandbox", "project": { "id": "proj_01k7c8m4q2f3e9v6t5r1n0p8yz", "name": "Default", "slug": "default" }, "organization": { "id": "org_01k7c8m4q2f3e9v6t5r1n0p8yz", "name": "Acme", "slug": "acme", "api_version": "2026-10-10" }, "api_key": { "id": "key_01k7c8m4q2f3e9v6t5r1n0p8yz", "name": "Backend", "start": "coss_test_Ab", "access": "restricted", "permissions": [ "email:send", "email:read" ] }}