# Get Portfolios in Graphql

This query returns a list of portfolios with basic fields.

---

[![Screenshot 2025-12-16 at 17.03.42.png](https://docs.finmars.com/uploads/images/gallery/2025-12/scaled-1680-/screenshot-2025-12-16-at-17-03-42.png)](https://docs.finmars.com/uploads/images/gallery/2025-12/screenshot-2025-12-16-at-17-03-42.png)

### GraphQL Query

```graphql
query GetPortfolioList {
  portfolio(
    pagination: {
      limit: 20
      offset: 0
    }
  ) {
    id
    user_code
    name,
    portfolio_type {
      pk
    }

  }
}
```

---

### Python Example

```python
import requests

url = "https://<domain_name>/<realm_code>/<space_code>/graphql/"

headers = {
    "Authorization": "Bearer <access_token>",
    "Content-Type": "application/json"
}

payload = {
    "query": """
    query GetPortfolioList {
      portfolio(
        pagination: {
          limit: 20
          offset: 0
        }
      ) {
        id
        user_code
        name
        portfolio_type {
          pk
        }
      }
    }
    """
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

---

### What This Query Does

- Fetches a paginated list of portfolios
- Returns core portfolio fields
- Includes portfolio currency
- Uses one GraphQL request

---