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

# Get ratings for an age

> Get ratings for a specific age

Given an age, this returns the recommended rating from **every** system at once — the fastest way to
map a child's age onto a concrete rating code per system.

```bash theme={null}
curl "https://phosra-api-sandbox-production.up.railway.app/api/v1/ratings/by-age?age=8"
```

```json Example response (live sandbox, truncated) theme={null}
{
  "csm":  { "system_id": "csm",  "code": "7+", "name": "Age 7+",   "min_age": 7, "restrictive_idx": 3 },
  "esrb": { "system_id": "esrb", "code": "E",  "name": "Everyone", "min_age": 0, "restrictive_idx": 1 }
}
```


## OpenAPI

````yaml GET /ratings/by-age
openapi: 3.1.0
info:
  title: Phosra API
  description: Universal Parental Controls API - Define once, push everywhere
  version: 1.0.0
  contact:
    name: Phosra Developer Support
    url: https://docs.phosra.com
  license:
    name: Proprietary
    url: https://phosra.com/terms
servers:
  - url: https://phosra-api-sandbox-production.up.railway.app/api/v1
    description: >-
      Hosted sandbox — the one canonical, stable, partner-facing testing
      endpoint (seeded demo family + phosra_test_ keys). Default so the inline
      Try it never touches production. Same base the CLI uses.
  - url: https://prodapi.phosra.com/api/v1
    description: Production
  - url: http://localhost:8080/api/v1
    description: Local development
security:
  - BearerAuth: []
paths:
  /ratings/by-age:
    get:
      tags:
        - Ratings
      summary: Get ratings for a specific age
      description: >-
        Returns the ratings considered age-appropriate for the supplied age
        across the supported rating systems.
      operationId: getRatingsForASpecificAge
      parameters:
        - name: age
          in: query
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Age-appropriate ratings across all systems
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgeRatings'
              example:
                csm:
                  id: 00000000-0000-0000-0005-000000000004
                  system_id: csm
                  code: 10+
                  name: Age 10+
                  description: Appropriate for ages 10 and up
                  min_age: 10
                  display_order: 4
                  restrictive_idx: 4
                esrb:
                  id: 00000000-0000-0000-0003-000000000002
                  system_id: esrb
                  code: E10+
                  name: Everyone 10+
                  description: Content generally suitable for ages 10 and up
                  min_age: 10
                  display_order: 2
                  restrictive_idx: 2
                mpaa:
                  id: 00000000-0000-0000-0001-000000000002
                  system_id: mpaa
                  code: PG
                  name: Parental Guidance
                  description: Some material may not be suitable for children
                  min_age: 0
                  display_order: 2
                  restrictive_idx: 2
                pegi:
                  id: 00000000-0000-0000-0004-000000000002
                  system_id: pegi
                  code: '7'
                  name: PEGI 7
                  description: Suitable for ages 7 and older
                  min_age: 7
                  display_order: 2
                  restrictive_idx: 2
                tvpg:
                  id: 00000000-0000-0000-0002-000000000004
                  system_id: tvpg
                  code: TV-PG
                  name: Parental Guidance Suggested
                  description: May contain some material parents find unsuitable
                  min_age: 0
                  display_order: 4
                  restrictive_idx: 2
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/ServerError'
      security: []
      x-codeSamples:
        - lang: JavaScript
          label: SDK (@phosra/sdk)
          source: |
            import { PhosraClient } from "@phosra/sdk";

            const phosra = new PhosraClient({
              baseUrl: "https://phosra-api-sandbox-production.up.railway.app/api/v1",
              accessToken: process.env.PHOSRA_API_KEY,
            });

            const result = await phosra.ratings.byAge(13);
            console.log(result);
        - lang: Shell
          label: cURL
          source: >
            curl -sS
            "https://phosra-api-sandbox-production.up.railway.app/api/v1/ratings/by-age?age=13"
        - lang: Python
          label: Python
          source: |
            import requests

            BASE = "https://phosra-api-sandbox-production.up.railway.app/api/v1"
            res = requests.get(
                f"{BASE}/ratings/by-age?age=13",
            )
            print(res.status_code, res.json())
        - lang: Go
          label: Go
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tbase := \"https://phosra-api-sandbox-production.up.railway.app/api/v1\"\n\treq, _ := http.NewRequest(\"GET\", base+\"/ratings/by-age?age=13\", nil)\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\tout, _ := io.ReadAll(resp.Body)\n\tfmt.Println(resp.Status, string(out))\n}\n"
components:
  schemas:
    AgeRatings:
      type: object
      properties:
        age:
          type: integer
          description: Child's age in years, derived from birth_date.
        ratings:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Rating'
          description: >-
            Map of rating-system slug to the age-appropriate Rating in that
            system.
      additionalProperties: true
    Rating:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for this resource.
        system_id:
          type: string
          description: Identifier of the associated system.
        code:
          type: string
          description: Short code for this rating tier or descriptor.
        name:
          type: string
          description: Human-readable display name.
        description:
          type: string
          description: Human-readable description.
        min_age:
          type: integer
          description: Minimum age (in years) this tier is appropriate for.
        display_order:
          type: integer
          description: Position of this rating within its system, lowest first.
        restrictive_idx:
          type: integer
          description: >-
            Relative strictness rank within the system; higher means more
            restrictive.
      additionalProperties: true
    Error:
      type: object
      properties:
        error:
          type: string
          description: >-
            Short, stable, machine-readable error class — matches the HTTP
            status text (e.g. `Not Found`).
        message:
          type: string
          description: >-
            Human-readable explanation of what went wrong and, where possible,
            how to fix it.
        code:
          type: integer
          description: Numeric HTTP status code, duplicated in the body for convenience.
      description: Standard error envelope returned for every 4xx and 5xx response.
      example:
        error: Not Found
        message: policy not found
        code: 404
      additionalProperties: true
  responses:
    Unauthorized:
      description: >-
        Authentication failed. Send a Bearer WorkOS JWT, or a
        `phosra_live_`/`phosra_test_` developer API key, in the `Authorization`
        header.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Unauthorized
            message: missing or invalid Authorization header
            code: 401
    RateLimited:
      description: >-
        Too many requests. Back off and retry after the interval given in the
        `Retry-After` response header.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Too Many Requests
            message: rate limit exceeded
            code: 429
    ServerError:
      description: >-
        An unexpected error occurred inside Phosra. The request is safe to retry
        with exponential backoff; contact support if it persists.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Internal Server Error
            message: internal error
            code: 500
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````