# get\_\_workspace

`GET /workspace`

*Get All Workspaces*

Retrieve all workspaces that the authenticated user can access. This includes workspaces where the user has READ, WRITE, or ADMIN access.

#### TypeScript Client Library

```typescript
public getWorkspaces = async (): Promise<WorkspaceTypes.GetWorkspacesResponse> => {
  return this.makeRequest<WorkspaceTypes.GetWorkspacesResponse>('workspace', 'GET', null);
};
```

#### Code Samples

{% tabs %}
{% tab title="Shell" %}

```shell
# You can also use wget
curl -X GET https://backend.flashback.tech/workspace \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'
```

{% endtab %}

{% tab title="HTTP" %}

```http
GET https://backend.flashback.tech/workspace HTTP/1.1
Host: backend.flashback.tech
Accept: application/json
Authorization: Bearer {access-token}
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('https://backend.flashback.tech/workspace',
{
  method: 'GET',
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'rest-client'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.get 'https://backend.flashback.tech/workspace',
  headers: headers

p JSON.parse(result)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('https://backend.flashback.tech/workspace', 
                 headers=headers)

print(r.json())
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://backend.flashback.tech/workspace', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }
```

{% endtab %}

{% tab title="Java" %}

```java
URL obj = new URL("https://backend.flashback.tech/workspace");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("Authorization", "Bearer {access-token}");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
       "net/http"
)

func main() {
    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    req, err := http.NewRequest("GET", "https://backend.flashback.tech/workspace", nil)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}
```

{% endtab %}
{% endtabs %}

#### Parameters <a href="#get__workspace-parameters" id="get__workspace-parameters"></a>

This endpoint does not require any parameters.

> Example responses

> 200 Response

```json
{
  "success": true,
  "workspaces": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "name": "Development Workspace",
      "orgId": "987fcdeb-51a2-43d1-9f12-345678901234",
      "users": [
        {
          "userId": "user-123",
          "role": "ADMIN",
          "user": {
            "id": "user-123",
            "name": "John",
            "lastName": "Doe",
            "email": "john.doe@example.com",
            "orgRole": 1
          }
        },
        {
          "userId": "user-456",
          "role": "WRITE",
          "user": {
            "id": "user-456",
            "name": "Jane",
            "lastName": "Smith",
            "email": "jane.smith@example.com",
            "orgRole": 2
          }
        }
      ]
    },
    {
      "id": "456e7890-e89b-12d3-a456-426614174001",
      "name": "Production Workspace",
      "orgId": "987fcdeb-51a2-43d1-9f12-345678901234",
      "users": [
        {
          "userId": "user-123",
          "role": "READ",
          "user": {
            "id": "user-123",
            "name": "John",
            "lastName": "Doe",
            "email": "john.doe@example.com",
            "orgRole": 1
          }
        }
      ]
    }
  ]
}
```

> 404 Response

```json
{
  "success": false,
  "message": "User not found"
}
```

> 500 Response

```json
{
  "success": false,
  "message": "Failed to fetch workspaces"
}
```

#### Responses <a href="#get__workspace-responses" id="get__workspace-responses"></a>

| Status | Meaning                                                                    | Description                       | Schema |
| ------ | -------------------------------------------------------------------------- | --------------------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)                    | Workspaces retrieved successfully | Inline |
| 404    | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)             | User not found                    | Inline |
| 500    | [Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) | Server error                      | Inline |

#### Response Schema <a href="#get__workspace-responseschema" id="get__workspace-responseschema"></a>

Status Code **200**

| Name          | Type    | Required | Restrictions | Description                                       |
| ------------- | ------- | -------- | ------------ | ------------------------------------------------- |
| » success     | boolean | true     | none         | Operation success status                          |
| » workspaces  | array   | true     | none         | Array of accessible workspaces                    |
| »» id         | string  | true     | none         | Unique workspace identifier                       |
| »» name       | string  | true     | none         | Workspace name                                    |
| »» orgId      | string  | true     | none         | Organization identifier                           |
| »» users      | array   | true     | none         | Array of users with access to the workspace       |
| »»» userId    | string  | true     | none         | User identifier                                   |
| »»» role      | string  | true     | none         | User's role in the workspace (READ, WRITE, ADMIN) |
| »»» user      | object  | true     | none         | User details                                      |
| »»»» id       | string  | true     | none         | User identifier                                   |
| »»»» name     | string  | true     | none         | User's first name                                 |
| »»»» lastName | string  | true     | none         | User's last name                                  |
| »»»» email    | string  | true     | none         | User's email address                              |
| »»»» orgRole  | integer | false    | none         | User's organization role                          |

Status Code **404**

| Name      | Type    | Required | Restrictions | Description              |
| --------- | ------- | -------- | ------------ | ------------------------ |
| » success | boolean | true     | none         | Operation success status |
| » message | string  | true     | none         | Error message            |

Status Code **500**

| Name      | Type    | Required | Restrictions | Description              |
| --------- | ------- | -------- | ------------ | ------------------------ |
| » success | boolean | true     | none         | Operation success status |
| » message | string  | true     | none         | Error message            |

## Notes

* **Authentication Required**: User must be authenticated with a valid Bearer token
* **Access Control**: Only returns workspaces where the user has access (READ, WRITE, or ADMIN role)
* **User Details**: Includes detailed information about all users with access to each workspace
* **Role Information**: Shows the specific role each user has within each workspace
* **Organization Scoped**: Workspaces are scoped to the user's organization


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flashback.tech/support-reference/platform-api-reference/workspace/get__workspace.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
