Back to Content Management API
contentEnvironment
Returns one of your store's content environments by ID. To pass an environment to @pack/client or createPackClient, use its handle. See Content Environments.
Arguments
- Name
id- Type
- ID!
- Description
The ID of the content environment.
Returns
- Name
ContentEnvironment.*- Type
- ContentEnvironment!
- Description
Any requested field from the Content Environment object.
Request
import { PackClient } from '@pack/client'
const packClient = new PackClient({
token: 'YOUR-PACK-TOKEN'
});
const query = `
query ContentEnvironment($id: ID!) {
contentEnvironment(id: $id) {
id
name
handle
createdAt
}
}
`;
const variables = {
id: 'YOUR-ENVIRONMENT-ID'
};
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);
Response
{
"data": {
"contentEnvironment": {
"id": "YOUR-ENVIRONMENT-ID",
"name": "Staging",
"handle": "staging",
"createdAt": "2026-03-02T15:00:00.000Z"
}
}
}