# Sign Message

The "Sign Message" feature in the KrypC wallet-dev Service API allows users to generate cryptographic signatures for messages, providing a secure way to verify ownership or authorization in decentralized applications. This feature is useful for identity verification and message authentication in blockchain and cryptographic systems.

This will allow to Sign message.

## API Specification

## Sign Message API

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

To sign message API under the given instance.&#x20;

#### Headers

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

#### Request Body

| Name                                         | Type   | Description |
| -------------------------------------------- | ------ | ----------- |
| privateKey<mark style="color:red;">\*</mark> | String | Private Key |
| message<mark style="color:red;">\*</mark>    | String | Message     |

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

```javascript
{
    "Data": {
        "signature": "0x1b5ef0f705318b13cd25e46492897c3d59058334bca7931cd6e01a3a4f9a374671bb93c34e926ffd3c1326be91beda6bc5ecec2813a9bc75ebae4df6a24ac69901"
    },
    "Message": "Signed message successfully",
    "Status": "SUCCESS"
}
```

{% endtab %}

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

```javascript
{
    "message": "Invalid API key in request"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Key values should be given" %}

```
{
    "message": "Internal Server Error"
}
```

{% 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/devWallet/signMessage' \
--header 'DappId: **********' \
--header 'Authorization: **********' \
--header 'SubscriptionId: ********' \
--header 'ChainId: ********' \
--header 'Content-Type: application/json' \
--data '{
    "privateKey": "**********",
    "message":"Hello"
}'
```

{% endtab %}

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

```javascript

var myHeaders = new Headers();
myHeaders.append("DappId", "**********");
myHeaders.append("Authorization", "**********");
myHeaders.append("SubscriptionId", "********");
myHeaders.append("ChainId", "********");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "privateKey": "**********",
  "message": "Hello"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.krypcore.com/api/v0/devWallet/signMessage", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="Python " %}

```python

import requests
import json

url = "https://api.krypcore.com/api/v0/devWallet/signMessage"

payload = json.dumps({
  "privateKey": "**********",
  "message": "Hello"
})
headers = {
  'DappId': '**********',
  'Authorization': '**********',
  'SubscriptionId': '********',
  'ChainId': '********',
  '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/devWallet/signMessage"
  method := "POST"

  payload := strings.NewReader(`{
    "privateKey": "**********",
    "message":"Hello"
}`)

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

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("DappId", "**********")
  req.Header.Add("Authorization", "**********")
  req.Header.Add("SubscriptionId", "********")
  req.Header.Add("ChainId", "********")
  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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.krypcore.com/dev-docs/api-reference/core-service-apis/wallet-manager/developer-wallet/sign-message.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
