The Posthook API uses API keys to authenticate requests. You can view and manage your API keys in the Settings page of your project in the Dashboard.
Authenticate requests using the X-API-Key header.
X-API-Key: <YOUR_API_KEY>
Project Scoping: Each API Key is tied to a specific project. All API requests are automatically scoped to that project. You cannot access resources from Project B while using an API Key from Project A.
Although some APIs use Authorization: Bearer <token>, Posthook expects the key directly in the X-API-Key header.
Example Request
curl "https://api.posthook.io/v1/hooks" \
-H "X-API-Key: phk_test_..." \
-H "Content-Type: application/json"
Using the SDK
The official SDKs handle authentication automatically. Pass your API key when creating the client — no need to set headers manually.
import Posthook from '@posthook/node';
const posthook = new Posthook('phk_your_api_key');
// All requests are automatically authenticated
const hook = await posthook.hooks.schedule({
path: '/webhooks/remind',
postIn: '5m',
data: { userId: '123' }
});
You can also set the POSTHOOK_API_KEY environment variable instead of passing the key directly.
Your API keys carry significant privileges, so keep them secure. Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, etc.