# Workspace

Check what a key can do, list the websites it covers, and read the semantic layer of metrics and dimensions.

Source: https://sourceloop.ai/help/api/workspace/

---

| Endpoint | Method | Path | Permission |
| --- | --- | --- | --- |
| Get key info | GET | `/v1/me` | any key |
| Get schema | GET | `/v1/schema` | any key |
| List websites | GET | `/v1/websites` | any key |

Base URL: `https://app.sourceloop.ai/api/v1`

## Get key info

`GET /v1/me`

What this key is and what it can do

Requires: any valid API key.

The first call to make. Returns the scopes, plan and websites this key reaches.

### Responses

- `200` Key identity
- `403` Something was wrong with the request or the credential.
- `429` Too many requests for this workspace in the current minute. Wait Retry-After seconds and repeat the request unchanged.

### Example (cURL)

```bash
curl -s -X GET "https://app.sourceloop.ai/api/v1/me" \
  -H "Authorization: Bearer $SOURCELOOP_API_KEY"
```

### Example (Node)

```javascript
const res = await fetch(
  "https://app.sourceloop.ai/api/v1/me",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.SOURCELOOP_API_KEY}`,
    },
  },
);

const data = await res.json();
```

### Example (Python)

```python
import os, requests

res = requests.get(
    "https://app.sourceloop.ai/api/v1/me",
    headers={"Authorization": f"Bearer {os.environ['SOURCELOOP_API_KEY']}"},
)
data = res.json()
```

## Get schema

`GET /v1/schema`

Every metric, dimension and filter operator

Requires: any valid API key.

Generated from the same registry the query compiler uses, so it cannot drift from behaviour. Read this instead of guessing names.

### Responses

- `200` Schema document
- `429` Too many requests for this workspace in the current minute. Wait Retry-After seconds and repeat the request unchanged.

### Example (cURL)

```bash
curl -s -X GET "https://app.sourceloop.ai/api/v1/schema" \
  -H "Authorization: Bearer $SOURCELOOP_API_KEY"
```

### Example (Node)

```javascript
const res = await fetch(
  "https://app.sourceloop.ai/api/v1/schema",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.SOURCELOOP_API_KEY}`,
    },
  },
);

const data = await res.json();
```

### Example (Python)

```python
import os, requests

res = requests.get(
    "https://app.sourceloop.ai/api/v1/schema",
    headers={"Authorization": f"Bearer {os.environ['SOURCELOOP_API_KEY']}"},
)
data = res.json()
```

## List websites

`GET /v1/websites`

Websites this key can reach

Requires: any valid API key.

With each one's timezone and currency, which every other response is expressed in.

### Responses

- `200` Websites
- `429` Too many requests for this workspace in the current minute. Wait Retry-After seconds and repeat the request unchanged.

### Example (cURL)

```bash
curl -s -X GET "https://app.sourceloop.ai/api/v1/websites" \
  -H "Authorization: Bearer $SOURCELOOP_API_KEY"
```

### Example (Node)

```javascript
const res = await fetch(
  "https://app.sourceloop.ai/api/v1/websites",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.SOURCELOOP_API_KEY}`,
    },
  },
);

const data = await res.json();
```

### Example (Python)

```python
import os, requests

res = requests.get(
    "https://app.sourceloop.ai/api/v1/websites",
    headers={"Authorization": f"Bearer {os.environ['SOURCELOOP_API_KEY']}"},
)
data = res.json()
```
