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

# listRepos()

> List all repositories in your organization with pagination support.

<CodeGroup>
  ```typescript TypeScript theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
  // List all repositories
  const repos = await store.listRepos();
  console.log(`Found ${repos.repos.length} repositories`);

  for (const repo of repos.repos) {
    console.log(`${repo.repoId}: ${repo.defaultBranch}`);
    if (repo.baseRepo) {
      console.log(`  Synced with: ${repo.baseRepo.owner}/${repo.baseRepo.name}`);
    }
  }

  // With pagination
  const page = await store.listRepos({
    limit: 20,
    cursor: repos.nextCursor,
  });

  // Filter by substring match against repo url
  const matches = await store.listRepos({ q: 'sdk' });

  // Iterate through all pages
  let cursor: string | undefined;
  do {
    const result = await store.listRepos({ limit: 50, cursor });
    for (const repo of result.repos) {
      console.log(repo.repoId);
    }
    cursor = result.nextCursor;
  } while (cursor);
  ```

  ```python Python theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
  # List all repositories
  repos = await storage.list_repos()
  print(f"Found {len(repos['repos'])} repositories")

  for repo in repos["repos"]:
      print(f"{repo['repo_id']}: {repo['default_branch']}")
      if repo.get("base_repo"):
          base = repo["base_repo"]
          print(f"  Synced with: {base['owner']}/{base['name']}")

  # With pagination
  page = await storage.list_repos(
      limit=20,
      cursor=repos.get("next_cursor"),
  )

  # Filter by substring match against repo url
  matches = await storage.list_repos(q="sdk")

  # Iterate through all pages
  cursor = None
  while True:
      result = await storage.list_repos(limit=50, cursor=cursor)
      for repo in result["repos"]:
          print(repo["repo_id"])
      cursor = result.get("next_cursor")
      if not cursor:
          break
  ```

  ```go Go theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
  ctx := context.Background()

  // List all repositories
  repos, err := client.ListRepos(ctx, storage.ListReposOptions{})
  fmt.Printf("Found %d repositories", len(repos.Repos))

  for _, repo := range repos.Repos {
  	fmt.Printf("%s: %s", repo.RepoID, repo.DefaultBranch)
  	if repo.BaseRepo != nil {
  		fmt.Printf("  Synced with: %s/%s", repo.BaseRepo.Owner, repo.BaseRepo.Name)
  	}
  }

  // With pagination
  page, err := client.ListRepos(ctx, storage.ListReposOptions{
  	Limit:  20,
  	Cursor: repos.NextCursor,
  })

  // Filter by substring match against repo url
  matches, err := client.ListRepos(ctx, storage.ListReposOptions{Q: "sdk"})

  // Iterate through all pages
  cursor := ""
  for {
  	result, err := client.ListRepos(ctx, storage.ListReposOptions{Limit: 50, Cursor: cursor})
  	for _, repo := range result.Repos {
  		fmt.Println(repo.RepoID)
  	}
  	if result.NextCursor == "" {
  		break
  	}
  	cursor = result.NextCursor
  }
  ```
</CodeGroup>

## Options

<ParamField path="cursor" type="string">
  Pagination cursor from a previous response
</ParamField>

<ParamField path="limit" type="string">
  Maximum repositories per page (default: 20, max: 100)
</ParamField>

<ParamField path="q" type="string">
  Case-insensitive substring matched against the repository `url`. Trimmed before matching. An empty
  value after trim is treated as omitted.
</ParamField>

<ParamField path="ttl" type="string">
  Token TTL for this invocation in seconds.
</ParamField>

## Response

<ResponseField name="repos" type="array">
  List of repository info objects
</ResponseField>

<ResponseField name="nextCursor" type="string">
  Cursor for the next page (absent when no more results)
</ResponseField>

<ResponseField name="hasMore" type="boolean">
  Whether more repositories exist
</ResponseField>

## Repository Info

<ResponseField name="repoId" type="string">
  Repository identifier
</ResponseField>

<ResponseField name="url" type="string">
  Repository URL
</ResponseField>

<ResponseField name="defaultBranch" type="string">
  Default branch name
</ResponseField>

<ResponseField name="createdAt" type="string">
  ISO 8601 creation timestamp
</ResponseField>

<ResponseField name="baseRepo" type="string">
  Git Sync configuration (provider, owner, name)
</ResponseField>
