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

# Communities

> Get community metrics related to a project



## OpenAPI

````yaml get /impact/communities/{project_id}
openapi: 3.0.0
info:
  title: Terraspect API
  version: 0.0.2
servers:
  - url: https://api.terraspect.earth
    description: Production server
security: []
tags:
  - name: Projects
    description: Endpoints for retrieving project and developer information
  - name: Impact
    description: Endpoints for accessing impact and community metrics
  - name: Financials
    description: Endpoints for accessing financial data (some require extended permissions)
paths:
  /impact/communities/{project_id}:
    get:
      summary: Get Community Metrics
      description: Retrieves community participation metrics for a specific project
      operationId: getCommunitiesMetrics
      parameters:
        - name: project_id
          in: path
          required: true
          description: Unique identifier of the project
          schema:
            type: string
      responses:
        '200':
          description: Community metrics successfully retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommunityMetrics'
        '401':
          description: Authentication error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                missing_token:
                  summary: No token provided
                  value:
                    code: MISSING_TOKEN
                    message: No bearer token provided
                expired_token:
                  summary: Token expired
                  value:
                    code: TOKEN_EXPIRED
                    message: Token has expired. Please obtain a new token.
                invalid_token:
                  summary: Invalid token
                  value:
                    code: INVALID_TOKEN
                    message: Token is malformed or signature is invalid
        '404':
          description: Project not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - StandardAuth: []
components:
  schemas:
    CommunityMetrics:
      type: object
      required:
        - project_id
        - total_participants
        - breakdown_participants
        - breakdown_gender
      properties:
        project_id:
          type: string
          description: Project identifier
          example: proj_789012
        total_participants:
          type: integer
          description: Total number of project participants
          example: 1500
        breakdown_participants:
          type: object
          description: Detailed breakdown of participant types
          properties:
            indigenous_communities:
              type: integer
              example: 250
            smallholder_farmers:
              type: integer
              example: 800
            private_landowners:
              type: integer
              example: 100
            public_bodies:
              type: integer
              example: 5
            individuals:
              type: integer
              example: 300
            community_groups:
              type: integer
              example: 25
            supervisors:
              type: integer
              example: 20
        breakdown_gender:
          type: object
          required:
            - men_percentage
            - men_number
            - women_percentage
            - women_number
          properties:
            men_percentage:
              type: number
              description: Percentage of male participants
              minimum: 0
              maximum: 100
              example: 45.5
            men_number:
              type: integer
              description: Number of male participants
              example: 682
            women_percentage:
              type: number
              description: Percentage of female participants
              minimum: 0
              maximum: 100
              example: 54.5
            women_number:
              type: integer
              description: Number of female participants
              example: 818
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Error code for machine processing
          example: INVALID_PROJECT_ID
        message:
          type: string
          description: Human-readable error message
          example: The provided project ID does not exist
        details:
          type: object
          description: Additional error details when available
          nullable: true
  securitySchemes:
    StandardAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        Standard access token, in the format `Authorization: Bearer <token>`

````