# org.cairnsproto.draft.getBadges

> A participant's badges, each computed from the latest snapshot a project maintainer published.

- Kind: query
- Authority: draft.cairnsproto.org
- Lexicon: 1
- Published by [cairnsproto.org](https://lexicon.garden/identity/did:plc:np7ezqujtsry4bkogisaabul), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:np7ezqujtsry4bkogisaabul/org.cairnsproto.draft.getBadges)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:np7ezqujtsry4bkogisaabul/org.cairnsproto.draft.getBadges/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:np7ezqujtsry4bkogisaabul/org.cairnsproto.draft.getBadges/analytics)

## Query (`org.cairnsproto.draft.getBadges`)

Type: query · GET

### Parameters (query string)

- `actor` (string · did, required)
- `project` (string · at-uri): Limit to one project.

### Output (application/json)

- `actor` (string · did, required)
- `badges` (array, required)
  - `items` (ref)
    - Reference: `#badgeView`

## #badgeView (`org.cairnsproto.draft.getBadges#badgeView`)

Type: object

### Properties

- `date` (string · datetime, required): The snapshot's createdAt.
- `export` (ref): For published/v1, the merged export the badge comes from.
  - Reference: `com.atproto.repo.strongRef`
- `members` (array): For an org's badge rolled up from its members, the members who hold it.
  - `items` (string · did)
- `n` (integer): The rank cutoff, for top/v1.
  - Constraints: minimum: 1
- `project` (ref, required)
  - Reference: `com.atproto.repo.strongRef`
- `rule` (string, required): The versioned rule, such as contributor/v1 or top/v1.
  - Constraints: maxLength: 64
- `snapshot` (ref, required)
  - Reference: `com.atproto.repo.strongRef`
- `stones` (array, required): The stones whose finalized credit earned the badge.
  - `items` (ref)
    - Reference: `com.atproto.repo.strongRef`

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "badgeView": {
      "properties": {
        "date": {
          "description": "The snapshot's createdAt.",
          "format": "datetime",
          "type": "string"
        },
        "export": {
          "description": "For published/v1, the merged export the badge comes from.",
          "ref": "com.atproto.repo.strongRef",
          "type": "ref"
        },
        "members": {
          "description": "For an org's badge rolled up from its members, the members who hold it.",
          "items": {
            "format": "did",
            "type": "string"
          },
          "type": "array"
        },
        "n": {
          "description": "The rank cutoff, for top/v1.",
          "minimum": 1,
          "type": "integer"
        },
        "project": {
          "ref": "com.atproto.repo.strongRef",
          "type": "ref"
        },
        "rule": {
          "description": "The versioned rule, such as contributor/v1 or top/v1.",
          "maxLength": 64,
          "type": "string"
        },
        "snapshot": {
          "ref": "com.atproto.repo.strongRef",
          "type": "ref"
        },
        "stones": {
          "description": "The stones whose finalized credit earned the badge.",
          "items": {
            "ref": "com.atproto.repo.strongRef",
            "type": "ref"
          },
          "type": "array"
        }
      },
      "required": [
        "rule",
        "project",
        "snapshot",
        "date",
        "stones"
      ],
      "type": "object"
    },
    "main": {
      "description": "A participant's badges, each computed from the latest snapshot a project maintainer published.",
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "actor": {
              "format": "did",
              "type": "string"
            },
            "badges": {
              "items": {
                "ref": "#badgeView",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "actor",
            "badges"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "actor": {
            "format": "did",
            "type": "string"
          },
          "project": {
            "description": "Limit to one project.",
            "format": "at-uri",
            "type": "string"
          }
        },
        "required": [
          "actor"
        ],
        "type": "params"
      },
      "type": "query"
    }
  },
  "id": "org.cairnsproto.draft.getBadges",
  "lexicon": 1
}
```
