Platzi Fake Store API Auth API

The Auth API from Platzi Fake Store API — 3 operation(s) for auth.

OpenAPI Specification

platzi-fake-store-api-auth-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Platzi Fake Store Auth API
  description: A free, fake REST API for testing and prototyping e-commerce or shopping site applications. Provides products, categories, users, files, and JWT authentication endpoints.
  version: 1.0.0
  contact:
    name: Platzi Fake Store API
    url: https://fakeapi.platzi.com/
servers:
- url: https://api.escuelajs.co/api/v1
  description: Public sandbox
tags:
- name: Auth
paths:
  /auth/login:
    post:
      tags:
      - Auth
      summary: Login and obtain JWT tokens
      operationId: login
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - email
              - password
              properties:
                email:
                  type: string
                  format: email
                password:
                  type: string
                  format: password
      responses:
        '201':
          description: Tokens
          content:
            application/json:
              schema:
                type: object
                properties:
                  access_token:
                    type: string
                  refresh_token:
                    type: string
  /auth/profile:
    get:
      tags:
      - Auth
      summary: Get authenticated user profile
      operationId: getProfile
      security:
      - bearerAuth: []
      responses:
        '200':
          description: Authenticated user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
  /auth/refresh-token:
    post:
      tags:
      - Auth
      summary: Refresh access token
      operationId: refreshToken
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - refreshToken
              properties:
                refreshToken:
                  type: string
      responses:
        '201':
          description: New tokens
          content:
            application/json:
              schema:
                type: object
                properties:
                  access_token:
                    type: string
                  refresh_token:
                    type: string
components:
  schemas:
    User:
      type: object
      properties:
        id:
          type: integer
        email:
          type: string
          format: email
        password:
          type: string
        name:
          type: string
        role:
          type: string
          enum:
          - customer
          - admin
        avatar:
          type: string
          format: uri
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT