> ## Documentation Index
> Fetch the complete documentation index at: https://openrouter.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# ExternalUsers

> External Users endpoints

## Overview

External Users endpoints

### Available Operations

* [list](#list) - List registered external users
* [create](#create) - Register an external user
* [delete](#delete) - Deactivate a registered external user
* [get](#get) - Get a registered external user
* [update](#update) - Update a registered external user

## list

List registrations belonging to the authenticated organization. Inactive registrations are excluded by default. [Management key](/docs/client-sdks/typescript/docs/guides/overview/auth/management-api-keys) required.

### Example Usage

```typescript theme={null}
import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const result = await openRouter.externalUsers.list();

  for await (const page of result) {
    console.log(page);
  }
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { externalUsersList } from "@openrouter/sdk/funcs/externalUsersList.js";

// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const res = await externalUsersList(openRouter);
  if (res.ok) {
    const { value: result } = res;
    for await (const page of result) {
    console.log(page);
  }
  } else {
    console.log("externalUsersList failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `request` | [operations.ListExternalUsersRequest](../../models/operations/listexternalusersrequest.mdx) | ✔️ | The request object to use for the request. |
| `options` | RequestOptions | ➖ | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | ➖ | Enables retrying HTTP requests under certain failure conditions. |

### Response

**Promise\<[operations.ListExternalUsersResponse](../../models/operations/listexternalusersresponse.mdx)>**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |

## create

Register a caller-supplied tracking ID under the authenticated organization. No login account, policy, or credentials are created. [Management key](/docs/client-sdks/typescript/docs/guides/overview/auth/management-api-keys) required.

### Example Usage

```typescript theme={null}
import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const result = await openRouter.externalUsers.create({
    createExternalUserRequest: {
      user: "employee_123",
    },
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { externalUsersCreate } from "@openrouter/sdk/funcs/externalUsersCreate.js";

// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const res = await externalUsersCreate(openRouter, {
    createExternalUserRequest: {
      user: "employee_123",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("externalUsersCreate failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `request` | [operations.CreateExternalUserRequest](../../models/operations/createexternaluserrequest.mdx) | ✔️ | The request object to use for the request. |
| `options` | RequestOptions | ➖ | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | ➖ | Enables retrying HTTP requests under certain failure conditions. |

### Response

**Promise\<[models.ExternalUserResponse](../../models/externaluserresponse.mdx)>**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.ConflictResponseError | 409 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |

## delete

Soft-deactivate a registration while retaining its tracking ID. Repeat deactivation succeeds. This does not block inference; reactivate through PATCH. [Management key](/docs/client-sdks/typescript/docs/guides/overview/auth/management-api-keys) required.

### Example Usage

```typescript theme={null}
import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  await openRouter.externalUsers.delete({
    user: "employee_123",
  });


}

run();
```

### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { externalUsersDelete } from "@openrouter/sdk/funcs/externalUsersDelete.js";

// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const res = await externalUsersDelete(openRouter, {
    user: "employee_123",
  });
  if (res.ok) {
    const { value: result } = res;
    
  } else {
    console.log("externalUsersDelete failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `request` | [operations.DeleteExternalUserRequest](../../models/operations/deleteexternaluserrequest.mdx) | ✔️ | The request object to use for the request. |
| `options` | RequestOptions | ➖ | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | ➖ | Enables retrying HTTP requests under certain failure conditions. |

### Response

**Promise\<void>**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |

## get

Retrieve an active or inactive registration by its URL-encoded, caller-supplied tracking ID. [Management key](/docs/client-sdks/typescript/docs/guides/overview/auth/management-api-keys) required.

### Example Usage

```typescript theme={null}
import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const result = await openRouter.externalUsers.get({
    user: "employee_123",
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { externalUsersGet } from "@openrouter/sdk/funcs/externalUsersGet.js";

// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const res = await externalUsersGet(openRouter, {
    user: "employee_123",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("externalUsersGet failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `request` | [operations.GetExternalUserRequest](../../models/operations/getexternaluserrequest.mdx) | ✔️ | The request object to use for the request. |
| `options` | RequestOptions | ➖ | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | ➖ | Enables retrying HTTP requests under certain failure conditions. |

### Response

**Promise\<[models.ExternalUserResponse](../../models/externaluserresponse.mdx)>**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |

## update

Update registration state without changing identity. State changes do not enforce inference access. [Management key](/docs/client-sdks/typescript/docs/guides/overview/auth/management-api-keys) required.

### Example Usage

```typescript theme={null}
import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const result = await openRouter.externalUsers.update({
    user: "employee_123",
    updateExternalUserRequest: {
      isActive: true,
    },
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { externalUsersUpdate } from "@openrouter/sdk/funcs/externalUsersUpdate.js";

// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const res = await externalUsersUpdate(openRouter, {
    user: "employee_123",
    updateExternalUserRequest: {
      isActive: true,
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("externalUsersUpdate failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `request` | [operations.UpdateExternalUserRequest](../../models/operations/updateexternaluserrequest.mdx) | ✔️ | The request object to use for the request. |
| `options` | RequestOptions | ➖ | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | ➖ | Enables retrying HTTP requests under certain failure conditions. |

### Response

**Promise\<[models.ExternalUserResponse](../../models/externaluserresponse.mdx)>**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
