Superhero API

The Superhero API is a static JSON REST surface that returns a single consolidated dataset of 731 characters or per-character / per-property records. All responses are pre-built JSON files served from GitHub Pages (akabab.github.io) with a jsDelivr CDN mirror. Endpoints cover the full character record (/id/{id}.json) and individual property slices (powerstats, appearance, biography, work, connections), plus a bulk /all.json file containing every character. A separate image surface serves four sizes (xs, sm, md, lg) per character slug.

OpenAPI Specification

superheroes-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Superhero API (akabab)
  description: |
    Open-source static REST API exposing 731 superheroes and villains from
    multiple comic universes (Marvel, DC, Dark Horse, Image, and more) as
    pre-built JSON files served from GitHub Pages and the jsDelivr CDN.
    All endpoints are unauthenticated GETs.
  version: 0.3.0
  contact:
    name: akabab/superhero-api
    url: https://github.com/akabab/superhero-api
  license:
    name: MIT
    url: https://github.com/akabab/superhero-api/blob/master/LICENSE
servers:
  - url: https://akabab.github.io/superhero-api/api
    description: Primary origin (GitHub Pages)
  - url: https://cdn.jsdelivr.net/gh/akabab/[email protected]/api
    description: jsDelivr CDN mirror
tags:
  - name: Characters
    description: Full character records and the consolidated dataset.
  - name: Powerstats
    description: Per-character powerstats slices (intelligence, strength, etc.).
  - name: Appearance
    description: Per-character physical appearance slices.
  - name: Biography
    description: Per-character biographical slices.
  - name: Work
    description: Per-character occupation and base slices.
  - name: Connections
    description: Per-character group affiliations and relatives.
  - name: Images
    description: Multi-resolution character image assets.
paths:
  /all.json:
    get:
      operationId: listAllCharacters
      summary: List All Characters
      description: Returns every character record in the dataset as a single JSON array of 731 entries.
      tags:
        - Characters
      responses:
        '200':
          description: A JSON array of all character records.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Character'
  /id/{id}.json:
    get:
      operationId: getCharacterById
      summary: Get Character By Id
      description: Returns the complete record for a single character keyed by numeric id (1..731).
      tags:
        - Characters
      parameters:
        - $ref: '#/components/parameters/CharacterId'
      responses:
        '200':
          description: A single character record.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Character'
        '404':
          description: No character with the supplied id exists.
  /powerstats/{id}.json:
    get:
      operationId: getCharacterPowerstats
      summary: Get Character Powerstats
      description: Returns just the powerstats slice for a single character.
      tags:
        - Powerstats
      parameters:
        - $ref: '#/components/parameters/CharacterId'
      responses:
        '200':
          description: The character's powerstats sub-document.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Powerstats'
        '404':
          description: No character with the supplied id exists.
  /appearance/{id}.json:
    get:
      operationId: getCharacterAppearance
      summary: Get Character Appearance
      description: Returns just the appearance slice for a single character.
      tags:
        - Appearance
      parameters:
        - $ref: '#/components/parameters/CharacterId'
      responses:
        '200':
          description: The character's appearance sub-document.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Appearance'
        '404':
          description: No character with the supplied id exists.
  /biography/{id}.json:
    get:
      operationId: getCharacterBiography
      summary: Get Character Biography
      description: Returns just the biography slice for a single character.
      tags:
        - Biography
      parameters:
        - $ref: '#/components/parameters/CharacterId'
      responses:
        '200':
          description: The character's biography sub-document.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Biography'
        '404':
          description: No character with the supplied id exists.
  /work/{id}.json:
    get:
      operationId: getCharacterWork
      summary: Get Character Work
      description: Returns just the work slice for a single character (occupation and base).
      tags:
        - Work
      parameters:
        - $ref: '#/components/parameters/CharacterId'
      responses:
        '200':
          description: The character's work sub-document.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Work'
        '404':
          description: No character with the supplied id exists.
  /connections/{id}.json:
    get:
      operationId: getCharacterConnections
      summary: Get Character Connections
      description: Returns just the connections slice for a single character (group affiliations and relatives).
      tags:
        - Connections
      parameters:
        - $ref: '#/components/parameters/CharacterId'
      responses:
        '200':
          description: The character's connections sub-document.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Connections'
        '404':
          description: No character with the supplied id exists.
  /images/{size}/{filename}:
    get:
      operationId: getCharacterImage
      summary: Get Character Image
      description: >-
        Returns a static JPG image for a character at the requested size.
        The filename uses the character slug pattern `{id}-{slug}.jpg`
        (e.g. `1-a-bomb.jpg`).
      tags:
        - Images
      parameters:
        - name: size
          in: path
          required: true
          description: Image size variant.
          schema:
            type: string
            enum: [xs, sm, md, lg]
        - name: filename
          in: path
          required: true
          description: Image filename, e.g. `1-a-bomb.jpg`.
          schema:
            type: string
            pattern: '^[0-9]+-[a-z0-9-]+\.jpg$'
      responses:
        '200':
          description: A JPG image asset.
          content:
            image/jpeg:
              schema:
                type: string
                format: binary
        '404':
          description: No image exists at the requested size and filename.
