{"schemaVersion":1,"title":"API authentication","url":"https://appgram.dev/docs/guides/api-authentication","markdownUrl":"https://appgram.dev/docs/format-md/guides/api-authentication.md","jsonUrl":"https://appgram.dev/docs/agent/pages/guides/api-authentication.json","version":"current","locale":"en","markdown":"# API authentication\n\nUse project identifiers for portal requests and API keys for management operations.\n\nAppGram has two request surfaces. Management operations use an API key on your server. Portal operations identify the project and are designed for your customer-facing application. Each operation in the reference shows whether authentication is required.\n\n## API base URL\n\n```text\nhttps://api.appgram.dev\n```\n\nUse the complete path shown in the reference. Management paths start with `/api/v1`; portal paths start with `/portal`.\n\nFollow the operation's authentication badge rather than relying only on its path prefix. Some public status and submission operations also live under `/api/v1`.\n\n## Management requests\n\n### Create a management key\n\n1. Select the intended organization in the [AppGram dashboard](https://app.appgram.dev).\n2. Open [Developer tools → API keys](https://app.appgram.dev/developer/api-keys) and select **Create API key**. The key manager is also available in **Settings → Organization → Developer**.\n3. Enter a recognizable name, such as `feedback-production-backend`. Under **Access**, select the project your backend serves. Select **Organization-wide** only when it needs access across that organization's projects.\n4. Select the permissions needed by your documented operations and choose **Expiration**. An organization-wide key still needs the appropriate operation scopes.\n5. Create the key and save the full value immediately in your server's secret storage. The full key is shown only once; the prefix displayed later is not a usable credential. Select **I've saved it** when finished.\n\nAPI-key administration is restricted to accounts with the appropriate capability; organization owners and administrators have it by default. Access to the Developer tools area is also required. Ask your administrator if the page or creation control is unavailable. A dashboard session and a public project ID do not authorize management requests.\n\n### Verify a server request\n\nSend the key in the `x-api-key` header:\n\n```bash\ncurl --request GET \\\n  --url 'https://api.appgram.dev/api/v1/monitors?status_page_id=YOUR_STATUS_PAGE_ID' \\\n  --header 'x-api-key: YOUR_API_KEY'\n```\n\nThis operation requires the `status:view` scope. Use a status page your key can access. The monitor list accepts `status_page_id`; it does not use a `project_id` query filter.\n\n> Keep API keys on your server\n>\n> Do not ship a management API key in a browser bundle, mobile application, public repository, or embed configuration. Use a server endpoint for management operations.\n\nAPI keys are limited by their organization or project and granted permissions. A key does not grant access to another organization's resources. Follow the operation's required path, query parameters, and request body.\n\n## Rotate or revoke a key\n\nTo replace a key before it expires:\n\n1. Create a replacement with the intended project access, scopes, and expiration. Give it a name that distinguishes it from the old key.\n2. Update the secret in every backend that uses the old key, and deploy or restart those consumers as required.\n3. Make a documented read request with the replacement against a resource it can access. Confirm a successful HTTP response and check for authentication failures in your application logs.\n4. In **Developer tools → API keys**, open the old key's actions and select **Revoke**. Confirm the action after its consumers have switched.\n\nRevocation cannot be undone and requests using the revoked key stop working. If a key is exposed, revoke it promptly and replace the affected consumers; do not wait for normal expiry. If you lose the full value, create a replacement rather than trying to authenticate with its displayed prefix. Use separate keys for development and production.\n\nFor environment and deployment checks, see [Going to production](/guides/going-to-production).\n\n## Operation scopes\n\nThe reference includes required scopes in the operation description when the public contract declares them. Examples include:\n\n| Scope | Example operation |\n| --- | --- |\n| `status:view` | List monitors |\n| `status:manage` | Create or update a monitor |\n| `surveys:view` | List or read surveys |\n| `surveys:manage` | Create or update surveys |\n| `analytics:view` | Read form or survey analytics |\n| `forms:view` | Read form overview or submissions |\n| `forms:manage` | Read a contact form's management configuration |\n| `settings:view` | Read a support form's configuration |\n| `settings:manage` | Create or update contact and support forms |\n| `wishlist:view` | Read a project's waitlist |\n| `releases:view` | Read release recipients |\n| `releases:manage` | Send a release demonstration |\n\nThese are examples from the published operations, not a substitute for checking the operation you call. A read-looking HTTP method can still require a management scope for sensitive configuration.\n\n## Portal requests\n\nPortal requests do not require a management API key. Pass your public project identifier in `project_id` where the operation requires it; configured custom domains can also provide project context.\n\n```bash\ncurl --request GET \\\n  --url 'https://api.appgram.dev/portal/wishes?project_id=YOUR_PROJECT_ID'\n```\n\nPublic access still follows the operation's requirements. Some customer workflows use their own identity, ticket token, or verification step. Read the parameters for the specific operation rather than adding a management key to the client.\n\n## SDK configuration\n\nUse the public project ID for client SDK setup. React, React Native, and Flutter can also use your organization and project slugs for features such as releases. Follow the [getting started guide](/guides/getting-started) and your platform reference for the exact configuration shape.\n\n## Handle errors\n\n* **400**: check required fields, parameter types, and validation errors.\n* **401**: check that a required API key or customer credential is present and valid.\n* **403**: check the key's permissions and access to the requested project.\n* **404**: check the complete path and resource identifier.\n* **429**: pause requests and respect `Retry-After` when the response provides it. Use bounded retries with backoff.\n\nThe published OpenAPI contract describes each operation's documented responses. Do not assume a fixed rate limit or that every response includes rate-limit headers.\n\nContinue with the [public API coverage guide](/guides/public-api) or [monitor reference](/api/monitors).\n\n","contentLocale":"en","isFallback":false,"authorship":{"authors":[],"contributors":[],"reviewedBy":[]}}