Skip to main content
1

Install SDK and add API key

npm i priceos
Create an API key and add to your .env file.
.env
PRICEOS_API_KEY=pos_ab234cdef...
2

Generate types

npx priceos generate-types
This command creates a local priceos.types file with the MyFeatures type that you can import and use in your hooks or SDK.Run with --help to see more options.
3

Use generated types

import { useFeatureAccess } from "priceos/react";
import type { MyFeatures } from "./priceos.types";

const { hasAccess } = useFeatureAccess<MyFeatures>("priority_support");
Regenerate types whenever you add, remove, or rename a feature.

CLI options

--api-key <key>
string
PriceOS API key. If omitted, the CLI checks PRICEOS_API_KEY in .env.local, then .env, then process env.
--out <path>
string
Write the generated types file to a specific file path.
--out-dir <path>
string
Write the generated file into a specific directory (ignored when --out is provided).
-h, --help
flag
Show the CLI help output with all available options.
# Explicit API key and output file
npx priceos generate-types --api-key pos_ab234cdef... --out ./src/priceos.types.d.ts

# Output to a directory
npx priceos generate-types --out-dir ./src/types