# Start Using the Slade360 eTIMS API

This page covers the whole integration. You get credentials, build against the
development environment, then go live, with the VSCU deployment automated by
Slade360.

## 1. Get your credentials

[Onboard and activate your business](/docs/eTIMS/How-To-Guides/Self-Onboard-on-eTIMS),
then get a `client_id` and `client_secret` for your integration. Credentials are
issued per environment, so development and production have their own pair.

## 2. Authenticate

Exchange your credentials for an access token through the
[Authentication API](/auth-api), using the OAuth 2.0 client credentials grant:

```bash
curl --request POST \
  --url 'https://identity-dev.slade360edi.com/realms/slade360/protocol/openid-connect/token' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'client_id=<your_client_id>' \
  --data-urlencode 'client_secret=<your_client_secret>' \
  --data-urlencode 'grant_type=client_credentials'
```

Send the returned `access_token` as `Authorization: Bearer <access_token>` on
every API call. A token lasts 30 minutes, so request a new one once it expires.

## 3. Know your environments

| Environment | Authentication host | eTIMS API base URL |
|-------------|--------------------|--------------------|
| **Development** | `https://identity-dev.slade360edi.com` | `https://api-dev.slade360edi.com/erp` |
| **Production** | `https://identity.slade360edi.com` | `https://api.erp.slade360.co.ke` |

Build and test against development first.

## 4. Set up your data

Before you transact, make sure these exist. The
[eTIMS API Reference](/etims-api) has the endpoints for each.

1. Branches, one for every location you operate from.
2. Items and products, mapped to KRA item classifications.
3. Customers and suppliers, the business partners you trade with.
4. eTIMS codes and tax codes, synced so classification and tax come out right.

## 5. Test the whole flow

Run a full transaction in development.
[Create and sign an invoice](/docs/eTIMS/How-To-Guides/Create-an-eTIMS-Invoice),
check that it comes back with a CU invoice number and a QR code, then confirm it
shows up in eTIMS.

## 6. Go live

Once your integration passes in development:

1. Switch to the production credentials and base URLs in the table above.
2. Deploy the VSCU. The Virtual Secure Computing Unit (VSCU) is the secure
   component that signs transactions and sends them to KRA. Slade360 automates
   the deployment, so you don't provision it by hand. One is set up per branch
   as part of going live.
3. Initialize each branch device so it can transact. You do this once per
   branch.
4. Run a smoke test in production: issue one live invoice and confirm it signs.

> **Note:** You work through the exact go-live steps and the automated VSCU
> deployment with the Slade360 team during onboarding. Confirm the production
> checklist with your integration contact before you issue live invoices.

## Related

- [Authentication API](/auth-api): the reference for generating tokens.
- [eTIMS API Reference](/etims-api): every endpoint, each with a "Try it" button.
