> For the complete documentation index, see [llms.txt](https://jellyswap.gitbook.io/omdc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jellyswap.gitbook.io/omdc/master.md).

# OMDC - Omise Dollar Coin

## Register user

<mark style="color:green;">`POST`</mark> `https://api.omdc.com/register`

This endpoint allows you to register new user

#### Request Body

| Name     | Type   | Description   |
| -------- | ------ | ------------- |
| email    | string | user email    |
| password | string | user password |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```
{"message": "user is registered succesfully"}
```

{% endtab %}

{% tab title="404 Could not find a cake matching this query." %}

```
{    "message": "wrong input poarams"}
```

{% endtab %}
{% endtabs %}

## Login user

<mark style="color:green;">`POST`</mark> `https://api.omdc.com/login`

User login&#x20;

#### Request Body

| Name     | Type   | Description   |
| -------- | ------ | ------------- |
| email    | string | user email    |
| password | string | user password |

{% tabs %}
{% tab title="200 " %}

```
{"message": "user is sucessfully logged in!" , "user_id":"123251" "authToken": "aaahxf12hxhahasd123"}
```

{% endtab %}

{% tab title="404 " %}

```
{"message": "Wrong username or password"}
```

{% endtab %}
{% endtabs %}

## Get currency balance

<mark style="color:blue;">`GET`</mark> `https://api.omdc.com/balance`

Uses omise transfer api for usd balance and omise blockchain api for OMDC balance

#### Query Parameters

| Name     | Type   | Description            |
| -------- | ------ | ---------------------- |
| userId   | string | user's id              |
| currency | string | currency type or token |

#### Headers

| Name | Type   | Description |
| ---- | ------ | ----------- |
| auth | string | auth token  |

{% tabs %}
{% tab title="200 " %}

```
{"message":"token balance is available", "token":"omdc", balance":"5"}
```

{% endtab %}
{% endtabs %}

## Add Omise address

<mark style="color:green;">`POST`</mark> `https://api.omdc.com/addAddress`

#### Headers

| Name | Type   | Description |
| ---- | ------ | ----------- |
| auth | string | auth token  |

#### Request Body

| Name               | Type   | Description                              |
| ------------------ | ------ | ---------------------------------------- |
| addressDescription | string | add some description for the new address |
| omiseAddress       | string | omise address                            |
| user\_id           | string | user's id                                |

{% tabs %}
{% tab title="200 " %}

```
{"message": "Your omise address have been added successfully"}
```

{% endtab %}
{% endtabs %}

## Buy OMDC token with usd

<mark style="color:green;">`POST`</mark> `https://api.omdc.com/buy`

Uses omise transfer api for  the usd payment + omise blockchain api for OMDC transfer

#### Headers

| Name | Type   | Description |
| ---- | ------ | ----------- |
| auth | string | auth token  |

#### Request Body

| Name            | Type   | Description                                |
| --------------- | ------ | ------------------------------------------ |
| bankDetails     | object | object with bank details                   |
| receiverAddress | string | omise address where funds will be received |
| amount          | string | amount that users wants to buy             |

{% tabs %}
{% tab title="200 " %}

```
{"message": "you have successfully bought 100 OMDC"}
```

{% endtab %}

{% tab title="404 " %}

```
{"message":"your bank details are wrong!"}
```

{% endtab %}
{% endtabs %}

## Redeem OMDC

<mark style="color:green;">`POST`</mark> `https://api.omdc.com/redeem`

Uses omise transfer api for the payment + omise blockchain api to burn OMDC tokens

#### Headers

| Name | Type   | Description |
| ---- | ------ | ----------- |
| auth | string | auth token  |

#### Request Body

| Name        | Type   | Description                |
| ----------- | ------ | -------------------------- |
| bankDetails | string | user's bank details        |
| user\_id    | string | user's id                  |
| amount      | string | OMDC amount to be redeemed |

{% tabs %}
{% tab title="200 " %}

```
{message: "you have successfully redeemed 20 usd"}
```

{% endtab %}
{% endtabs %}

## Send OMDC to external address

<mark style="color:green;">`POST`</mark> `https://api.omdc.com/sendOMDC`

Uses only omise blockchain api

#### Headers

| Name | Type   | Description |
| ---- | ------ | ----------- |
| auth | string | auth token  |

#### Request Body

| Name            | Type   | Description                            |
| --------------- | ------ | -------------------------------------- |
| amount          | string | amount of OMDC tokens to be sent       |
| receiverAddress | string | address where you send the OMDC tokens |

{% tabs %}
{% tab title="200 " %}

```
{"message": "your OMDC tokens have been sent succesfully to 0x1230ABC67"}
```

{% endtab %}
{% endtabs %}

## Get user blockchain address

<mark style="color:blue;">`GET`</mark> `https://api.omdc.com/getAddress`

#### Query Parameters

| Name     | Type   | Description   |
| -------- | ------ | ------------- |
| currency | string | currency type |
| user\_id | string | user's id     |

#### Headers

| Name | Type   | Description |
| ---- | ------ | ----------- |
| auth | string | auth token  |

{% tabs %}
{% tab title="200 " %}

```
{"message": "you have get user's address sucessfully", "address": "0x213acd127", "currency":"OMDC"}
```

{% endtab %}
{% endtabs %}

## Get transaction history

<mark style="color:blue;">`GET`</mark> `https://api.omdc.com/getHistory`

#### Query Parameters

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| user\_id | string | user's id   |

#### Headers

| Name | Type   | Description |
| ---- | ------ | ----------- |
| auth | string | auth token  |

{% tabs %}
{% tab title="200 " %}

```
{"message": 
 "{
  transactionsOMDC: [
   {date:xxx, amount: 5, action:'mint'},
   {date:yyy, amount: 6, action: 'send'}
  ],
  transactionsUSD: [
   {date:xxx, amount: 6, bankDAta: {from: xxx, to: xxx, cardNumber:12323}, action:'transfer'},
     {date:xxx, amount: 6, bankDAta: {from: xxx, to: xxx, cardNumber:12323}, action:'withdraw'}
  ]
 },
 "}
```

{% endtab %}

{% tab title="404 " %}

```
{message:"No such user."}
```

{% endtab %}
{% endtabs %}

## Get total balance

<mark style="color:blue;">`GET`</mark> `https://api.omdc.com/getTotalBalance`

#### Query Parameters

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| user\_id | string | user's id   |

#### Headers

| Name | Type   | Description |
| ---- | ------ | ----------- |
| auth | string | auth token  |

{% tabs %}
{% tab title="200 " %}

```
{"message": "{OMDC: {amount:5, status:'available'}, USD: {amount:5, status: 'locked'}}"
```

{% endtab %}

{% tab title="404 " %}

```
{"message": "invalid user id"}
```

{% endtab %}
{% endtabs %}
