Skip to main content

Documentation Index

Fetch the complete documentation index at: https://staplehire.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Set STAPLEHIRE_KEY as a CI secret, install the CLI, and use -q or piped JSON for automation.
env:
  STAPLEHIRE_KEY: ${{ secrets.STAPLEHIRE_KEY }}
steps:
  - run: npm install -g @staplehire/staplehire-cli
  - run: staplehire doctor -q

Quickstart

Do not use staplehire login in CI. Browser login is for local development.
npm install -g @staplehire/staplehire-cli
staplehire doctor -q
staplehire whoami | jq '.organization.id'

GitHub Actions example

name: Staplehire CLI

on:
  workflow_dispatch:

jobs:
  staplehire:
    runs-on: ubuntu-latest
    env:
      STAPLEHIRE_KEY: ${{ secrets.STAPLEHIRE_KEY }}
    steps:
      - uses: actions/checkout@v4
      - run: npm install -g @staplehire/staplehire-cli
      - run: staplehire doctor -q
      - run: |
          staplehire roles create --jd "On-call SRE. ${GITHUB_REPOSITORY} deploys." \
            | jq -e '.role.id'

Environment variables

VariableDescription
STAPLEHIRE_KEYAPI key, for example sh_live_... or sh_test_...
STAPLEHIRE_API_URLOptional API gateway override
STAPLEHIRE_APP_URLOptional dashboard URL for login and open

Machine-readable output

Use -q, --json, or a pipe when scripts need JSON without human status lines.
staplehire doctor -q | jq '.ok'
staplehire roles list | jq '.roles[].id'

Common errors

ErrorCauseFix
AuthenticationErrorSecret is missing or emptyAdd STAPLEHIRE_KEY to CI secrets
PermissionErrorKey lacks organization accessCreate a key for the correct organization
Exit code 8Bad CLI argumentsRun staplehire commands locally and pass required flags

FAQ

Should CI run staplehire login?

No. login opens a browser. Use STAPLEHIRE_KEY instead.

Should I use --json or -q?

Use -q for JSON-only output when a command may print human status in an interactive context.

Can CI create roles and candidates?

Yes, if the API key has permission and the command includes all required flags. Related: Authenticate the Staplehire CLI · Command reference · CLI errors