<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [motion-sdk](./motion-sdk.md) &gt; [Motion](./motion-sdk.motion.md)

## Motion class

Motion API client.

**Signature:**

```typescript
export declare class Motion 
```

## Remarks

Simple wrapper around the usemotion.com API. Just provide a user ID and API key, and then start making requests.

Warning: Motion [enforces](https://docs.usemotion.com/docs/motion-rest-api/44e37c461ba67-motion-rest-api#rate-limit-information) its rate limit strictly. Excessive overruns of the rate limit can result in losing your API privileges and having to get them back through customer support.

This client will not exceed the rate limit so long as only one instance makes requests to the Motion API for any one user and no calls are made directly to any of the `unsafe_` methods. If you require more advanced usage, you can pass a custom rate limiter.

## Constructors

<table><thead><tr><th>

Constructor


</th><th>

Modifiers


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[(constructor)(opts)](./motion-sdk.motion._constructor_.md)


</td><td>


</td><td>

Create a Motion API client.


</td></tr>
</tbody></table>

## Properties

<table><thead><tr><th>

Property


</th><th>

Modifiers


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[baseUrl](./motion-sdk.motion.baseurl.md)


</td><td>

`readonly`


</td><td>

string


</td><td>

Base URL of the API.


</td></tr>
<tr><td>

[closedReason](./motion-sdk.motion.closedreason.md)


</td><td>

`readonly`


</td><td>

[ClosedReason](./motion-sdk.closedreason.md) \| null


</td><td>

Reason the client was closed, if any.


</td></tr>
<tr><td>

[overrunLimiter](./motion-sdk.motion.overrunlimiter.md)


</td><td>

`readonly`


</td><td>

RateLimiterAbstract


</td><td>

Rate limiter that tracks how many times we've exceeded the limit recently.


</td></tr>
<tr><td>

[overrunLimiterKey](./motion-sdk.motion.overrunlimiterkey.md)


</td><td>

`readonly`


</td><td>

string


</td><td>

Rate limiter key where overruns are tracked.


</td></tr>
<tr><td>

[requestLimiter](./motion-sdk.motion.requestlimiter.md)


</td><td>

`readonly`


</td><td>

RateLimiterAbstract


</td><td>

Rate limiter that tracks number of requests.


</td></tr>
<tr><td>

[requestLimiterKey](./motion-sdk.motion.requestlimiterkey.md)


</td><td>

`readonly`


</td><td>

string


</td><td>

Rate limiter key where requests are tracked.


</td></tr>
<tr><td>

[requestQueue](./motion-sdk.motion.requestqueue.md)


</td><td>

`readonly`


</td><td>

RateLimiterQueue


</td><td>

Request queue.


</td></tr>
<tr><td>

[userId](./motion-sdk.motion.userid.md)


</td><td>

`readonly`


</td><td>

string \| null


</td><td>

ID of the Motion user making the requests.


</td></tr>
</tbody></table>

## Methods

<table><thead><tr><th>

Method


</th><th>

Modifiers


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[close(reason, cause)](./motion-sdk.motion.close.md)


</td><td>


</td><td>

Terminate the client and free any associated resources.


</td></tr>
<tr><td>

[fetch(input, init)](./motion-sdk.motion.fetch.md)


</td><td>


</td><td>

Safe entry point to the HTTP layer.


</td></tr>
<tr><td>

[isOpen()](./motion-sdk.motion.isopen.md)


</td><td>


</td><td>

Status of the client.


</td></tr>
<tr><td>

[unsafe\_fetch(input, init)](./motion-sdk.motion.unsafe_fetch.md)


</td><td>


</td><td>

Low-level interface to the Motion API.


</td></tr>
</tbody></table>
