---
title: "Count Revisions"
url: "https://docs.ravendb.net/6.2/document-extensions/revisions/client-api/session/counting"
version: "6.2"
language: "csharp"
---

# Count Revisions

> Client language: C#. Also available for [Python](https://docs.ravendb.net/6.2/document-extensions/revisions/client-api/session/counting.python.md), [PHP](https://docs.ravendb.net/6.2/document-extensions/revisions/client-api/session/counting.php.md), [Node.js](https://docs.ravendb.net/6.2/document-extensions/revisions/client-api/session/counting.nodejs.md).
>
> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

> **Note**
>
> - You can get the number of revisions a document has by using the advance session method `GetCountFor`.
>
> - In this page:
>   - [Get revisions count](#get-revisions-count)
>   - [syntax](#syntax)

## Get revisions count

### Sync

```csharp
// Get the number of revisions for document 'companies/1-A"
var revisionsCount = session.Advanced.Revisions.GetCountFor("companies/1-A");
```

### Async

```csharp
// Get the number of revisions for document 'companies/1-A"
var revisionsCount = await asyncSession.Advanced.Revisions.GetCountForAsync("companies/1-A");
```

## Syntax

```csharp
long GetCountFor(string id);
```

| Parameter | Type | Description |
| - | - | - |
| **id** | string | Document ID for which revisions are counted |

| Return value | |
| - | - |
| `long` | The number of revisions for the specified document |

## See also

- [Document Revisions Overview](https://docs.ravendb.net/6.2/document-extensions/revisions/overview.md)
- [Revert Revisions](https://docs.ravendb.net/6.2/document-extensions/revisions/revert-documents-to-revisions/revert-documents-to-specific-time.md)
- [Revisions and Other Features](https://docs.ravendb.net/6.2/document-extensions/revisions/revisions-and-other-features.md)
- [Revisions: API Overview](https://docs.ravendb.net/6.2/document-extensions/revisions/client-api/overview.md)
- [Operations: Configuring Revisions](https://docs.ravendb.net/6.2/document-extensions/revisions/client-api/operations/configure-revisions.md)
- [Session: Loading Revisions](https://docs.ravendb.net/6.2/document-extensions/revisions/client-api/session/loading.md)
- [Session: Including Revisions](https://docs.ravendb.net/6.2/document-extensions/revisions/client-api/session/including.md)
- [Settings: Document Revisions](https://docs.ravendb.net/6.2/studio/database/settings/document-revisions.md)
- [Document Extensions: Revisions](https://docs.ravendb.net/6.2/studio/database/settings/document-revisions.md)
