---
# System prepended metadata

title: Betacard API Proposal

---

# Betacard API Proposal

# Base URL

Staging URL: `https://betacard-api.herokuapp.com/api/v1`


# Authenticating Requests

Please include the `Authorization` in your requests like so:

`Authorization: Bearer <TOKEN>`

`TOKEN` can be obtained from the response body when [signing in](#Sign-In).

# Pagination

For endpoints with paginated contents.

The pagination information will be included in the response header like so:

|HEADER|Description|
|--------|---------|
|`X-Page`|Current page|
|`X-Count`|Current specified count|
|`X-Total-Pages`|Total number of pages|
|`X-Total-Records`|Total number of records|

# Error 

Every error message conform to this shape

```
{
  "message": string;
  "code": string;
  "errors": [];
  "timestamp": string;
  "resource": string;
}
```

Example

```
{
  "message": "Access Code is not found",
  "code": "access_code_not_found",
  "errors": [],
  "timestamp": "2019-10-18T06:04:53Z",
  "resource": "/api/v1/account/verify_sign_in"
}
```


## Account

### Sign up


*Creates an account for new user*

|Method|Path| 
|------|-----------------|
|`POST`|`/account/sign_up`| 

Staging URL: https://betacard-api.herokuapp.com/api/v1/account/sign_up

**Request Body**
```
{
  "phoneNumber": "+60171122345",
  "firstName": "John",
  "lastName": "Wick",
  "email": "johnwick@hightable.global"
}
```

**Response**

| Status Code | Description| 
|------|-----------------|
| **200 OK** | New Account successfully created| 

Body

```
{
  "id": 5,
  "phoneNumber": "+60168028426",  
  "createdAt": "2019-10-11T02:41:36Z",
  "profile": {
    "id": 5,
    "email": "deojeff@gmail.com",
    "isEmailVerified": false,
    "firstName": "John",
    "lastName": "Wick",
    "createdAt": "2019-10-11T02:41:36Z",
    "updatedAt": "2019-10-11T02:41:36Z"
  }
}
```

| Status Code | Description| 
|------|-----------------|
| **400 Bad Request** | Field validation failed| 

Body

```
{
  "message": "Validation Error",
  "code": "validation_error",
  "errors": [
    {
      "field": "phoneNumber",
      "code": "is_defined"
    },
    {
      "field": "firstName",
      "code": "is_defined"
    },
    {
      "field": "lastName",
      "code": "is_defined"
    },
    {
      "field": "email",
      "code": "is_defined"
    }
  ],
  "timestamp": "2019-10-11T06:38:25Z",
  "resource": "/api/v1/sign_up"
}
```

| Status Code | Error | Description |
|------|-----------------|----------|
| **409 Conflict** | `PhoneNumberInUseException` | Phone Number already in use |

Body
```
{
  "message": "Phone Number Already In Use",
  "code": "phone_number_in_use",
  "errors": [],
  "timestamp": "2019-10-11T06:47:29Z",
  "resource": "/api/v1/sign_up"
}
```

| Status Code | Error | Description |
|------|-----------------|----------|
| **409 Conflict** | `EmailAlreadyInUseException` | Email already in use |

Body

```
{
  "message": "Email Already In Use",
  "code": "email_already_in_use",
  "errors": [],
  "timestamp": "2019-10-11T08:54:32Z",
  "resource": "/api/v1/sign_up"
}
```

### Sign In

*Creates a sign in request*
*This sends out an sms to user's device for sign in purpose*

|Method|Path| 
|------|------------------|
|`POST`| `/account/sign_in`| 

**Request Body**
```
{
  "phoneNumber": "+60171122345"
}
```

**Response**

| Status Code | Description| 
|------|-----------------|
| **204 No Content** | Verification SMS sent| 

| Status Code | Error | Description |
|------|-----------------|----------|
| **404 Not Found** | `PhoneNumberInvalidException` | Phone Number does not exist. |

Body

```
{
    "message": "Phone Number does not exist.",
    "code": "phone_number_not_valid",
    "errors": [],
    "timestamp": "2019-10-15T09:24:01Z",
    "resource": "/api/v1/signin"
}
```
---

### Verify Sign In Request

`POST /account/verify_sign_in`

*Verifies sign in request using the code sent via SMS*

**Request Body**

```
{
  "phoneNumber": "+60171122345",
  "code": "1234"
}
```

**Response**

| Status Code | Description| 
|------|-----------------|
| **200 OK** | Account successfully verified| 

Body

```
{
    "lastUsedAt": "2019-11-12T09:33:59.756Z",
    "user": {
        "createdAt": "2019-11-12T03:19:16Z",
        "updatedAt": "2019-11-12T03:19:16Z",
        "id": 3,
        "phoneNumber": "+84912345678",
        "profile": {
            "createdAt": "2019-11-12T03:19:16Z",
            "updatedAt": "2019-11-12T03:19:16Z",
            "id": 3,
            "email": "testing@gmail.com",
            "firstName": "John",
            "lastName": "Wick"
        }
    },
    "userAccessCode": {
        "id": 31,
        "code": "7028",
        "recipient": "+84912345678",
        "expiresAt": "2019-11-12T09:59:37Z",
        "usedAt": null,
        "invalidatedAt": null,
        "user": {
            "createdAt": "2019-11-12T03:19:16Z",
            "updatedAt": "2019-11-12T03:19:16Z",
            "id": 3,
            "phoneNumber": "+84912345678"
        }
    },
    "token": "vPXegfWzQ0W4p33FFS0I17GrHhc1Zxxx",
    "invalidatedAt": null,
    "id": 2
}
```
| Status Code | Description| 
|------|-----------------|
| **400 Bad Request** | Field validation failed| 

Body

```

{
  "message": "Validation Error",
  "code": "validation_error",
  "errors": [
    {
      "field": "phoneNumber",
      "code": "is_defined"
    },
    {
      "field": "code",
      "code": "is_defined"
    }
  ],
  "timestamp": "2019-10-11T06:38:25Z",
  "resource": "/api/v1/verify_sign_in"
}

```
| Status Code | Description| 
|------|-----------------|
| **404 Not Found** | Access code not found | 

Body

```

{
    "message": "Access Code is not found",
    "code": "access_code_not_found",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/verify_sign_in"
}

```
| Status Code | Description| 
|------|-----------------|
| **406 Unprocessable Entity** | Access Code has expired| 

Body

```

{
    "message": "Access Code has expired",
    "code": "access_code_has_expired",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/verify_sign_in"
}

```
| Status Code | Description| 
|------|-----------------|
| **406 Unprocessable Entity** | Access Code has been used| 

Body

```

{
    "message": "Access Code has been used",
    "code": "access_code_has_been_used",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/verify_sign_in"
}

```
### Sign Out
`POST /account/signout`

*Sign out user by verifying token*

**Request Body**
```
{
  "token": "$2a$12$z3ZsVNDysDRpF5blkCcAJelJWwi9DyXX94xm5qIgriKVsqpRMdmY.",
}
```

**Response**

| Status Code | Description| 
|------|-----------------|
| **200 OK** | Account successfully logged out| 

Body

```

{
    "id": 1,
    "token": "$2a$12$QHwkV/aZwrozx0jD2ghGnOfwHtP8QAQJgAhAxumHCQtM.2IEpwry6",
    "lastUsedAt": "2019-10-16T04:55:19Z",
    "invalidatedAt": "2019-10-17T10:10:54Z",
    "user": {
        "id": 1,
        "phoneNumber": "+60164104864",
        "createdAt": "2019-10-15T04:13:31Z"
    },
    "userAccessCode": {
        "id": 3,
        "code": "4960",
        "recipient": "+60164104864",
        "expiresAt": "2019-10-16T05:13:48Z",
        "usedAt": "2019-10-16T04:55:19Z",
        "invalidatedAt": "2019-10-16T05:01:38Z"
    }
}

```
| Status Code | Description| 
|------|-----------------|
| **404 Not Found** | User session cannot be found | 

Body

```

{
    "message": "User session cannot be found",
    "code": "user_session_not_found",
    "errors": [],
    "timestamp": "2019-10-17T10:13:02Z",
    "resource": "/api/v1/account/signout"
}

```
| Status Code | Description| 
|------|-----------------|
| **400 Bad Request** | Field validation failed| 

Body

```

{
    "message": "Validation Error",
    "code": "validation_error",
    "errors": [
        {
            "field": "token",
            "code": "is_defined"
        }
    ],
    "timestamp": "2019-10-17T10:15:34Z",
    "resource": "/api/v1/signout"
}

```

---
## Card Theme

### Create Card Theme

*Creates a new theme for user*

|Method|Path| 
|------|-----------------|
|`POST`|`/card_themes`| 

**Request Body**
```
{  
  "title": "my first theme",  
  "scheme": {
      // Contains all the design and layout information
  },
}

```

**Response**

| Status Code | Description| 
|------|-----------------|
| **200 OK** | New theme successfully created| 

Body

```
{
    "id": 1,
    "title": "my first theme",  
    "scheme": {
        //Contains all the design and layout information
    },
    "updatedAt": "2019-10-17T11:51:46Z",
    "createdAt": "2019-10-17T11:51:46Z"
}
```

| Status Code | Description| 
|------|-----------------|
| **400 Bad Request** | Field validation failed| 

Body

```
{
  "message": "Validation Error",
  "code": "validation_error",
  "errors": [
    {
      "field": "title",
      "code": "is_defined"
    },
    {
      "field": "scheme",
      "code": "is_defined"
    },
  ],
  "timestamp": "2019-10-11T06:38:25Z",
  "resource": "/api/v1/card_themes"
}
```

### Retrieve a list of Card Theme

Retrieves a paginated list of Card Theme sorted by creation time

|Method|Path| 
|------|-----------------|
|`GET`|`/card_themes`|


**Response**

```
[
  {
    "id": 1,
    "title": "Dark Red Sky",
    "scheme": {
      // Contains all the design and layout information
    },
    "createdAt": "2019-10-18T00:30:00Z",
    "updatedAt": "2019-10-18T00:30:00Z"
  },
  {
    "id": 2,
    "title": "Just Red",
    "scheme": {
      // Contains all the design and layout information
    },
    "createdAt": "2019-10-18T00:30:00Z",
    "updatedAt": "2019-10-18T00:30:00Z"
  }
]
```


### Get One Theme By ID
Retrieves a single theme by id

|Method|Path| 
|------|-----------------|
|`GET`|`/card_themes/:id`|


**Response**

| Status Code | Description| 
|------|-----------------|
| **200 OK** | Card theme retrieved successfully | 

Body

```
{
    "id": 1,
    "title": "Blue background",
    scheme:{
        //layout and design data
    },
    createdAt: "2019-10-15T04:13:31Z",
    updatedAt: "2019-10-15T04:13:31Z"
}

```

| Status Code | Description| 
|------|-----------------|
| **404 Not Found** | Card Theme Not Found | 

Body

```

{
    "message": "Card Theme Not Found",
    "code": "card_theme_not_found",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/card_themes/:id"
}

```

### Delete Card Theme

*Deletes a Card Theme based on given ID*

|Method|Path| 
|------|-----------------|
|`DELETE`|`/card_themes/:id`| 


**Response**

| Status Code | Description| 
|------|-----------------|
| **204 No Content** | Card Theme Successfully Deleted| 


| Status Code | Description| 
|------|-----------------|
| **404 Not Found** | Card Theme Not Found | 

Body

```
{
    "message": "Card Theme Not Found",
    "code": "card_theme_not_found",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/card_themes/:id
}
```
### Send Card Theme

POST /send_card_themes

share card theme to recipients

|Method|Path| 
|------|-----------------|
|`POST`|`/send_cards_themes`|


**Request**

```
{  
  "cardTheme": {
      id: 1
  },
  "recipients": [1, 2, 3]
}
```

**Response**

| Status Code | Description| 
|------|-----------------|
| **200 OK** | Card Theme sent successfully | 
Body

```
[
    {
        "id": 1,
        "email": "deojeff@gmail.com",
        "isEmailVerified": false,
        "firstName": "John",
        "lastName": "Wick",
        "createdAt": "2019-10-11T02:41:36Z",
        "updatedAt": "2019-10-11T02:41:36Z",
        "isReceived": true
    },
    {
        "id": 2,
        "email": "joseph@gmail.com",
        "isEmailVerified": false,
        "firstName": "Joseph",
        "lastName": "Wong",
        "createdAt": "2019-10-11T02:41:36Z",
        "updatedAt": "2019-10-11T02:41:36Z",
        "isReceived": false
    }
]
```


| Status Code | Description| 
|------|-----------------|
| **404** | Card Theme Not Found | 

Body
```
{
    "message": "Card Theme Not Found",
    "code": "card-theme_not_found",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/send_cards_themes"
}
```
---
## Card

### Create Card

*Creates a new card for user*

|Method|Path| 
|------|-----------------|
|`POST`|`/cards`| 

Insert bearer token for authorization.

**Request Body**
```
{  
  "title": "my first card",  
  "scheme": {},
  "fieldData": {}
}

```

**Response**

| Status Code | Description| 
|------|-----------------|
| **200 OK** | New card successfully created| 

Body
```
{
    "id": 1,
    "type": "personal",
    "scheme": {
        //Contains all the design and layout information
    },
    "fieldData": {
        //Contains all the labels and values
    },
    "details": {
        "id": 1,
        "title": "my first card",  
        "isFavorite": false,
    },
    "user": {
        "id": 1,
        "phoneNumber": "+60164104864",
        "createdAt": "2019-10-15T04:13:31Z"
     },
    "updatedAt": "2019-10-17T11:51:46Z",
    "createdAt": "2019-10-17T11:51:46Z"
}
```
| Status Code | Description| 
|------|-----------------|
| **404 Not Found** | User Not Found | 

Body
```
{
    "message": "User Not Found",
    "code": "user_not_found",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/cards
}
```

### Get List of Cards

*Get a list of user's card*

|Method|Path| 
|------|-----------------|
|`GET`|`/cards/me`| 

Insert bearer token for authorization.

**Response**

| Status Code | Description| 
|------|-----------------|
| **200 OK** | Get all user's card succesfully | 

Body

```
[
    {
        "id": 1,
        "type": "personal",
        "scheme": {
            //Contains all the design and layout information
        },
        "fieldData": {
            //Contains all the labels and values
        },
        "details": {
            "id": 1,
            "title": "my first card",  
            "isFavorite": false,
        },
        "user": {
            "id": 1,
            "phoneNumber": "+60164104864",
            "createdAt": "2019-10-15T04:13:31Z"
         },
        "updatedAt": "2019-10-17T11:51:46Z",
        "createdAt": "2019-10-17T11:51:46Z"
    },
    {
        "id": 2,
        "type": "personal",
        "scheme": {
            //Contains all the design and layout information
        },
        "fieldData": {
            //Contains all the labels and values
        },
        "details": {
            "id": 2,
            "title": "my second card",  
            "isFavorite": false,
        },
        "user": {
            "id": 1,
            "phoneNumber": "+60164104864",
            "createdAt": "2019-10-15T04:13:31Z"
         },
        "updatedAt": "2019-10-17T11:51:46Z",
        "createdAt": "2019-10-17T11:51:46Z"
    }
]

```

### Update Card

Updates a single card by ID

|Method|Path| 
|------|-----------------|
|`PUT`|`/card/:id`|

Insert bearer token for authorization.

**Request**

```
{  
  "title": "my first card",  
  "scheme": {},
  "fieldData": {},
  "isFavorite": true
}

```

**Response**

| Status Code | Description| 
|------|-----------------|
| **200 OK** | Card updated successfully | 

Body

```
{
    "id": 1,
    "type": "personal",
    "scheme": {
        //Contains all the design and layout information
    },
    "fieldData": {
        //Contains all the labels and values
    },
    "details": {
        "id": 1,
        "title": "my first card",  
        "isFavorite": false,
    },
    "user": {
        "id": 1,
        "phoneNumber": "+60164104864",
        "createdAt": "2019-10-15T04:13:31Z"
     },
    "updatedAt": "2019-10-17T11:51:55Z",
    "createdAt": "2019-10-17T11:51:46Z"
}
```


| Status Code | Description| 
|------|-----------------|
| **404 Not Found** | Card id not found | 

Body

```

{
    "message": "Card id cannot found",
    "code": "card_id_not_found",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/card/"
}

```

### Delete Card

Delete a single card by id

|Method|Path| 
|------|-----------------|
|`DELETE`|`/card/:id`|

Insert bearer token for authorization.

**Response**

| Status Code | Description| 
|------|-----------------|
| **204 No Content** | Card deleted successfully | 



| Status Code | Description| 
|------|-----------------|
| **404 Not Found** | Card not found | 

Body
```
{
    "message": "Card cannot be found",
    "code": "card_not_found",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/card/"
}
```
---
## Vault
### Send Card

POST /send_cards

Send cards to recipients

|Method|Path| 
|------|-----------------|
|`POST`|`/send_cards`|


**Request**

```
{  
  "card": {
      id: 1
  },
  "recipients": [1, 2, 3]
}
```

**Response**

| Status Code | Description| 
|------|-----------------|
| **200 OK** | Card sent successfully | 
Body

```
[
    {
        "id": 1,
        "email": "deojeff@gmail.com",
        "isEmailVerified": false,
        "firstName": "John",
        "lastName": "Wick",
        "createdAt": "2019-10-11T02:41:36Z",
        "updatedAt": "2019-10-11T02:41:36Z",
        "isReceived": true
    },
    {
        "id": 2,
        "email": "joseph@gmail.com",
        "isEmailVerified": false,
        "firstName": "Joseph",
        "lastName": "Wong",
        "createdAt": "2019-10-11T02:41:36Z",
        "updatedAt": "2019-10-11T02:41:36Z",
        "isReceived": false
    }
]
```


| Status Code | Description    |
| ----------- | -------------- |
| **404**     | Card not found |

Body
```
{
    "message": "Card not found",
    "code": "card_not_found",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/send_cards/"
}
```

### Retrieve a list of Cards In Vault By User

Retrieves a paginated list of cards In vault by user sorted by creation time

|Method|Path| 
|------|-----------------|
|`GET`|`/vaults`|


**Response**

```
[
    {
        "createdAt": "2019-11-01T06:29:37Z",
        "updatedAt": "2019-11-01T06:29:37Z",
        "id": 1,
        "notes": null,
        "collectedAt": null,
        "archivedAt": null,
        "card": {
            "createdAt": "2019-10-30T03:22:00Z",
            "updatedAt": "2019-10-30T03:22:00Z",
            "id": 1,
            "type": "personal",
            "scheme": {},
            "fieldData": {}
        },
        "user": {
            "createdAt": "2019-10-30T03:19:18Z",
            "updatedAt": "2019-10-30T03:19:18Z",
            "id": 3,
            "phoneNumber": "+60164104865"
        },
        "sender": {
            "createdAt": "2019-10-30T03:19:18Z",
            "updatedAt": "2019-10-30T03:19:18Z",
            "id": 1,
            "phoneNumber": "+60164104864"
        }
    },
    {
        "createdAt": "2019-11-01T06:29:37Z",
        "updatedAt": "2019-11-01T06:29:37Z",
        "id": 2,
        "notes": null,
        "collectedAt": null,
        "archivedAt": null,
        "card": {
            "createdAt": "2019-10-30T03:22:00Z",
            "updatedAt": "2019-10-30T03:22:00Z",
            "id": 1,
            "type": "personal",
            "scheme": {},
            "fieldData": {}
        },
        "user": {
            "createdAt": "2019-10-30T03:19:18Z",
            "updatedAt": "2019-10-30T03:19:18Z",
            "id": 3,
            "phoneNumber": "+60164104866"
        },
        "sender": {
            "createdAt": "2019-10-30T03:19:18Z",
            "updatedAt": "2019-10-30T03:19:18Z",
            "id": 1,
            "phoneNumber": "+60164104865"
        }
    },
]
```

### Exchange Card with Sender

1. Save the current card sent by sender.
2. Send favorite card back to the sender.

| Method |               Path |
| ------ | ------------------ |
| `POST` | `/vaults/:id/exchange` |


| Status Code | Description| 
|------|-----------------|
| **200 OK** | Card Successfully Exchanged | 

**Response**


**Response**

| Status Code | Description          |
| ----------- | -------------------: |
| **404**     | Card Not Found      |

Body
```
{
    "message": "Card Not Found",
    "code": "card_not_found",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/vaults/:id/exchange"
}
```

**Response**

| Status Code | Description          |
| ----------- | -------------------: |
| **409**     | Card Already Exchanged|

Body
```
{
    "message": "Card Already Exchanged",
    "code": "card_already_exchanged",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/vaults/:id/exchange"
}
```


### Mark single Card in Vault as Saved

Mark selected as saved in vault

| Method |               Path |
| ------ | ------------------:|
| `POST` | `/vaults/:id/save` |


| Status Code | Description| 
|------|-----------------|
| **200 OK** | Card saved successfully | 
**Response**
```
{
    "createdAt": "2019-11-04T06:09:37Z",
    "updatedAt": "2019-11-04T06:09:37Z",
    "id": 31,
    "notes": null,
    "collectedAt": "2019-11-06T06:09:37Z",
    "archivedAt": null,
    "card": {
        "createdAt": "2019-10-30T03:22:00Z",
        "updatedAt": "2019-10-30T03:22:00Z",
        "id": 1,
        "type": "personal",
        "scheme": {},
        "fieldData": {}
    },
    "user": {
        "createdAt": "2019-10-30T03:19:18Z",
        "updatedAt": "2019-10-30T03:19:18Z",
        "id": 1,
        "phoneNumber": "+60164104864"
    },
    "sender": {
        "createdAt": "2019-10-30T03:19:18Z",
        "updatedAt": "2019-10-30T03:19:18Z",
        "id": 1,
        "phoneNumber": "+60164104864"
    }
}
```

| Status Code | Description          |
| ----------- | -------------------- |
| **404**     | Card Not Found |

Body
```
{
    "message": "Card Not Found", //card not found?
    "code": "card_not_found",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/vaults/:id/save"
}
```

### Mark single Card in Vault as Archived

Mark selected as archived in vault

| Method |                  Path |
| ------ | ---------------------:|
| `POST` | `/vaults/:id/archive` |


| Status Code | Description| 
|------|-----------------|
| **200 OK** | Card archived successfully | 
**Response**
```
{
    "createdAt": "2019-11-04T06:09:37Z",
    "updatedAt": "2019-11-04T06:09:37Z",
    "id": 31,
    "notes": null,
    "collectedAt": "2019-11-06T06:09:37Z",
    "archivedAt": "2019-11-10T06:09:37Z",
    "card": {
        "createdAt": "2019-10-30T03:22:00Z",
        "updatedAt": "2019-10-30T03:22:00Z",
        "id": 1,
        "type": "personal",
        "scheme": {},
        "fieldData": {}
    },
    "user": {
        "createdAt": "2019-10-30T03:19:18Z",
        "updatedAt": "2019-10-30T03:19:18Z",
        "id": 1,
        "phoneNumber": "+60164104864"
    },
    "sender": {
        "createdAt": "2019-10-30T03:19:18Z",
        "updatedAt": "2019-10-30T03:19:18Z",
        "id": 1,
        "phoneNumber": "+60164104864"
    }
}
```
| Status Code | Description          |
| ----------- | -------------------- |
| **404**     | Card Not Found |

Body
```
{
    "message": "Card Not Found", 
    "code": "card_not_found",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/vaults/:id/save"
}
```
### Unarchived single Card in Vault

Unarchived single card in vault

| Method |                  Path |
| ------ | ---------------------:|
| `POST` | `/vaults/:id/unarchive` |


| Status Code | Description| 
|------|-----------------|
| **200 OK** | Card saved successfully | 
**Response**
```
{
    "createdAt": "2019-11-04T06:09:37Z",
    "updatedAt": "2019-11-04T06:09:37Z",
    "id": 31,
    "notes": null,
    "collectedAt": "2019-11-06T06:09:37Z",
    "archivedAt": null,
    "card": {
        "createdAt": "2019-10-30T03:22:00Z",
        "updatedAt": "2019-10-30T03:22:00Z",
        "id": 1,
        "type": "personal",
        "scheme": {},
        "fieldData": {}
    },
    "user": {
        "createdAt": "2019-10-30T03:19:18Z",
        "updatedAt": "2019-10-30T03:19:18Z",
        "id": 1,
        "phoneNumber": "+60164104864"
    },
    "sender": {
        "createdAt": "2019-10-30T03:19:18Z",
        "updatedAt": "2019-10-30T03:19:18Z",
        "id": 1,
        "phoneNumber": "+60164104864"
    }
}
```
| Status Code | Description          |
| ----------- | -------------------- |
| **404**     | Card Not Found |

Body
```
{
    "message": "Card Not Found", 
    "code": "card_not_found",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/vaults/:id/save"
}
```
### Delete single Archived Card in Vault

Delete single archived card in vault

| Method |                  Path |
| ------ | ---------------------:|
| `DELETE` | `/vaults/:id` |

**Response**

| Status Code        | Description           |
| ------------------ |:--------------------- |
| **204 No Content** | Card deleted |

| Status Code | Description          |
| ----------- | -------------------- |
| **404**     | Card Not Found |

Body
```
{
    "message": "Card Not Found", 
    "code": "card_not_found",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/vaults/:id/save"
}
```
| Status Code | Description          |
| ----------- | -------------------- |
| **403 Forbidden**     | Card Not Archived |

Body
```
{
    "message": "Card Not Archived", 
    "code": "card_not_archived",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/vaults/:id"
}
```
### Create or Edit Note for single Card in Vault

Create or edit note for a single card in vault

| Method |                  Path |
| ------ | ---------------------:|
| `PUT` | `/vaults/:id/notes` |
**Request**

```
{  
  "note": "this is a test note"
}
```

**Response**

| Status Code        | Description           |
| ------------------ |:--------------------- |
| **200 OK** | Note updated |
Body
```
{
    "message": "Card Not Found", 
    "code": "card_not_found",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/vaults/:id/save"
}
```

| Status Code | Description          |
| ----------- | -------------------- |
| **404**     | Card Not Found |

Body
```
{
    "createdAt": "2019-11-04T06:09:37Z",
    "updatedAt": "2019-11-04T06:09:37Z",
    "id": 31,
    "notes": "this is a test note",
    "collectedAt": "2019-11-06T06:09:37Z",
    "archivedAt": null,
    "card": {
        "createdAt": "2019-10-30T03:22:00Z",
        "updatedAt": "2019-10-30T03:22:00Z",
        "id": 1,
        "type": "personal",
        "scheme": {},
        "fieldData": {}
    },
    "user": {
        "createdAt": "2019-10-30T03:19:18Z",
        "updatedAt": "2019-10-30T03:19:18Z",
        "id": 1,
        "phoneNumber": "+60164104864"
    },
    "sender": {
        "createdAt": "2019-10-30T03:19:18Z",
        "updatedAt": "2019-10-30T03:19:18Z",
        "id": 1,
        "phoneNumber": "+60164104864"
    }
}
```
### Delete notes for Card in Vault

Delete notes for card in vault

| Method |                  Path |
| ------ | ---------------------:|
| `DELETE` | `/vaults/:id/notes` |

**Response**

| Status Code        | Description           |
| ------------------ |:--------------------- |
| **204 No Content** | Notes deleted |

| Status Code | Description          |
| ----------- | -------------------- |
| **404**     | Card Not Found |

Body
```
{
    "message": "Card Not Found", 
    "code": "card_not_found",
    "errors": [],
    "timestamp": "2019-10-16T07:38:51Z",
    "resource": "/api/v1/vaults/:id/save"
}
```

### Archive Cards in vault

Archive mutiple cards in vault

| Method | Path                   |
| ------ | ---------------------- |
| `POST` | `/vaults/archive` |

**Request**

```
{  
  "vaults": [1, 2, 3, 4, 5]
}
```

**Response**

| Status Code | Description| 
|------|-----------------|
| **204 No Content** | Card(s) archived successfully | 


### Unarchive Cards in vault

Unarchive mutiple cards in vault

| Method | Path                   |
| ------ | ---------------------- |
| `POST` | `/vaults/unarchive` |

**Request**

```
{  
  "vaults": [1, 2, 3, 4, 5]
}
```

**Response**

| Status Code | Description| 
|------|-----------------|
| **204 No Content** | Card(s) unarchived successfully | 

### Delete Cards in vault

Delete mutiple cards in vault

| Method | Path                   |
| ------ | ---------------------- |
| `DELETE` | `/vaults/delete` |

**Request**

```
{  
  "vaults": [1, 2, 3, 4, 5]
}
```

**Response**

| Status Code | Description| 
|------|-----------------|
| **204 No Content** | Card(s) deleted successfully | 



## Get a list of Recipients that have the card in their vault (placeholder)
// vault/:card_id/recipients
