Use this when wiring GitHub Actions (or any CI) to hit live services before you ship. Two different keys are involved: the Engine accepts x-api-key; the Draft API accepts x-player-api-key or Authorization: Bearer for the shared player test key.
| Service | Example base URL |
|---|---|
| Draft API | https://at5ms22dhj.us-east-1.awsapprunner.com |
| Engine API | https://q6dbuvmuvh.us-east-1.awsapprunner.com |
Paths below are relative to that origin (no trailing slash required on the host).
The Engine does not use x-player-api-key. Every analytical route expects:
x-api-key: <ENGINE_API_KEY>- In a browser, open the Engine base URL (same host as the API, e.g.
https://q6dbuvmuvh.us-east-1.awsapprunner.com/). - Open the Get a key tab.
- Complete the wizard (license label is required; billing step is simulated only).
- When the key appears, copy it once and store it somewhere safe (password manager or GitHub Actions secret, e.g.
AMETHYST_API_TEST_KEY). The server will not show the full secret again.
If the tab says issuance is disabled, the operator must set KEY_ISSUANCE_ENABLED to 1 / on (or unset) on the Engine App Runner service and redeploy before you can mint a key.
-
Check that issuance is on (optional but avoids blind failures):
curl -sS "https://q6dbuvmuvh.us-east-1.awsapprunner.com/api/keys/status"Expect JSON like
{ "issuanceEnabled": true, "requiresToken": false }. IfrequiresTokenistrue, the operator must share theKEY_ISSUANCE_SECRETvalue so you can send headerX-Key-Issuance-Tokenon the issue call. -
Mint a key (no issuance token on the server):
curl -sS -X POST "https://q6dbuvmuvh.us-east-1.awsapprunner.com/api/keys/issue" \ -H "Content-Type: application/json" \ -d '{"owner":"github-actions-predeploy","tier":"free"}'
If the server requires an issuance token:
curl -sS -X POST "https://q6dbuvmuvh.us-east-1.awsapprunner.com/api/keys/issue" \ -H "Content-Type: application/json" \ -H "X-Key-Issuance-Token: <KEY_ISSUANCE_SECRET_VALUE>" \ -d '{"owner":"github-actions-predeploy","tier":"free"}'
-
From the JSON response, copy the
apiKeystring (format likeamethyst_live_…). That entire string is the value forx-api-keyon subsequent Engine requests. -
In GitHub: Settings → Secrets and variables → Actions → New repository secret. Paste the key into a secret such as
AMETHYST_API_TEST_KEY. Reference it in workflow steps as${{ secrets.AMETHYST_API_TEST_KEY }}(do not echo it in logs).
Typical failures
401/ missing key on protected routes — header missing or wrong value.- Issuance disabled — operator set
KEY_ISSUANCE_ENABLED=0(orfalse/off) on Engine; fix env and redeploy, or use an operator-created key viaPOST /api/keysinstead.
Draft’s POST /api/players/valuations (and related player routes) authenticate with the shared test key configured on the Draft service, not with the Engine portal.
-
Obtain the value from your team — it lives in the Draft deployment environment (same concept as
PLAYER_API_TEST_KEYin AmethystDraft). Whoever operates Draft App Runner / secrets owns rotation. -
Store it in GitHub as a secret, e.g.
PLAYER_API_TEST_KEY. -
Send it on every Draft request using either header style:
x-player-api-key: <PLAYER_API_TEST_KEY>or
Authorization: Bearer <PLAYER_API_TEST_KEY>
Typical failures
401— key header missing, typo, or value does not match what Draft has configured.503— Draft is running but the operator has not configured a player test key on the server; fix Draft env / secrets and redeploy Draft (not the Engine).
Engine (replace URL and secret name to match your workflow):
curl -sS -o /dev/null -w "%{http_code}\n" \
-X POST "https://q6dbuvmuvh.us-east-1.awsapprunner.com/valuation/calculate" \
-H "Content-Type: application/json" \
-H "x-api-key: $AMETHYST_API_TEST_KEY" \
-d '{"roster_slots":[{"position":"OF","count":3}],"scoring_categories":[{"name":"HR","type":"batting"}],"total_budget":260,"num_teams":12,"league_scope":"Mixed","drafted_players":[]}'Expect 200 when the key and body are valid.
Draft (checkpoint body from your fixture file):
curl -sS -o /dev/null -w "%{http_code}\n" \
-X POST "https://at5ms22dhj.us-east-1.awsapprunner.com/api/players/valuations" \
-H "Content-Type: application/json" \
-H "x-player-api-key: $PLAYER_API_TEST_KEY" \
--data-binary @pre_draft.jsonExpect 200 when Draft, Engine, Mongo, and keys are all correctly configured.
Reminder: Engine CORS_ORIGIN only affects browser calls to the Engine. CI curl / Node requests do not need CORS. If you add browser-based smoke tests from a hosted SPA, ensure CORS_ORIGIN on the Engine App Runner service lists that SPA’s origin (comma-separated if several).