Ctrl K
ComunidadGuías…

docs/api/ScorecardService.openapi.yaml

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
openapi: 3.1.0
info:
    title: ScorecardService API
    version: 1.0.0
security:
    - WorldMonitorKey: []
    - ApiKeyHeader: []
servers:
    - url: https://api.worldmonitor.app
paths:
    /api/scorecard/v1/get-five-factor-scorecard:
        get:
            tags:
                - ScorecardService
            summary: GetFiveFactorScorecard
            description: GetFiveFactorScorecard returns one country's 1-5 scores for food, energy, demographics, technology and defense, with per-pillar input evidence and coverage.
            operationId: GetFiveFactorScorecard
            security: []
            parameters:
                - name: countryCode
                  in: query
                  description: ISO 3166-1 alpha-2 country code for the requested scorecard.
                  required: true
                  example: "US"
                  schema:
                    type: string
                    pattern: '^[A-Z]{2}$'
                - name: jmespath
                  in: query
                  description: |-
                    Optional JMESPath expression applied server-side to project or reduce the JSON response before it is returned (mirrors the MCP jmespath argument). Invalid expressions, expressions larger than 1024 UTF-8 bytes, or projections that exceed the 256 KB output cap return HTTP 400 with a {_jmespath_error, original_keys} envelope. Grammar and worked examples: https://www.worldmonitor.app/docs/mcp-jmespath.
                  required: false
                  example: "keys(@)"
                  schema:
                    type: string
            responses:
                "200":
                    description: Successful response
                    content:
                        application/json:
                            example:
                                "scorecard":
                                    "computedAt": "2026-01-15T12:00:00Z"
                                    "countryCode": "US"
                                    "methodologyVersion": "1.0.0"
                                    "pillars":
                                        - "aggregationMethod": "country-weighted-components"
                                          "band": "mixed-capability"
                                          "excludedMembers":
                                              - "countryCode": "US"
                                                "reason": "source-unavailable"
                                          "hasScore": true
                                          "includedMembers":
                                              - "US"
                                          "inputCoverage": 1
                                          "inputs":
                                              - "available": true
                                                "countryCode": ""
                                                "hasValue": true
                                                "inputId": "example-id"
                                                "observations":
                                                    - "indicatorCode": "IT.NET.USER.ZS"
                                                      "name": "internetUsePercent"
                                                      "source": "World Bank"
                                                      "unit": "percent"
                                                      "value": 92.4
                                                      "year": 2025
                                                "quality": "observed"
                                                "source": "example"
                                                "sourceKey": "example"
                                                "unavailableReason": ""
                                                "unit": "example"
                                                "value": 1.5
                                                "year": 1
                                          "insufficientReasons":
                                              - "source-unavailable"
                                          "memberWeights":
                                              - "countryCode": "US"
                                                "hasPopulation": true
                                                "populationMillions": 1.5
                                          "pillar": "food"
                                          "score": 3
                                          "subScore": 42.5
                                "unavailable": false
                                "unavailableReason": ""
                            schema:
                                $ref: '#/components/schemas/GetFiveFactorScorecardResponse'
                "400":
                    description: Validation error
                    content:
                        application/json:
                            schema:
                                oneOf:
                                    - $ref: '#/components/schemas/ValidationError'
                                    - $ref: '#/components/schemas/JmespathProjectionError'
                "429":
                    description: Rate limit exceeded.
                    headers:
                        X-RateLimit-Limit:
                            description: Maximum requests allowed in the active rate-limit window.
                            schema:
                                type: string
                        X-RateLimit-Remaining:
                            description: Requests remaining in the active rate-limit window.
                            schema:
                                type: string
                        X-RateLimit-Reset:
                            description: Unix epoch milliseconds when the active rate-limit window resets.
                            schema:
                                type: string
                        Retry-After:
                            description: Seconds to wait before retrying the request.
                            schema:
                                type: string
                    content:
                        application/json:
                            schema:
                                oneOf:
                                    - $ref: '#/components/schemas/Error'
                                    - $ref: '#/components/schemas/RateLimitError'
                default:
                    description: Gateway or handler error response.
                    content:
                        application/json:
                            schema:
                                oneOf:
                                    - $ref: '#/components/schemas/Error'
                                    - $ref: '#/components/schemas/GatewayError'
    /api/scorecard/v1/list-five-factor-scorecards:
        get:
            tags:
                - ScorecardService
            summary: ListFiveFactorScorecards
            description: ListFiveFactorScorecards returns pillar scores, bands and input coverage for every country in the seeded five-factor snapshot, plus methodology version.
            operationId: ListFiveFactorScorecards
            security: []
            parameters:
                - name: jmespath
                  in: query
                  description: |-
                    Optional JMESPath expression applied server-side to project or reduce the JSON response before it is returned (mirrors the MCP jmespath argument). Invalid expressions, expressions larger than 1024 UTF-8 bytes, or projections that exceed the 256 KB output cap return HTTP 400 with a {_jmespath_error, original_keys} envelope. Grammar and worked examples: https://www.worldmonitor.app/docs/mcp-jmespath.
                  required: false
                  example: "keys(@)"
                  schema:
                    type: string
            responses:
                "200":
                    description: Successful response
                    content:
                        application/json:
                            example:
                                "computedAt": "2026-01-15T12:00:00Z"
                                "methodologyVersion": "1.0.0"
                                "scorecards":
                                    - "countryCode": "US"
                                      "pillars":
                                          - "band": "mixed-capability"
                                            "hasScore": true
                                            "inputCoverage": 1
                                            "insufficientReasons":
                                                - "source-unavailable"
                                            "pillar": "food"
                                            "score": 3
                                            "subScore": 42.5
                                "unavailable": false
                                "unavailableReason": ""
                            schema:
                                $ref: '#/components/schemas/ListFiveFactorScorecardsResponse'
                "400":
                    description: Validation error
                    content:
                        application/json:
                            schema:
                                oneOf:
                                    - $ref: '#/components/schemas/ValidationError'
                                    - $ref: '#/components/schemas/JmespathProjectionError'
                "429":
                    description: Rate limit exceeded.
                    headers:
                        X-RateLimit-Limit:
                            description: Maximum requests allowed in the active rate-limit window.
                            schema:
                                type: string
                        X-RateLimit-Remaining:
                            description: Requests remaining in the active rate-limit window.
                            schema:
                                type: string
                        X-RateLimit-Reset:
                            description: Unix epoch milliseconds when the active rate-limit window resets.
                            schema:
                                type: string
                        Retry-After:
                            description: Seconds to wait before retrying the request.
                            schema:
                                type: string
                    content:
                        application/json:
                            schema:
                                oneOf:
                                    - $ref: '#/components/schemas/Error'
                                    - $ref: '#/components/schemas/RateLimitError'
                default:
                    description: Gateway or handler error response.
                    content:
                        application/json:
                            schema:
                                oneOf:
                                    - $ref: '#/components/schemas/Error'
                                    - $ref: '#/components/schemas/GatewayError'
    /api/scorecard/v1/get-bloc-scorecard:
        get:
            tags:
                - ScorecardService
            summary: GetBlocScorecard
            description: GetBlocScorecard aggregates five-factor pillar scores for a preset bloc such as EU27, NATO or BRICS, or 2-30 custom countries, listing excluded members.
            operationId: GetBlocScorecard
            security: []
            parameters:
                - name: preset
                  in: query
                  description: 'Official bloc preset: USMCA, EU27, BRICS, GCC, ASEAN, or NATO. Values are case-sensitive. Omit when members is provided.'
                  required: false
                  example: "NATO"
                  schema:
                    type: string
                    pattern: '^(?:|USMCA|EU27|BRICS|GCC|ASEAN|NATO)$'
                - name: members
                  in: query
                  description: Custom list of 2-30 unique uppercase ISO 3166-1 alpha-2 members. Provide either preset or members; do not provide both.
                  required: false
                  style: form
                  explode: true
                  example:
                      - "US"
                  schema:
                    type: array
                    items:
                        type: string
                        pattern: ^[A-Z]{2}$
                    minItems: 2
                    maxItems: 30
                    uniqueItems: true
                - name: jmespath
                  in: query
                  description: |-
                    Optional JMESPath expression applied server-side to project or reduce the JSON response before it is returned (mirrors the MCP jmespath argument). Invalid expressions, expressions larger than 1024 UTF-8 bytes, or projections that exceed the 256 KB output cap return HTTP 400 with a {_jmespath_error, original_keys} envelope. Grammar and worked examples: https://www.worldmonitor.app/docs/mcp-jmespath.
                  required: false
                  example: "keys(@)"
                  schema:
                    type: string
            x-worldmonitor-selector-one-of:
                - preset
                - members
            responses:
                "200":
                    description: Successful response
                    content:
                        application/json:
                            example:
                                "scorecard":
                                    "computedAt": "2026-01-15T12:00:00Z"
                                    "excludedMembers":
                                        - "countryCode": "US"
                                          "reason": "source-unavailable"
                                    "id": "example-id"
                                    "includedMembers":
                                        - "US"
                                    "label": "example"
                                    "members":
                                        - "US"
                                    "methodologyVersion": "1.0.0"
                                    "pillars":
                                        - "aggregationMethod": "country-weighted-components"
                                          "band": "mixed-capability"
                                          "excludedMembers":
                                              - "countryCode": "US"
                                                "reason": "source-unavailable"
                                          "hasScore": true
                                          "includedMembers":
                                              - "US"
                                          "inputCoverage": 1
                                          "inputs":
                                              - "available": true
                                                "countryCode": ""
                                                "hasValue": true
                                                "inputId": "example-id"
                                                "observations":
                                                    - "indicatorCode": "IT.NET.USER.ZS"
                                                      "name": "internetUsePercent"
                                                      "source": "World Bank"
                                                      "unit": "percent"
                                                      "value": 92.4
                                                      "year": 2025
                                                "quality": "observed"
                                                "source": "example"
                                                "sourceKey": "example"
                                                "unavailableReason": ""
                                                "unit": "example"
                                                "value": 1.5
                                                "year": 1
                                          "insufficientReasons":
                                              - "source-unavailable"
                                          "memberWeights":
                                              - "countryCode": "US"
                                                "hasPopulation": true
                                                "populationMillions": 1.5
                                          "pillar": "food"
                                          "score": 3
                                          "subScore": 42.5
                                "unavailable": false
                                "unavailableReason": ""
                            schema:
                                $ref: '#/components/schemas/GetBlocScorecardResponse'
                "400":
                    description: Validation error
                    content:
                        application/json:
                            schema:
                                oneOf:
                                    - $ref: '#/components/schemas/ValidationError'
                                    - $ref: '#/components/schemas/JmespathProjectionError'
                "429":
                    description: Rate limit exceeded.
                    headers:
                        X-RateLimit-Limit:
                            description: Maximum requests allowed in the active rate-limit window.
                            schema:
                                type: string
                        X-RateLimit-Remaining:
                            description: Requests remaining in the active rate-limit window.
                            schema:
                                type: string
                        X-RateLimit-Reset:
                            description: Unix epoch milliseconds when the active rate-limit window resets.
                            schema:
                                type: string
                        Retry-After:
                            description: Seconds to wait before retrying the request.
                            schema:
                                type: string
                    content:
                        application/json:
                            schema:
                                oneOf:
                                    - $ref: '#/components/schemas/Error'
                                    - $ref: '#/components/schemas/RateLimitError'
                default:
                    description: Gateway or handler error response.
                    content:
                        application/json:
                            schema:
                                oneOf:
                                    - $ref: '#/components/schemas/Error'
                                    - $ref: '#/components/schemas/GatewayError'
