# Create Subject Profile

This creates a subject profile using method. The weightage for this API is 10

## API Specification

## Create subject profile

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

Creates a new subject profile 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             |
| ---------------------------------------------------- | ------ | ----------------------- |
| subjectId<mark style="color:red;">\*</mark>          | String | ID of subject-Email ID  |
| subjectDescription<mark style="color:red;">\*</mark> | String | Description of subject  |
| subjectName<mark style="color:red;">\*</mark>        | String | The name of the subject |
| method                                               | String | method type             |

{% tabs %}
{% tab title="200: OK Success" %}

```javascript
{
    "Data": "did:key:z6MkoMGS7TnPJ9yykW1uPVeyviA1i6Ly5zn5PnbHAr9agaGS",
    "Message": "Subject Profile Created",
    "Status": "SUCCESS"
}
```

{% endtab %}

{% tab title="500: Internal Server Error invalid Method Type" %}

```javascript
{
    "Data": null,
    "Message": "Please Provide Valid DID Method Type",
    "Status": "FAILURE"
}
```

{% 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 'https://api.krypcore.com/api/v0/did/createSubjectProfile' \
--header 'Authorization: xxxxxxxxxxxxx' \
--header 'DappId: xxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
  "method": "key",
  "subjectDescription": "xxx",
  "subjectId": "xxx@gmail.com",
  "subjectName": "xxx"
}'
```

{% endtab %}

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

```javascript
const axios = require('axios');
let data = JSON.stringify({
  "method": "key",
  "subjectDescription": "xxx",
  "subjectId": "xxx@gmail.com",
  "subjectName": "xxx"
});

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

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

```

{% endtab %}

{% tab title="Python " %}

```python
import requests
import json

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

payload = json.dumps({
  "method": "key",
  "subjectDescription": "xxx",
  "subjectId": "xxx@gmail.com",
  "subjectName": "xxx"
})
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/createSubjectProfile"
  method := "POST"

  payload := strings.NewReader(`{
  "method": "key",
  "subjectDescription": "xxx",
  "subjectId": "xxx@gmail.com",
  "subjectName": "xxx"
}`)

  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 %}
