# Generate Private Key

Each STIR/SHAKEN certificate requires a private key for its creation. PeeringHub.io provides a dedicated API that simplifies the process of securely generating this private key.

## Generate Private Key

<mark style="color:green;">`POST`</mark> [/api/service\_provider/generate\_sti\_priv\_key](https://api.peeringhub.io/api-doc/#/Service%20Provider/ServiceProviderController_generateStiPrivKey)

After calling this API, you will receive a UUID that uniquely identifies the generated private key. You can use this UUID to download the corresponding private key. When generating a STIR/SHAKEN certificate with PeeringHub.io, simply reference this UUID to specify which private key should be used for the certificate issuance.

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Example**<br>

{% code overflow="wrap" %}

```
curl -X 'POST'  
  'https://api.peeringhub.io/api/service_provider/generate_sti_priv_key'  
  -H 'accept: */*'  
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1ddd6IkpXVCJ9.eyJzZXJ2aWNlX3Byb3ZpZGVyX3V1aWQiOiIzZTIwMTk4ZC1lZDE5LTQwODktOTVlNy1lYTdhMDNmZmNjODEiLCJjb21wYW55X25hbWUiOiJUZXN0IENvbXAiLCJvY24iOiI4MThIIiwicGhvbmVfbnVtYmVyIjoiKDQ4NCkgNDI0LTk2ODMiLCJmaXJzdF9uYW1lIjoiQW5uZSIsImxhc3RfbmFtZSI6Ikt3bm9nIiwidGl0bGUiOiJ2cCIsImFkZHJlc3MiOiIzMyBXZXN0IGxha2UiLCJhZGRyZXNzMiI6bnVsbCwiY2l0eSI6IlJpY2htb25kIiwic3RhdGUiOiJBTCIsInppcGNvZGUiOiIzNDM0NCIsImNvdW50cnkiOiJVUyIsInN0YXR1cyI6bnVsbCwiZW1haWwiOiJhbmt3b25nOTk5QGdtYWlsLmNvbSIsInN1YnNjcmlwdGlvbl9zdGFydGVkX29uIjoiMjAyNS0wNC0zMFQxNTozOTozNS4xMTRaIiwic3Vic2NyaXB0aW9uX2V4cGlyZWRfb24iOiIyMDI4LTA0LTMwVDE1OjM5OjMzLjAwMFoiLCJzdWJkb21haW4iOiJ0ZXN0LWNvbXAuYXBpLnBlZXJpbmdodWIuaW8iLCJpc195ZWFybHkiOmZhbHNlLCJhdXRvX2NoYXJnZSI6bnVsbCwicHJpbnRlZF9uYW1lIjoiYWFhIiwic3RyaXBlX2N1c3RvbWVyX2lkIjoiY3VzX003OHFxN1R3WVpmS2FIIiwiaXNfYWN0aXZlIjp0cnVlLCJpc19jb25maXJtZWQiOnRydWUsInJlc2VsbGVyX3V1aWQiOm51bGwsImtpZCI6IlRlc3RDb21wIiwiZmlsZXJfaWQiOm51bGwsImZybl9udW1iZXIiOm51bGwsImNyZWF0ZWRfb24iOiIyMDIyLTA4LTE1VDEzOjUzOjE5LjE2OFoiLCJpbnZpdGVkIjpbXSwidHlwZSI6InNlcnZpY2UtcHJvdmlkZXIiLCJpYXQiOjE3NDcyNTY2MjMsImV4cCI6MTc0Nzg2MTQyM30.KzbTpsHOYnfAOPeZwAnB9Mx4rIKhhKbPyXuq-e5_6r4'  
  -d ''
```

{% endcode %}

**Response**

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

```json
{
  "success": true,
  "priv_key_uuid": "c0232-adc4-4dff-8016-7565744a18f79"
}

```

{% 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://doc.peeringhub.io/guides/peeringhub-sti-api/generate-private-key.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.
