# Create Verifiable Presentation

This creates a verifiable Presentation using following method. The weightage for this API is 200

## API Specification

## Create Verifiable Presentation

<mark style="color:green;">`POST`</mark> `https://api.krypcore.com/api/v0/did/createVP`

Creates a new Verifiable Presentation under the given instance.&#x20;

#### Headers

| Name                                            | Type   | Description                      |
| ----------------------------------------------- | ------ | -------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | User Auth Key obtained from Dash |
| DappId<mark style="color:red;">\*</mark>        | String | DappId                           |

#### Request Body

| Name                                           | Type   | Description   |
| ---------------------------------------------- | ------ | ------------- |
| holderId<mark style="color:red;">\*</mark>     | String | Holder ID     |
| credentialId<mark style="color:red;">\*</mark> | String | Credential ID |

{% tabs %}
{% tab title="200: OK Verifiable Presentation successfully created" %}

```javascript
{
  Data: {
    address: '0xe5376601b62fa8Dc2ee775b5d7C26605C797d2a8',
    algorithm: 'ECC_SECG_P256K1',
    createdAt: '2023-07-11T16:59:26.895989263Z',
    instanceId: 'INS_WA_12_2023711',
    lastUsed: '0001-01-01T00:00:00Z',
    region: 'ap-south-1',
    serviceApiKey: '3a8059d8-ab7c-4bb0-af41-b7d6ab62d40e',
    uniqueId: '70a734a9-480c-439d-80f6-dba8a8623b76',
    vault: 'aws',
    walletName: 'sample-test-1234'
  },
  Message: 'Wallet created successfully',
  Status: 'SUCCESS'
}
```

{% endtab %}

{% tab title="400: Bad Request Wallet limit exceeded under your plan" %}

```javascript
{
  Status: 'FAILURE',
  Code: 400,
  Message: 'Custodial Wallets deployments limits exceeds'
}
```

{% endtab %}

{% tab title="401: Unauthorized Failure in authentication" %}

```javascript
{
  Status: 'FAILURE',
  Code: 401,
  Message: 'subId with apiKey not matching'
}
```

{% endtab %}

{% tab title="400: Bad Request Insufficient Balance" %}

```javascript
{ Status: 'FAILURE', Code: 400, Message: 'insufficient balance' }
```

{% endtab %}
{% endtabs %}

Take a look at how you might call this method using our official libraries, or via `curl`:

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

```bash
curl --location --request POST 'https://api.krypcore.com/api/v0/did/createVP' \
--header 'Authorization: xxxxxxxxxxxxx' \
--header 'DappId: xxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
  "credentialId": "string",
  "holderId": "string"
}'
```

{% endtab %}

{% tab title="Node.js (Fetch)" %}

```javascript
var axios = require('axios');
var data = JSON.stringify({
  "credentialId": "string",
  "holderId": "string"
});

var config = {
  method: 'post',
  url: 'https://api.krypcore.com/api/v0/did/createVP',
  headers: { 
    'Authorization': 'xxxxxxxxxxxxx', 
    'DappId': 'xxxxxxxxxxxxx', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

```

{% endtab %}

{% tab title="Python " %}

```python
import requests
import json

url = "https://api.krypcore.com/api/v0/did/createVP"

payload = json.dumps({
  "credentialId": "string",
  "holderId": "string"
})
headers = {
  'Authorization': 'xxxxxxxxxxxxx',
  'DappId': 'xxxxxxxxxxxxx',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

```

{% endtab %}

{% tab title="Golang" %}

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.krypcore.com/api/v0/did/createVP"
  method := "POST"

  payload := strings.NewReader(`{
  "credentialId": "string",
  "holderId": "string"
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "xxxxxxxxxxxxx")
  req.Header.Add("DappId", "xxxxxxxxxxxxx")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}
{% endtabs %}
