- List - Get a list of machines for an instance
- Create - Create a machine
- Get - Retrieve a machine
- Update - Update a machine
- Delete - Delete a machine
- GetSecretKey - Retrieve a machine secret key
- RotateSecretKey - Rotate a machine's secret key
- CreateScope - Create a machine scope
- DeleteScope - Delete a machine scope
This request returns the list of machines for an instance. The machines are ordered by descending creation date (i.e. most recent machines will be returned first)
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.Machines.ListAsync(
limit: 20,
offset: 10,
orderBy: "-created_at"
);
// handle response| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
Limit |
long | ➖ | Applies a limit to the number of results returned. Can be used for paginating the results together with offset. |
20 |
Offset |
long | ➖ | Skip the first offset results when paginating.Needs to be an integer greater or equal to zero. To be used in conjunction with limit. |
10 |
Query |
string | ➖ | Returns machines with ID or name that match the given query. Uses exact match for machine ID and partial match for name. | |
OrderBy |
string | ➖ | Allows to return machines in a particular order. You can order the returned machines by their name or created_at.To specify the direction, use the + or - symbols prepended to the property to order by.For example, to return machines in descending order by created_at, use -created_at.If you don't use + or -, then + is implied.Defaults to -created_at. |
| Error Type | Status Code | Content Type |
|---|---|---|
| Clerk.BackendAPI.Models.Errors.ClerkErrors | 400, 401, 403, 422 | application/json |
| Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Creates a new machine.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
using Clerk.BackendAPI.Models.Operations;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
CreateMachineRequestBody? req = null;
var res = await sdk.Machines.CreateAsync(req);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
request |
CreateMachineRequestBody | ✔️ | The request object to use for the request. |
| Error Type | Status Code | Content Type |
|---|---|---|
| Clerk.BackendAPI.Models.Errors.ClerkErrors | 400, 401, 403, 422 | application/json |
| Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Returns the details of a machine.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.Machines.GetAsync(machineId: "<id>");
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
MachineId |
string | ✔️ | The ID of the machine to retrieve |
| Error Type | Status Code | Content Type |
|---|---|---|
| Clerk.BackendAPI.Models.Errors.ClerkErrors | 400, 401, 403, 404, 422 | application/json |
| Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Updates an existing machine. Only the provided fields will be updated.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.Machines.UpdateAsync(machineId: "<id>");
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
MachineId |
string | ✔️ | The ID of the machine to update |
RequestBody |
UpdateMachineRequestBody | ➖ | N/A |
| Error Type | Status Code | Content Type |
|---|---|---|
| Clerk.BackendAPI.Models.Errors.ClerkErrors | 400, 401, 403, 404, 422 | application/json |
| Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Deletes a machine.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.Machines.DeleteAsync(machineId: "<id>");
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
MachineId |
string | ✔️ | The ID of the machine to delete |
| Error Type | Status Code | Content Type |
|---|---|---|
| Clerk.BackendAPI.Models.Errors.ClerkErrors | 400, 401, 403, 404, 422 | application/json |
| Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Returns the secret key for a machine.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.Machines.GetSecretKeyAsync(machineId: "<id>");
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
MachineId |
string | ✔️ | The ID of the machine to retrieve the secret key for |
| Error Type | Status Code | Content Type |
|---|---|---|
| Clerk.BackendAPI.Models.Errors.ClerkErrors | 400, 401, 403, 404 | application/json |
| Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Rotates the machine's secret key. When the secret key is rotated, make sure to update it in your machine/application. The previous secret key will remain valid for the duration specified by the previous_token_ttl parameter.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
using Clerk.BackendAPI.Models.Operations;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.Machines.RotateSecretKeyAsync(
machineId: "<id>",
requestBody: new RotateMachineSecretKeyRequestBody() {
PreviousTokenTtl = 632625,
}
);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
MachineId |
string | ✔️ | The ID of the machine to rotate the secret key for |
RequestBody |
RotateMachineSecretKeyRequestBody | ✔️ | N/A |
RotateMachineSecretKeyResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Clerk.BackendAPI.Models.Errors.ClerkErrors | 400, 401, 403, 404, 422 | application/json |
| Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Creates a new machine scope, allowing the specified machine to access another machine. Maximum of 150 scopes per machine.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.Machines.CreateScopeAsync(machineId: "<id>");
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
MachineId |
string | ✔️ | The ID of the machine that will have access to another machine |
RequestBody |
CreateMachineScopeRequestBody | ➖ | N/A |
| Error Type | Status Code | Content Type |
|---|---|---|
| Clerk.BackendAPI.Models.Errors.ClerkErrors | 400, 401, 403, 404, 409, 422 | application/json |
| Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Deletes a machine scope, removing access from one machine to another.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.Machines.DeleteScopeAsync(
machineId: "<id>",
otherMachineId: "<id>"
);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
MachineId |
string | ✔️ | The ID of the machine that has access to another machine |
OtherMachineId |
string | ✔️ | The ID of the machine that is being accessed |
| Error Type | Status Code | Content Type |
|---|---|---|
| Clerk.BackendAPI.Models.Errors.ClerkErrors | 400, 401, 403, 404, 422 | application/json |
| Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |