openapi: 3.0.0
info:
  title: Auth API
  version: '1.0'
  description: >-
    All Simacan APIs require Bearer authentication (also called token
    authentication). The Auth API provides you with the tokens needed.
  contact:
    name: ''
    email: ''
servers:
  - url: https://auth-service.services.simacan.com/api/v1
    description: Production Environment
  - url: https://auth-service-stg.services.simacan.com/api/v1
    description: Staging Environment
paths:
  /auth/password:
    post:
      requestBody:
        description: Request access token
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/postPassword'
        required: true
      responses:
        '200':
          description: Indicates that your request was successful.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/200'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/401password'
      operationId: postPassword
      summary: Request access token
      description: >-
        Authenticate with username and password credentials for an access and
        refresh token pair.
  /auth/refresh:
    post:
      requestBody:
        description: Refresh access token
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/postRefresh'
        required: true
      responses:
        '200':
          description: Indicates that your request was successful.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/200'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/401refresh'
      operationId: postRefresh
      summary: Refresh access token
      description: Exchanges a refresh token for a new access and refresh token pair.
components:
  schemas:
    '200':
      properties:
        access_token:
          type: string
          description: Access token to be used as Bearer Authentication
          example: >-
            eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJDYjZZbGdHeWNrR3JjWWRxcmNFcUphdW5IRTVfdk5ZMTFjUVIwdHlmX3RvIn0.eyJqdGkiOiI1MzIyMWJmZC1lN2JkLTQzMTgtODhhMS1hZWNhNDgwOGQ1ODgiLCJleHAiOjE2MDY3MzQwMTEsIm5iZiI6MCwiaWF0IjoxNjA2NzMwNDExLCJpc3MiOiJodHRwczovL3Nzby1zdGcuc2ltYWNhbi5jb20vYXV0aC9yZWFsbXMvc2ltYWNhbl90cmFuc3BvcnRfY2xvdWQiLCJhdWQiOiJhdXRoLWFwaSIsInN1YiI6IjRlNTBjOWNkLTQ4OGEtNDdiOS05MDU4LWNlYTIzMGRiZTNiYSIsInR5cCI6IkJlYXJlciIsImF6cCI6ImF1dGgtYXBpIiwiYXV0aF90aW1lIjowLCJzZXNzaW9uX3N0YXRlIjoiOWMyOTMxY2QtZTU2My00OGM1LTlhNTEtYWIwYTg4M2VhYjljIiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6W10sInJlc291cmNlX2FjY2VzcyI6e30sInNjb3BlIjoiIiwibmFtZSI6ImFwaS1kZW1vLWFjY291bnRAc2ltYWNhbi5jb20gYXBpLWRlbW8tYWNjb3VudEBzaW1hY2FuLmNvbSIsInByZWZlcnJlZF91c2VybmFtZSI6ImFwaS1kZW1vLWFjY291bnRAc2ltYWNhbi5jb20iLCJnaXZlbl9uYW1lIjoiYXBpLWRlbW8tYWNjb3VudEBzaW1hY2FuLmNvbSIsImZhbWlseV9uYW1lIjoiYXBpLWRlbW8tYWNjb3VudEBzaW1hY2FuLmNvbSIsImVtYWlsIjoiYXBpLWRlbW8tYWNjb3VudEBzaW1hY2FuLmNvbSJ9.UhZo-Duy7EeeIZqdjgBJki3qr8bOJSqS-MBv8WEN3-GuZP2NiBTnK4MsmA8r9KxcijMXPTwJUHYoKi4h0elsiuRWythP3BwZfC_PzSDMNEAxNL4dTh6H671f3GlJfGVk74xJvaq1gDlaHIJ-2Z-HK_7zSqNv9lOUF8puyZ5esu_XIyxRPKbXkIuwbqSh_8eIt9tyP8og33JZ22srnT41f30k2bOuZWrAuZ-jw1Fx47aB7AMQRvFNjVidUI8L_TQXjA0oAeBsawC7PkYaBqsTl_xEihj4qbHlVTmYoSLZa19OLRSQsd6bLLK768Oatw-wLSeINcnkbP41OnMowBTSUQ
        refresh_token:
          type: string
          description: Credential to be used to refresh access token
          example: >-
            eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJDYjZZbGdHeWNrR3JjWWRxcmNFcUphdW5IRTVfdk5ZMTFjUVIwdHlmX3RvIn0.eyJqdGkiOiI2OTNiYjhiMS0yZjhjLTQzOGYtYjViNy1jY2RlNDRkYmZhNWMiLCJleHAiOjE2MDY4MTY4MTEsIm5iZiI6MCwiaWF0IjoxNjA2NzMwNDExLCJpc3MiOiJodHRwczovL3Nzby1zdGcuc2ltYWNhbi5jb20vYXV0aC9yZWFsbXMvc2ltYWNhbl90cmFuc3BvcnRfY2xvdWQiLCJhdWQiOiJhdXRoLWFwaSIsInN1YiI6IjRlNTBjOWNkLTQ4OGEtNDdiOS05MDU4LWNlYTIzMGRiZTNiYSIsInR5cCI6IlJlZnJlc2giLCJhenAiOiJhdXRoLWFwaSIsImF1dGhfdGltZSI6MCwic2Vzc2lvbl9zdGF0ZSI6IjljMjkzMWNkLWU1NjMtNDhjNS05YTUxLWFiMGE4ODNlYWI5YyIsInJlc291cmNlX2FjY2VzcyI6e30sInNjb3BlIjoiIn0.j1XcwIZhfcMj8nCvCOyEXEPiVMvnarpvayEDsCNfZhTWQviH6aTT69BLjM_D-hRipfiQPjiSFjujVwYCT5iFAXnQgV0CjBvb8CO1acxU5lY283ckhHF9cmKm5BxwtBCgj30ELDRSDUvYT_J4fAZU05GXkZQtCGSkZS-Ab8J45it4_EFv_k-mi7fpzrQkLM8LhqUJL90DmQRbbheaEdaZ4CUVwhQRIiX0NKJLvpOB2Ne8CS2eZc2g4TwJknqdg_1UUjkgvUPA-Z1qVYAel9ASygNDn4LYrnrlxZ3bvXw1vXk71l06KGi3vZMt33ipzrucAJuP8_I2lMrERnT57nZCqg
        token_type:
          type: string
          description: Type of tokens supplied
          example: bearer
        expires_in:
          type: number
          description: Expiration time for access token in seconds
          example: '3600'
    postPassword:
      properties:
        username:
          type: string
          description: Your personal username, provided by Simacan
          example: foo@bar.com
        password:
          type: string
          description: Your personal password, provided by Simacan
          example: gI7XPWVM2LhFX6u9akz0cGTDoRJNXUov
    postRefresh:
      properties:
        refresh_token:
          type: string
          description: The refresh token you got from a previous request
          example: >-
            eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJDYjZZbGdHeWNrR3JjWWRxcmNFcUphdW5IRTVfdk5ZMTFjUVIwdHlmX3RvIn0.eyJqdGkiOiI2OTNiYjhiMS0yZjhjLTQzOGYtYjViNy1jY2RlNDRkYmZhNWMiLCJleHAiOjE2MDY4MTY4MTEsIm5iZiI6MCwiaWF0IjoxNjA2NzMwNDExLCJpc3MiOiJodHRwczovL3Nzby1zdGcuc2ltYWNhbi5jb20vYXV0aC9yZWFsbXMvc2ltYWNhbl90cmFuc3BvcnRfY2xvdWQiLCJhdWQiOiJhdXRoLWFwaSIsInN1YiI6IjRlNTBjOWNkLTQ4OGEtNDdiOS05MDU4LWNlYTIzMGRiZTNiYSIsInR5cCI6IlJlZnJlc2giLCJhenAiOiJhdXRoLWFwaSIsImF1dGhfdGltZSI6MCwic2Vzc2lvbl9zdGF0ZSI6IjljMjkzMWNkLWU1NjMtNDhjNS05YTUxLWFiMGE4ODNlYWI5YyIsInJlc291cmNlX2FjY2VzcyI6e30sInNjb3BlIjoiIn0.j1XcwIZhfcMj8nCvCOyEXEPiVMvnarpvayEDsCNfZhTWQviH6aTT69BLjM_D-hRipfiQPjiSFjujVwYCT5iFAXnQgV0CjBvb8CO1acxU5lY283ckhHF9cmKm5BxwtBCgj30ELDRSDUvYT_J4fAZU05GXkZQtCGSkZS-Ab8J45it4_EFv_k-mi7fpzrQkLM8LhqUJL90DmQRbbheaEdaZ4CUVwhQRIiX0NKJLvpOB2Ne8CS2eZc2g4TwJknqdg_1UUjkgvUPA-Z1qVYAel9ASygNDn4LYrnrlxZ3bvXw1vXk71l06KGi3vZMt33ipzrucAJuP8_I2lMrERnT57nZCqg
    401password:
      properties:
        error:
          type: string
          example: invalid_grant
        error_description:
          type: string
          example: Invalid user credentials
    401refresh:
      properties:
        error:
          type: string
          example: invalid_grant
        error_description:
          type: string
          example: Refresh token expired
