# Integration flow, Core APIs and SSO Setup

Enable seamless reward disbursals using EnKash’s APIs. This page covers the **integration flow**, **core APIs**, and **SSO setup** to help you launch quickly and securely.


<Container>
  ### <span style="color:#0a58ca">Integration Flow</span>

![Rewards Flow](https://api.apidog.com/api/v1/projects/559597/resources/344270/image-preview)
    
    ### <span style="color:#0a58ca">Steps Involved</span>

<Steps>
  <Step title="Obtain Access Token">
    Authenticate via the [Client Authentication API](https://docs.enkash.com/api-9796904.md) to receive your `access_token`.
  </Step>
  <Step title="Set Headers & Token">
    For each API request, use the `Authorization` header with the access token.
  </Step>
  <Step title="Get Reward Account Details">
    Use [Get Reward Account Details](https://docs.enkash.com/api-9796909.md) to fetch balance and account info.
  </Step>
  <Step title="Create or Allocate Rewards">
    Call [Create and Allocate Points](https://docs.enkash.com/api-9796905.md) to fund the user’s reward card.
  </Step>
</Steps>


</Container>





<Container>
  ### <span style="color:#0a58ca">Security Notes</span>

* Encrypted Requests are mandatory using the AES encryption logic.

**Success Indicators**

| **HTTP Status** | **response\_code** | **Meaning** | **Action**                           |
| --------------- | ------------------ | ----------- | ------------------------------------ |
| `200 OK`        | `0`                | Success     | Proceed with response payload        |
| `200 OK`        | `1`                | Failure     | Check `response_message` for details |

**Example**

```json
{
  "response_code": 1,
  "response_message": "Insufficient balance in card account",
  "payload": "Insufficient balance in card account"
}
```

:::highlight gray 
**`otbBalance`** field shows the current reward card balance available for redemption.
:::
    
    ### <span style="color:#0a58ca">Core APIs</span>

| API                                                             | Description                                          |
| --------------------------------------------------------------- | ---------------------------------------------------- |
| [Get Card Account Details](https://docs.enkash.com/api-9796909.md)      | Fetch balance and user-specific card account info.   |
| [Create & Allocate Points](https://docs.enkash.com/api-9796905.md)      | Create or reallocate reward cards and assign points. |
| [SSO Login](https://docs.enkash.com/api-9796903.md)                     | Generate one-click login token for reward access.    |
| [Get Transaction Details](https://docs.enkash.com/api-9796907.md)       | View transaction history and status.                 |
| [Search Enkash Card](https://docs.enkash.com/api-9796910.md)            | Look up specific user card details.                  |
| [Bulk Create & Allocate Points](https://docs.enkash.com/api-9796906.md) | Create and fund multiple cards in one go.    |

</Container>


<Container>
  ### <span style="color:#0a58ca">SSO Integration</span>

**For Employee**
<Steps>
  <Step title="Get Access Token Via SSO Login APIs">
    [here](https://docs.enkash.com/api-9796903.md)
  </Step>
  <Step title="Embed this redirect URL on your portal">

   ```
   https://invoice-uat.enkash.in/sso/{access_token}/employee_rewards/{partner}
   ```
   | **Placeholder**  | **Description**                        |
| ---------------- | -------------------------------------- |
| `{access_token}` | Token obtained from the SSO API        |
| `{partner}`      | Your partner identifier (e.g., `hrms`) |

  **Example**    
```
   `https://invoice-uat.enkash.in/sso/aF5V6hPScEd9mCowJmbZFKk5Xg/employee_rewards/hrms`
```
       
  </Step>
</Steps>
    **For HR Admin**
```
https://invoice-uat.enkash.in/sso/{access_token}/reward_account/{partner}
```

:::info[]
In production, replace `invoice-uat.enkash.in` with `home.enkash.com`
:::
    
</Container>


<Container>
  ### <span style="color:#0a58ca">Common Fields Passed</span>

| **Parameter**             | **Description**                                                         |
| ------------------------- | ----------------------------------------------------------------------- |
| `companyId`               | Unique EnKash Company ID provided to the client after onboarding.       |
| `cardAccountId`           | Unique EnKash Reward Account ID assigned to the client post onboarding. |
| `partnerId`               | Unique Partner ID issued to the client during the onboarding process.   |
| `enkashCardId`            | System-generated unique ID for each EnKash card.                        |
| `enkashCardTransactionId` | Unique ID associated with each transaction made using an EnKash card.   |

### <span style="color:#0a58ca">HTTP Response Codes</span>

| Code | Message              | Description                       |
| ---- | -------------------- | --------------------------------- |
| 200  | Success              | API executed successfully         |
| 400  | Bad Request          | Invalid/missing parameters        |
| 422  | Unprocessable Entity | Invalid data or failed validation |
| 404  | Not Found            | Entity not found in the system    |
| 500  | Server Error         | Internal error on EnKash servers  |

</Container>




