> ## Documentation Index
> Fetch the complete documentation index at: https://docs.waec.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Environments

> Switch between the production and sandbox environments, each with its own base URL and API Secret key.

The Digital Certificate Confirmation API has two environments — production and sandbox. Use the sandbox environment to build and test your integration without affecting real confirmation data.

## Base URLs

| Environment | Base URL                                        |
| ----------- | ----------------------------------------------- |
| Production  | `https://api.waec.org/api/v1/external`          |
| Sandbox     | `https://api.smartdocument.org/api/v1/external` |

## API Secret keys

Each environment uses a separate API Secret key. You cannot use a production key in the sandbox, or vice versa. Generate the appropriate key from your Institution profile for each environment.

## Switching environments

To switch environments, change the base URL and API Secret key in your requests. No other changes are required.

<CodeGroup>
  ```bash curl theme={null}
  # Production
  curl --request POST \
    --url https://api.waec.org/api/v1/external/certificate/confirm \
    --header 'X-DigiCert-Secret: YOUR_PRODUCTION_SECRET_KEY' \
    --header 'Content-Type: application/json' \
    --data '{ "certificates": [] }'

  # Sandbox
  curl --request POST \
    --url https://api.smartdocument.org/api/v1/external/certificate/confirm \
    --header 'X-DigiCert-Secret: YOUR_SANDBOX_SECRET_KEY' \
    --header 'Content-Type: application/json' \
    --data '{ "certificates": [] }'
  ```

  ```javascript JavaScript theme={null}
  const BASE_URL = process.env.NODE_ENV === 'production'
    ? 'https://api.waec.org/api/v1/external'
    : 'https://api.sandbox.smartdocument.org/api/v1/external';

  const SECRET_KEY = process.env.NODE_ENV === 'production'
    ? process.env.DIGICERT_PRODUCTION_KEY
    : process.env.DIGICERT_SANDBOX_KEY;

  const response = await fetch(`${BASE_URL}/certificate/confirm`, {
    method: 'POST',
    headers: {
      'X-DigiCert-Secret': SECRET_KEY,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ certificates: [] }),
  });
  ```

  ```python Python theme={null}
  import os, requests

  if os.environ.get('ENV') == 'production':
      base_url = 'https://api.waec.org/api/v1/external'
      secret_key = os.environ['DIGICERT_PRODUCTION_KEY']
  else:
      base_url = 'https://api.sandbox.smartdocument.org/api/v1/external'
      secret_key = os.environ['DIGICERT_SANDBOX_KEY']

  response = requests.post(
      f'{base_url}/certificate/confirm',
      headers={
          'X-DigiCert-Secret': secret_key,
          'Content-Type': 'application/json',
      },
      json={'certificates': []},
  )
  ```
</CodeGroup>

<Warning>
  Never use your sandbox key in production or your production key in the sandbox. Requests made with a mismatched key will be rejected with a `401 Unauthorized` error.
</Warning>

<Note>
  Sandbox data is isolated from production and may be reset periodically. Do not rely on sandbox confirmation records persisting long-term.
</Note>
