> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/da/api/rate-limiting.md).

# Hastighedsbegrænsning

Konfigurer hastighedsbegrænsning i PowerShell Universal for at begrænse API-anmodninger pr. slutpunkt og tidsperiode, og angiv tilladelseslister for betroede klienter.

{% hint style="info" %}
Hastighedsbegrænsning kræver en [licens](https://store.devolutions.net/package#psu).
{% endhint %}

PowerShell Universal giver Dem mulighed for at hastighedsbegrænse anmodninger til webserveren. De kan konfigurere hastighedsbegrænsning pr. slutpunkt og pr. periode. Som standard hastighedsbegrænser klientens IP-adresse klienterne.

Konfigurationsdata for hastighedsbegrænsninger gemmes i filen `ratelimits.ps1`.

## Konfiguration af hastighedsbegrænsning

For at konfigurere hastighedsbegrænsning skal De gå til **Build > APIs > Rate Limits**. Klik på knappen Add, og definer en ny regel for hastighedsbegrænsning.

{% hint style="warning" %}
Hastighedsbegrænsning påvirker alle URL'er for serveren. Hvis De håndhæver en hastighedsbegrænsning, der ikke er korrekt konfigureret, kan De påvirke administrations-API'en negativt.
{% endhint %}

### Metode

Metoden er den HTTP-metode, der gælder for denne regel. Hvis De bruger `*` , påvirker denne regel alle HTTP-metoder. De kan også vælge en enkelt metode ved at vælge den i rullelisten.

### Slutpunkt

Slutpunktet er den URL, som De hastighedsbegrænser. De kan hastighedsbegrænse alle URL'er ved at bruge en `*`. De kan definere specifikke URL'er ved at definere den relative sti: `/api/user`.

### Grænse

Dette er antallet af anmodninger i tidsrummet, før hastighedsbegrænsning træder i kraft.

### Periode

Dette er den periode, som hastighedsgrænsen tælles over. Hvis De f.eks. vælger en periode på 10 minutter og en grænse på 100, kan der foretages op til 100 anmodninger til den metode og det slutpunkt, De har valgt.

## Tilladelseslister

Deaktiver hastighedsbegrænsning for bestemte IP-adresser, klienter og slutpunkter ved at føje dem til tilladelseslisterne for hastighedsbegrænsning. Find dem ved at klikke på indstillingsknappen.

Eksemplet nedenfor forhindrer, at loopback-adapteren hastighedsbegrænses.

```powershell
Set-PSUSetting -RateLimitIpAddressAllowList @("127.0.0.1")
```

## Eksempel: begræns den brugerdefinerede API

Begrænser kaldere af slutpunktet `/api/users` til 100 anmodninger pr. minut.

```powershell
New-PSURateLimit -Endpoint "GET|/api/users" -TimeSpan "00:01:00" -Limit 100
```

## Eksempel: begræns administrations-API'en

Begrænser kaldere af administrations-API'en til 100 anmodninger pr. sekund.

```powershell
New-PSURateLimit -Endpoint "*|/api/v1/*" -TimeSpan "00:00:01" -Limit 100
```

## API

* [New-PSURateLimit](/powershell-universal/da/powershell-kommandoer/new-psuratelimit.md)
* [Set-PSUSetting](/powershell-universal/da/powershell-kommandoer/set-psusetting.md)


---

# 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.devolutions.net/powershell-universal/da/api/rate-limiting.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.
