0

Get the authenticated account

by
Published Oct 17, 2025

Returns information about the user or organization associated with the provided API token. Example cURL request: ```console curl -s \ -H "Authorization: Bearer $REPLICATE_API_TOKEN" \ https://api.replicate.com/v1/account ``` The response will be a JSON object describing the account: ```json { "type": "organization", "username": "acme", "name": "Acme Corp, Inc.", "github_url": "https://github.com/acme", } ```

Script replicate Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Replicate = {
3
  token: string;
4
};
5
/**
6
 * Get the authenticated account
7
 * Returns information about the user or organization associated with the provided API token.
8

9
Example cURL request:
10

11
```console
12
curl -s \
13
  -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
14
  https://api.replicate.com/v1/account
15
```
16

17
The response will be a JSON object describing the account:
18

19
```json
20
{
21
  "type": "organization",
22
  "username": "acme",
23
  "name": "Acme Corp, Inc.",
24
  "github_url": "https://github.com/acme",
25
}
26
```
27

28
 */
29
export async function main(auth: Replicate) {
30
  const url = new URL(`https://api.replicate.com/v1/account`);
31

32
  const response = await fetch(url, {
33
    method: "GET",
34
    headers: {
35
      Authorization: "Bearer " + auth.token,
36
    },
37
    body: undefined,
38
  });
39
  if (!response.ok) {
40
    const text = await response.text();
41
    throw new Error(`${response.status} ${text}`);
42
  }
43
  return await response.json();
44
}
45