QWED

Type to search pages, engines and advisories.

    Looking for API details?Search the docs

    Platform·Docker image

    Run the QWED API on your own infrastructure.

    The qwedai/qwed-verification image runs the QWED API server. Use it on its own, or start the full stack with Docker Compose from the repository.

    At a glance

    Pull
    docker pull qwedai/qwed-verification:9.1.0
    Tags
    One per release (8.0.0 and 8.0); latest follows main
    Port
    8000, health check at /health
    Runs as
    A non-root user, on linux/amd64
    Program
    Docker Sponsored Open Source
    Licence
    Apache-2.0

    The full stack

    • :8000

      QWED API

      The verification API.

    • :5432

      PostgreSQL

      Database.

    • :6379

      Redis

      Cache and rate limiting.

    • :9090

      Prometheus

      Metrics.

    • :3000

      Grafana

      Dashboards.

    • :16686

      Jaeger

      Tracing.

    Required settings

    The server refuses to start without these.

    VariableWhat it is
    QWED_CORS_ORIGINSThe origins allowed to call the API, comma-separated.
    QWED_JWT_SECRET_KEYSigns sign-in tokens. Changing it invalidates the tokens already issued.
    QWED_API_KEY_LOOKUP_SECRETUsed to look up API keys. It must differ from the JWT secret, and changing it means issuing every API key again.
    API_KEY_SECRETUsed when API keys are issued.
    QWED_AUDIT_SECRET_KEYSigns the hash-chained audit log. Changing it invalidates the signatures on existing rows.

    Optional settings

    VariableWhat it does
    DATABASE_URLUnset, a SQLite file in /var/lib/qwed. Set a PostgreSQL URL to use Postgres.
    QWED_SIGNING_KEY or QWED_SIGNING_KEY_FILEThe ES256 key that signs attestations. Unset, each process makes its own, so attestations cannot be checked after a restart or on another replica.
    QWED_ATTESTATION_TTL_SECONDSHow long an attestation stays valid: 24 hours by default, from 60 seconds to 30 days.
    QWED_METRICS_OPERATOR_USER_IDSThe user IDs that may read /metrics. Unset, nobody can.
    UVICORN_PORTThe port, 8000 by default. The health check follows it.

    Endpoints

    PathWhat it does
    GET /healthHealth check, no sign-in needed. The image’s own health check calls it.
    POST /auth/signup, /auth/signinCreate an account, or sign in, and get a token.
    POST /auth/api-keysIssue an API key.
    POST /verify/math, /verify/logic, /verify/sql, /verify/code and the other /verify/ routesOne check per request, each with its own engine.
    POST /verify/batchSeveral checks in one request.

    Get started

    shell
    # Make the four secrets once, in a file only you can read. If qwed.env# already exists, this keeps it. If a step fails, no qwed.env is written.test -e qwed.env || ( set -e; umask 077    tmp=$(mktemp qwed.env.XXXXXX); trap 'rm -f "$tmp"' EXIT    for k in QWED_JWT_SECRET_KEY QWED_API_KEY_LOOKUP_SECRET \        API_KEY_SECRET QWED_AUDIT_SECRET_KEY; do      s=$(python3 -c 'import secrets; print(secrets.token_urlsafe(48))')      echo "$k=$s"    done > "$tmp"    mv "$tmp" qwed.env )# Start it. Use the same file whenever you recreate the containerdocker run -d --name qwed -p 8000:8000 \    -v qwed-data:/var/lib/qwed \    --env-file qwed.env \    -e QWED_CORS_ORIGINS=http://localhost:3000 \    qwedai/qwed-verification:9.1.0curl http://localhost:8000/health# Or the full stack, from a clone of the repositorycp deploy/.env.example deploy/.env    # then fill in every valuedocker compose -f deploy/docker-compose.yml up -d

    Good to know

    • The image is the API server only. The GitHub Action is built from the same Dockerfile and is not published as an image.
    • latest is rebuilt on every change to main. Pin a version tag for anything you depend on.
    • Keep qwed.env with the qwed-data volume, and out of version control. New secrets invalidate tokens and API keys, and break the audit log’s signatures.

    More developer tools