components:
  parameters:
    CharacterId:
      name: id
      in: path
      required: true
      description: Numeric character id, 1..731.
      schema:
        type: integer
        minimum: 1
        maximum: 731
  schemas:
    Character:
      type: object
      description: A complete superhero or villain record.
      required: [id, name, slug, powerstats, appearance, biography, work, connections, images]
      properties:
        id:
          type: integer
          description: Numeric identifier, 1..731.
          example: 1
        name:
          type: string
          description: Display name of the character.
          example: A-Bomb
        slug:
          type: string
          description: URL-safe slug in `{id}-{name}` form.
          example: 1-a-bomb
        powerstats:
          $ref: '#/components/schemas/Powerstats'
        appearance:
          $ref: '#/components/schemas/Appearance'
        biography:
          $ref: '#/components/schemas/Biography'
        work:
          $ref: '#/components/schemas/Work'
        connections:
          $ref: '#/components/schemas/Connections'
        images:
          $ref: '#/components/schemas/Images'
    Powerstats:
      type: object
      description: Six-axis powerstats vector scored 0-100 (null if unknown).
      properties:
        intelligence:
          type: integer
          nullable: true
          minimum: 0
          maximum: 100
        strength:
          type: integer
          nullable: true
          minimum: 0
          maximum: 100
        speed:
          type: integer
          nullable: true
          minimum: 0
          maximum: 100
        durability:
          type: integer
          nullable: true
          minimum: 0
          maximum: 100
        power:
          type: integer
          nullable: true
          minimum: 0
          maximum: 100
        combat:
          type: integer
          nullable: true
          minimum: 0
          maximum: 100
    Appearance:
      type: object
      description: Physical appearance attributes.
      properties:
        gender:
          type: string
          description: Reported gender or "-" if unknown.
        race:
          type: string
          nullable: true
          description: Species / race designation (e.g. Human, Kryptonian, Mutant).
        height:
          type: array
          description: Height pair — imperial then metric.
          items:
            type: string
          example: ["6'8", "203 cm"]
        weight:
          type: array
          description: Weight pair — imperial then metric.
          items:
            type: string
          example: ["980 lb", "441 kg"]
        eyeColor:
          type: string
          description: Eye color or "-" if unknown.
        hairColor:
          type: string
          description: Hair color or "-" / "No Hair" if unknown / bald.
    Biography:
      type: object
      description: Biographical information.
      properties:
        fullName:
          type: string
          description: Real name where known.
        alterEgos:
          type: string
          description: Comma-separated alter egos, or "No alter egos found.".
        aliases:
          type: array
          description: Known aliases.
          items:
            type: string
        placeOfBirth:
          type: string
        firstAppearance:
          type: string
          description: First appearance in canonical comics / media.
        publisher:
          type: string
          description: Originating publisher (Marvel Comics, DC Comics, etc.).
        alignment:
          type: string
          description: Moral alignment of the character.
          enum: [good, bad, neutral, '-']
    Work:
      type: object
      description: Occupational record.
      properties:
        occupation:
          type: string
          description: Occupation(s), or "-" if unknown.
        base:
          type: string
          description: Base of operations, or "-" if unknown.
    Connections:
      type: object
      description: Group affiliations and family connections.
      properties:
        groupAffiliation:
          type: string
          description: Group/team affiliations.
        relatives:
          type: string
          description: Known relatives.
    Images:
      type: object
      description: Image URLs at four sizes.
      required: [xs, sm, md, lg]
      properties:
        xs:
          type: string
          format: uri
        sm:
          type: string
          format: uri
        md:
          type: string
          format: uri
        lg:
          type: string
          format: uri