{t(
'connect_your_mcp_client_to_postiz_to_schedule_your_posts_faster',
'Connect Postiz MCP server to your client (Http streaming) to schedule your posts faster.'
)}
);
};
const localCliSteps = [
{
label: 'Install the CLI',
code: 'npm install -g postiz',
},
{
label: 'Run: postiz auth:login',
code: 'postiz auth:login',
},
{
label: 'Install the Postiz skill for your AI agent',
code: 'npx skills add gitroomhq/postiz-agent',
},
] as const;
const ciCliSteps = [
{
label: 'Install the CLI',
code: 'npm install -g postiz',
},
{
label: 'Set your API key as an environment variable',
code: 'export POSTIZ_API_KEY="{API_KEY}"',
},
{
label: 'Install the Postiz skill for your AI agent',
code: 'npx skills add gitroomhq/postiz-agent',
},
] as const;
const CliSection = ({ apiKey }: { apiKey: string }) => {
const t = useT();
const [mode, setMode] = useState<'local' | 'ci'>('local');
const [revealed, setRevealed] = useState(false);
const steps =
mode === 'local'
? localCliSteps.map((step) => ({ ...step }))
: ciCliSteps.map((step) => ({
...step,
code: step.code.replace('{API_KEY}', apiKey),
}));
const displaySteps =
mode === 'ci' && !revealed
? steps.map((step) => ({
...step,
code: step.code.replace(
new RegExp(apiKey.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'),
'*'.repeat(apiKey.length)
),
}))
: steps;
return (
{t('cli_and_skills', 'CLI & AI Skills')}
{t(
'cli_description',
'Use the Postiz CLI to automate posting from your terminal, or install the skill to let your AI agent schedule posts for you.'
)}
);
};
const PublicApiContent = () => {
const user = useUser();
const { backendUrl, frontEndUrl, mcpUrl } = useVariables();
const toaster = useToaster();
const fetch = useFetch();
const decision = useDecisionModal();
const { mutate } = useSWRConfig();
const [reveal, setReveal] = useState(false);
const t = useT();
const rotateKey = useCallback(async () => {
const approved = await decision.open({
title: t('rotate_api_key', 'Rotate API Key?'),
description: t(
'rotate_api_key_description',
'This will generate a new API key and invalidate the current one. Any integrations using the old key will stop working.'
),
approveLabel: t('rotate', 'Rotate'),
cancelLabel: t('cancel', 'Cancel'),
});
if (!approved) return;
await fetch('/user/api-key/rotate', { method: 'POST' });
await mutate('/user/self');
setReveal(false);
toaster.show(
t('api_key_rotated', 'API Key rotated successfully'),
'success'
);
}, [decision, fetch, mutate, toaster]);
if (!user || !user.publicApi) {
return null;
}
const mcpBase = mcpUrl || backendUrl;
return (
{t(
'api_auth_note_line1',
'Use your API Key to automate your own account.'
)}
{t(
'api_auth_note_line2',
'If you are building a product that schedules posts on behalf of other Postiz users,'
)}
{t(
'api_auth_note_line3',
'create an OAuth App under the "Apps" tab. Your users will authorize your app via OAuth2,'
)}
{t(
'api_auth_note_line4',
'and you will receive a pos_ prefixed token that works with the API, MCP, and CLI — just like an API Key.'
)}
{t('api_key', 'API Key')}
{t(
'use_postiz_api_to_integrate_with_your_tools',
'Use Postiz API to integrate with your tools.'
)}