components:
    securitySchemes:
        WorldMonitorKey:
            type: apiKey
            in: header
            name: X-WorldMonitor-Key
            description: User-issued WorldMonitor API key.
        ApiKeyHeader:
            type: apiKey
            in: header
            name: X-Api-Key
            description: Alias header for the WorldMonitor API key (X-WorldMonitor-Key).
    schemas:
        JmespathProjectionError:
            description: Returned when a REST jmespath projection is invalid or exceeds the expression/output byte limits.
            properties:
                _jmespath_error:
                    description: Projection error discriminator and details.
                    type: string
                original_keys:
                    description: Top-level keys or shape of the unprojected response.
                    items:
                        type: string
                    type: array
            required:
                - _jmespath_error
                - original_keys
            type: object
        Error:
            type: object
            properties:
                message:
                    type: string
                    description: Error message (e.g., 'user not found', 'database connection failed')
            description: Error is returned when a handler encounters an error. It contains a simple error message that the developer can customize.
        InvalidRequestBodyError:
            type: object
            description: Returned when a JSON POST request body is empty or malformed.
            properties:
                message:
                    type: string
                    description: Invalid request body
            required:
                - message
        GatewayError:
            type: object
            description: Returned by gateway infrastructure errors before an RPC handler runs, such as origin, routing, method, authentication, or quota checks.
            properties:
                error:
                    oneOf:
                        - type: string
                        - type: object
                          additionalProperties: true
                    description: Gateway error reason or structured gateway failure details.
            required:
                - error
        RateLimitError:
            type: object
            description: Returned when a gateway or handler rate limit rejects the request.
            properties:
                error:
                    type: string
                    description: Human-readable rate-limit failure reason.
            required:
                - error
        FieldViolation:
            type: object
            properties:
                field:
                    type: string
                    description: The field path that failed validation (e.g., 'user.email' for nested fields). For header validation, this will be the header name (e.g., 'X-API-Key')
                description:
                    type: string
                    description: Human-readable description of the validation violation (e.g., 'must be a valid email address', 'required field missing')
            required:
                - field
                - description
            description: FieldViolation describes a single validation error for a specific field.
        ValidationError:
            type: object
            properties:
                violations:
                    type: array
                    items:
                        $ref: '#/components/schemas/FieldViolation'
                    description: List of validation violations
            required:
                - violations
            description: ValidationError is returned when request validation fails. It contains a list of field violations describing what went wrong.
        GetFiveFactorScorecardRequest:
            type: object
            properties:
                countryCode:
                    type: string
                    pattern: ^[A-Z]{2}$
                    description: ISO 3166-1 alpha-2 country code for the requested scorecard.
            required:
                - countryCode
        GetFiveFactorScorecardResponse:
            type: object
            properties:
                scorecard:
                    $ref: '#/components/schemas/FiveFactorCountryScorecard'
                unavailable:
                    type: boolean
                unavailableReason:
                    type: string
                    pattern: ^(?:|country-unavailable|scorecard-snapshot-unavailable)$
            required:
                - unavailable
                - unavailableReason
            oneOf:
                - required:
                    - scorecard
                  properties:
                    unavailable:
                        const: false
                    unavailableReason:
                        const: ''
                - not:
                    required:
                        - scorecard
                  properties:
                    unavailable:
                        const: true
                    unavailableReason:
                        enum:
                            - country-unavailable
                            - scorecard-snapshot-unavailable
        FiveFactorCountryScorecard:
            type: object
            properties:
                countryCode:
                    type: string
                    pattern: ^[A-Z]{2}$
                methodologyVersion:
                    type: string
                    const: 1.0.0
                computedAt:
                    type: string
                pillars:
                    type: array
                    items:
                        $ref: '#/components/schemas/FiveFactorPillar'
            required:
                - computedAt
                - countryCode
                - methodologyVersion
                - pillars
        FiveFactorPillar:
            type: object
            properties:
                pillar:
                    type: string
                    pattern: ^(?:food|energy|demographics|technology|defense)$
                hasScore:
                    type: boolean
                    description: Read before score and sub_score. When false, both numeric zeros are protobuf placeholders for insufficient data.
                score:
                    type: integer
                    maximum: 5
                    minimum: 0
                    format: int32
                subScore:
                    type: number
                    maximum: 100
                    minimum: 0
                    format: double
                band:
                    type: string
                    pattern: ^(?:|severe-deficit|material-deficit|mixed-capability|strong-capability|high-capability)$
                inputCoverage:
                    type: number
                    maximum: 1
                    minimum: 0
                    format: double
                aggregationMethod:
                    type: string
                    pattern: ^(?:country-weighted-components|aggregate-physical-inputs|population-weighted-continuous-score)$
                inputs:
                    type: array
                    items:
                        $ref: '#/components/schemas/ScorecardEvidence'
                insufficientReasons:
                    type: array
                    items:
                        type: string
                        pattern: ^(?:source-unavailable|country-unavailable|invalid-value|stale|coverage-below-floor|required-group-missing|missing-population|redistribution-blocked)$
                includedMembers:
                    type: array
                    items:
                        type: string
                        pattern: ^[A-Z]{2}$
                excludedMembers:
                    type: array
                    items:
                        $ref: '#/components/schemas/ExcludedBlocMember'
                memberWeights:
                    type: array
                    items:
                        $ref: '#/components/schemas/ScorecardMemberWeight'
            required:
                - aggregationMethod
                - band
                - excludedMembers
                - hasScore
                - includedMembers
                - inputCoverage
                - inputs
                - insufficientReasons
                - memberWeights
                - pillar
                - score
                - subScore
        ScorecardEvidence:
            type: object
            properties:
                inputId:
                    type: string
                available:
                    type: boolean
                value:
                    type: number
                    format: double
                hasValue:
                    type: boolean
                year:
                    type: integer
                    maximum: 2200
                    minimum: 0
                    format: int32
                unit:
                    type: string
                source:
                    type: string
                sourceKey:
                    type: string
                unavailableReason:
                    type: string
                    pattern: ^(?:|source-unavailable|country-unavailable|invalid-value|stale|coverage-below-floor|required-group-missing|missing-population|redistribution-blocked)$
                quality:
                    type: string
                    pattern: ^(?:|observed|retained|derived)$
                observations:
                    type: array
                    items:
                        $ref: '#/components/schemas/ScorecardObservation'
                countryCode:
                    type: string
                    pattern: ^(?:|[A-Z]{2})$
                    description: ISO-2 member that supplied this evidence. Empty only on a country scorecard.
            required:
                - available
                - countryCode
                - hasValue
                - inputId
                - observations
                - quality
                - source
                - sourceKey
                - unavailableReason
                - unit
                - value
                - year
        ScorecardObservation:
            type: object
            properties:
                name:
                    type: string
                value:
                    type: number
                    format: double
                year:
                    type: integer
                    maximum: 2200
                    minimum: 1900
                    format: int32
                unit:
                    type: string
                source:
                    type: string
                indicatorCode:
                    type: string
            required:
                - indicatorCode
                - name
                - source
                - unit
                - value
                - year
        ExcludedBlocMember:
            type: object
            properties:
                countryCode:
                    type: string
                    pattern: ^[A-Z]{2}$
                reason:
                    type: string
                    pattern: ^(?:source-unavailable|country-unavailable|invalid-value|stale|coverage-below-floor|required-group-missing|missing-population|redistribution-blocked)$
            required:
                - countryCode
                - reason
        ScorecardMemberWeight:
            type: object
            properties:
                countryCode:
                    type: string
                    pattern: ^[A-Z]{2}$
                populationMillions:
                    type: number
                    minimum: 0
                    format: double
                    description: Population in millions used by population-weighted components.
                hasPopulation:
                    type: boolean
                    description: Read before population_millions; false means the numeric zero is a placeholder.
            required:
                - countryCode
                - hasPopulation
                - populationMillions
        ListFiveFactorScorecardsRequest:
            type: object
        ListFiveFactorScorecardsResponse:
            type: object
            properties:
                scorecards:
                    type: array
                    items:
                        $ref: '#/components/schemas/FiveFactorCountryScorecardSummary'
                unavailable:
                    type: boolean
                unavailableReason:
                    type: string
                    pattern: ^(?:|scorecard-snapshot-unavailable)$
                methodologyVersion:
                    type: string
                    pattern: ^(?:|1\.0\.0)$
                computedAt:
                    type: string
            required:
                - computedAt
                - methodologyVersion
                - scorecards
                - unavailable
                - unavailableReason
            oneOf:
                - properties:
                    unavailable:
                        const: false
                    unavailableReason:
                        const: ''
                    methodologyVersion:
                        const: 1.0.0
                - properties:
                    unavailable:
                        const: true
                    unavailableReason:
                        const: scorecard-snapshot-unavailable
                    methodologyVersion:
                        const: ''
                    computedAt:
                        const: ''
                    scorecards:
                        maxItems: 0
        FiveFactorCountryScorecardSummary:
            type: object
            properties:
                countryCode:
                    type: string
                    pattern: ^[A-Z]{2}$
                pillars:
                    type: array
                    items:
                        $ref: '#/components/schemas/FiveFactorPillarSummary'
            required:
                - countryCode
                - pillars
        FiveFactorPillarSummary:
            type: object
            properties:
                pillar:
                    type: string
                    pattern: ^(?:food|energy|demographics|technology|defense)$
                hasScore:
                    type: boolean
                    description: Read before score and sub_score. When false, both numeric zeros are protobuf placeholders for insufficient data.
                score:
                    type: integer
                    maximum: 5
                    minimum: 0
                    format: int32
                subScore:
                    type: number
                    maximum: 100
                    minimum: 0
                    format: double
                band:
                    type: string
                    pattern: ^(?:|severe-deficit|material-deficit|mixed-capability|strong-capability|high-capability)$
                inputCoverage:
                    type: number
                    maximum: 1
                    minimum: 0
                    format: double
                insufficientReasons:
                    type: array
                    items:
                        type: string
                        pattern: ^(?:source-unavailable|country-unavailable|invalid-value|stale|coverage-below-floor|required-group-missing|missing-population|redistribution-blocked)$
            required:
                - band
                - hasScore
                - inputCoverage
                - insufficientReasons
                - pillar
                - score
                - subScore
        GetBlocScorecardRequest:
            type: object
            properties:
                preset:
                    type: string
                    pattern: ^(?:|USMCA|EU27|BRICS|GCC|ASEAN|NATO)$
                    description: 'Official bloc preset: USMCA, EU27, BRICS, GCC, ASEAN, or NATO. Values are case-sensitive. Omit when members is provided.'
                members:
                    type: array
                    items:
                        type: string
                        pattern: ^[A-Z]{2}$
                    minItems: 2
                    maxItems: 30
                    uniqueItems: true
                    description: Custom list of 2-30 unique uppercase ISO 3166-1 alpha-2 members. Provide either preset or members; do not provide both.
            oneOf:
                - required:
                    - preset
                  not:
                    required:
                        - members
                - required:
                    - members
                  not:
                    required:
                        - preset
        GetBlocScorecardResponse:
            type: object
            properties:
                scorecard:
                    $ref: '#/components/schemas/FiveFactorBlocScorecard'
                unavailable:
                    type: boolean
                unavailableReason:
                    type: string
                    pattern: ^(?:|bloc-members-unavailable|scorecard-snapshot-unavailable)$
            required:
                - unavailable
                - unavailableReason
            oneOf:
                - required:
                    - scorecard
                  properties:
                    unavailable:
                        const: false
                    unavailableReason:
                        const: ''
                - not:
                    required:
                        - scorecard
                  properties:
                    unavailable:
                        const: true
                    unavailableReason:
                        enum:
                            - bloc-members-unavailable
                            - scorecard-snapshot-unavailable
        FiveFactorBlocScorecard:
            type: object
            properties:
                id:
                    type: string
                label:
                    type: string
                methodologyVersion:
                    type: string
                    const: 1.0.0
                computedAt:
                    type: string
                members:
                    type: array
                    items:
                        type: string
                        pattern: ^[A-Z]{2}$
                includedMembers:
                    type: array
                    items:
                        type: string
                        pattern: ^[A-Z]{2}$
                excludedMembers:
                    type: array
                    items:
                        $ref: '#/components/schemas/ExcludedBlocMember'
                pillars:
                    type: array
                    items:
                        $ref: '#/components/schemas/FiveFactorPillar'

            required:
                - computedAt
                - excludedMembers
                - id
                - includedMembers
                - label
                - members
                - methodologyVersion
                - pillars