NASA Mars Photos API

The Mars Photos API from NASA — 3 operation(s) for mars photos.

OpenAPI Specification

nasa-mars-photos-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: NASA Astronomy Picture of the Day (APOD) Asset Mars Photos API
  description: The Astronomy Picture of the Day (APOD) API provides access to NASA's popular APOD service, returning the astronomy picture or video of the day along with a brief explanation written by a professional astronomer.
  version: 1.0.0
  contact:
    name: NASA API Support
    url: https://api.nasa.gov
servers:
- url: https://api.nasa.gov
tags:
- name: Mars Photos
paths:
  /mars-photos/api/v1/rovers/{rover}/photos:
    get:
      operationId: getRoverPhotos
      summary: NASA Get photos from a Mars rover
      description: Returns photos taken by the specified Mars rover, filtered by sol or Earth date and optionally by camera.
      parameters:
      - name: rover
        in: path
        required: true
        description: The name of the rover.
        schema:
          type: string
          enum:
          - curiosity
          - opportunity
          - spirit
      - name: sol
        in: query
        required: false
        description: Martian sol (day) on which photos were taken.
        schema:
          type: integer
      - name: earth_date
        in: query
        required: false
        description: Earth date on which photos were taken (YYYY-MM-DD).
        schema:
          type: string
          format: date
      - name: camera
        in: query
        required: false
        description: Abbreviation of the camera used to take the photo.
        schema:
          type: string
          enum:
          - FHAZ
          - RHAZ
          - MAST
          - CHEMCAM
          - MAHLI
          - MARDI
          - NAVCAM
          - PANCAM
          - MINITES
      - name: page
        in: query
        required: false
        description: Page number for paginated results (25 items per page).
        schema:
          type: integer
          default: 1
      - name: api_key
        in: query
        required: true
        schema:
          type: string
          default: DEMO_KEY
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  photos:
                    type: array
                    items:
                      $ref: '#/components/schemas/RoverPhoto'
      tags:
      - Mars Photos
  /mars-photos/api/v1/rovers/{rover}/latest_photos:
    get:
      operationId: getLatestRoverPhotos
      summary: NASA Get the latest photos from a Mars rover
      description: Returns the most recently available photos for a rover.
      parameters:
      - name: rover
        in: path
        required: true
        schema:
          type: string
          enum:
          - curiosity
          - opportunity
          - spirit
      - name: api_key
        in: query
        required: true
        schema:
          type: string
          default: DEMO_KEY
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  latest_photos:
                    type: array
                    items:
                      $ref: '#/components/schemas/RoverPhoto'
      tags:
      - Mars Photos
  /mars-photos/api/v1/manifests/{rover}:
    get:
      operationId: getRoverManifest
      summary: NASA Get mission manifest for a rover
      description: Returns the mission manifest including sol and photo counts.
      parameters:
      - name: rover
        in: path
        required: true
        schema:
          type: string
          enum:
          - curiosity
          - opportunity
          - spirit
      - name: api_key
        in: query
        required: true
        schema:
          type: string
          default: DEMO_KEY
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  photo_manifest:
                    $ref: '#/components/schemas/RoverManifest'
      tags:
      - Mars Photos
components:
  schemas:
    Camera:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        rover_id:
          type: integer
        full_name:
          type: string
    Rover:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        landing_date:
          type: string
          format: date
        launch_date:
          type: string
          format: date
        status:
          type: string
          enum:
          - active
          - complete
    RoverPhoto:
      type: object
      properties:
        id:
          type: integer
          description: Unique identifier for the photo.
        sol:
          type: integer
          description: Martian sol on which the photo was taken.
        camera:
          $ref: '#/components/schemas/Camera'
        img_src:
          type: string
          format: uri
          description: URL of the image.
        earth_date:
          type: string
          format: date
          description: Earth date when the photo was taken.
        rover:
          $ref: '#/components/schemas/Rover'
    RoverManifest:
      type: object
      properties:
        name:
          type: string
        landing_date:
          type: string
          format: date
        launch_date:
          type: string
          format: date
        status:
          type: string
        max_sol:
          type: integer
        max_date:
          type: string
          format: date
        total_photos:
          type: integer
        photos:
          type: array
          items:
            type: object
            properties:
              sol:
                type: integer
              earth_date:
                type: string
                format: date
              total_photos:
                type: integer
              cameras:
                type: array
                items:
                  type: string