> For the complete documentation index, see [llms.txt](https://k4k3ru.gitbook.io/k4k3ru-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://k4k3ru.gitbook.io/k4k3ru-docs/getting-started/make-first-authenticated-request.md).

# Make Your First Authenticated API Request

Prepare and send your first protected K4K3RU JSON-RPC request. This guide uses `PaymentOnchain.CreateIntent` because it is an authenticated HTTPS operation that can be completed with one request.

## What This Request Does

The request creates a real pending payment intent for a selected K4K3RU credit product. Creating the intent does not transfer funds or complete a payment. Do not send funds to the returned address unless you intend to purchase that product.

## Prerequisites

Before you begin, you need:

* An API credential and its `apiKey`, `secretKey`, and `signatureAlgorithm`. Follow [Create an API Credential](/k4k3ru-docs/getting-started/create-api-credential.md) if you do not have them.
* The stable name of an active credit product. Retrieve current product names with [List Credit Products](/k4k3ru-docs/api/crm/list-products.md) instead of assuming an example name is available.
* A local environment for one of the languages covered by the authentication guides.

Keep the secret key outside your source code and logs. K4K3RU returns it only when the credential is created.

## 1. Review API Request Authentication

Read [API Request Authentication](/k4k3ru-docs/api/authentication.md) for the authenticated request fields, canonical payload format, supported signature algorithms, freshness window, and replay-protection requirements.

Choose the language guide listed on that page. For Go, follow [Sign a Request with Go](/k4k3ru-docs/api/authentication/sign-request-with-go.md). The Go guide supports both `hmac-sha256` and `ed25519` credentials.

## 2. Prepare the Payment Intent Request

Follow [Create an Onchain Payment Intent](/k4k3ru-docs/api/payment/create-onchain-intent.md) for the endpoint, JSON-RPC method, request fields, and response contract.

Use an active product `name` returned by `AccountApp.ListProducts` as `productName`. Generate a current timestamp, a unique nonce, and a new signature immediately before sending the request.

## 3. Send and Verify the Request

Send the signed JSON-RPC request to the endpoint documented for `PaymentOnchain.CreateIntent`. A successful result containing `intentId` confirms that K4K3RU authenticated the credential signature and created the pending intent.

All returned values belong to the created intent. Do not send funds to its payment address unless you intend to complete the purchase.

## Troubleshooting

If authentication fails, use the checklist in [Authentication Failures](/k4k3ru-docs/api/authentication.md#authentication-failures). In particular, confirm that the API key and secret key belong to the same credential, the configured signature algorithm is correct, and the signed method and canonical params match the transmitted request.

For operation-specific errors such as an unavailable product, see the [Create an Onchain Payment Intent error reference](/k4k3ru-docs/api/payment/create-onchain-intent.md#errors).

Every retry must use a new timestamp, nonce, payload, and signature. Never log or send the secret key while troubleshooting.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://k4k3ru.gitbook.io/k4k3ru-docs/getting-started/make-first-authenticated-request.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
