Back to Content Management API
contentEnvironmentByHandle
Returns one of your store's content environments by its handle, the value you pass to @pack/client or createPackClient. An unknown handle returns an error.
Arguments
- Name
handle- Type
- String!
- Description
The handle 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 ContentEnvironmentByHandle($handle: String!) {
contentEnvironmentByHandle(handle: $handle) {
id
name
handle
createdAt
}
}
`;
const variables = {
handle: 'staging'
};
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);
Response
{
"data": {
"contentEnvironmentByHandle": {
"id": "YOUR-ENVIRONMENT-ID",
"name": "Staging",
"handle": "staging",
"createdAt": "2026-03-02T15:00:00.000Z"
}
}
}