> For the complete documentation index, see [llms.txt](https://docs.ecommerce.seb.ee/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ecommerce.seb.ee/seb-docs-draft/seb-docs-public-lv/integracija/tirgotaja-api/api-drosiba.md).

# API drošība

### Autentifikācija

Tirgotāja API izmanto **OAuth 2.0 Client Credentials** plūsmu. Katram veikalam ir **Client ID** un **Client Secret**. Apmainiet tos pret piekļuves žetonu. Iekļaujiet žetonu katra API pieprasījuma `Autorizācija` galvenē:

```
Authorization: Bearer <access_token>
```

Atsevišķi akreditācijas dati tiek izsniegti **Smilškaste** un **Produkcijas** vidēm. Piekļuves žetoni ir konkrētai videi piesaistīti un tos var izmantot tikai tās vides API galapunktos, kurai tie pieder.

Klienta akreditācijas dati ir pieejami **Tirgotāja portāla** sadaļā **Iestatījumi → Veikala iestatījumi → Tehniskā informācija**.

{% hint style="warning" %}
Glabājiet savu klienta ID, klienta noslēpumu un iegūtos piekļuves žetonus drošībā; nekad tos neizpaudiet klienta puses lietotnēs, mobilajās lietotnēs vai pārlūka kodā. Autentifikācijai un API pieprasījumiem jānotiek drošā backend vidē.
{% endhint %}

#### **Piekļuves žetona iegūšana**

Lai iegūtu piekļuves žetonu, nosūtiet `POST` pieprasījumu uz autentifikācijas galapunktu: <https://api.ecommerce.sebgroup.com/auth/realms/participants-seb/protocol/openid-connect/token>. Pieprasījumam jāietver `grant_type=client_credentials`, `client_id` un `client_secret` parametri, piemēram:

```http
POST https://api.ecommerce.sebgroup.com/auth/realms/participants-seb/protocol/openid-connect/token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials
&client_id=<shop_client_id>
&client_secret=<shop_client_secret>
```

Veiksmīgs pieprasījums atgriež piekļuves žetonu kopā ar tā derīguma termiņu sekundēs:

<pre class="language-json"><code class="lang-json">{
<strong> "access_token": "...",
</strong><strong> "expires_in": 7200,
</strong> "token_type": "Bearer"
}
</code></pre>

#### **Žetona atjaunošana**

Piekļuves žetoniem ir ierobežots darbības laiks, un tie pēc derīguma termiņa beigām ir jāatjauno. Lai iegūtu jaunu piekļuves žetonu, atkārtojiet žetona pieprasījumu, izmantojot to pašu klienta ID un klienta noslēpumu.

Lietotnēm vajadzētu:

* Saglabāt kešatmiņā un atkārtoti izmantot piekļuves žetonu līdz tā derīguma termiņa beigām.
* Pieprasīt jaunu piekļuves žetonu, kad esošais žetons beidzas vai tuvojas derīguma termiņa beigām.
* Apstrādāt autentifikācijas kļūmes (HTTP 401 Unauthorized atbildes), iegūstot jaunu piekļuves žetonu un atkārtojot pieprasījumu.

### Šifrēšana

Saziņā ar Tirgotāja API tiek izmantota **Transporta slāņa drošība (TLS)**. TLS šifrē datus starp jūsu sistēmām un SEB Ecommerce Payment Gateway pārsūtīšanas laikā.

API operācijām, kas satur **sensitīvus maksājumu datus**, papildus tiek piemērots **galalīdz galam šifrēšanas** slānis virs TLS. Sensitīvie dati pirms nosūtīšanas tiek šifrēti, izmantojot SEB Ecommerce Payment Gateway publisko atslēgu, un tos var atšifrēt tikai ar atbilstošo privāto atslēgu, kas atrodas vārtejas backend pusē.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ecommerce.seb.ee/seb-docs-draft/seb-docs-public-lv/integracija/tirgotaja-api/api-drosiba.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
