{
  "components": {
    "securitySchemes": {
      "accountSid_authToken": {
        "scheme": "basic",
        "type": "http"
      }
    },
    "schemas": {
      "oauth.v1.authorize": {
        "type": "object",
        "properties": {
          "redirect_to": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "description": "The callback URL"
          }
        }
      },
      "oauth.v1.token": {
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string",
            "nullable": true,
            "description": "Token which carries the necessary information to access a Twilio resource directly."
          },
          "refresh_token": {
            "type": "string",
            "nullable": true,
            "description": "Token which carries the information necessary to get a new access token."
          },
          "id_token": {
            "type": "string",
            "nullable": true,
            "description": "Token which carries the information necessary of user profile."
          },
          "token_type": {
            "type": "string",
            "nullable": true,
            "description": "Token type"
          },
          "expires_in": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          }
        }
      }
    }
  },
  "info": {
    "title": "Twilio - Oauth",
    "description": "This is the public Twilio REST API.",
    "termsOfService": "https://www.twilio.com/legal/tos",
    "contact": {
      "name": "Twilio Support",
      "url": "https://support.twilio.com",
      "email": "support@twilio.com"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "version": "1.0.0",
    "x-twilio": {
      "apiStandards": "v0.1"
    }
  },
  "openapi": "3.0.1",
  "paths": {
    "/v1/authorize": {
      "servers": [
        {
          "url": "https://oauth.twilio.com"
        }
      ],
      "description": "",
      "x-twilio": {
        "defaultOutputProperties": [
          "redirect_to"
        ],
        "pathType": "list"
      },
      "get": {
        "description": "Retrieves authorize uri",
        "summary": "Retrieves authorize uri",
        "tags": [
          "OauthV1Authorize"
        ],
        "parameters": [
          {
            "name": "ResponseType",
            "in": "query",
            "description": "Response Type",
            "schema": {
              "type": "string"
            },
            "examples": {
              "fetch": {
                "value": "code"
              }
            }
          },
          {
            "name": "ClientId",
            "in": "query",
            "description": "The Client Identifier",
            "schema": {
              "type": "string"
            },
            "examples": {
              "fetch": {
                "value": "OQ7cda1a615f05a95634e643aaaf7081d7"
              }
            }
          },
          {
            "name": "RedirectUri",
            "in": "query",
            "description": "The url to which response will be redirected to",
            "schema": {
              "type": "string"
            },
            "examples": {
              "fetch": {
                "value": "www.twilio.com"
              }
            }
          },
          {
            "name": "Scope",
            "in": "query",
            "description": "The scope of the access request",
            "schema": {
              "type": "string"
            },
            "examples": {
              "fetch": {
                "value": "offline_access"
              }
            }
          },
          {
            "name": "State",
            "in": "query",
            "description": "An opaque value which can be used to maintain state between the request and callback",
            "schema": {
              "type": "string"
            },
            "examples": {
              "fetch": {
                "value": "xvz"
              }
            }
          }
        ],
        "responses": {
          "302": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/oauth.v1.authorize"
                },
                "examples": {
                  "fetch": {
                    "value": {
                      "redirect_to": "https://www.twilio.com/authorize?response_type=code&client_id=OQ7cda1a615f05a95634e643aaaf7081d7&redirect_uri=www.twilio.com&scope=offline_access&state=xvz"
                    }
                  }
                }
              }
            },
            "headers": {
              "Access-Control-Allow-Origin": {
                "description": "Specify the origin(s) allowed to access the resource",
                "schema": {
                  "type": "string"
                },
                "example": "*"
              },
              "Access-Control-Allow-Methods": {
                "description": "Specify the HTTP methods allowed when accessing the resource",
                "schema": {
                  "type": "string"
                },
                "example": "POST, OPTIONS"
              },
              "Access-Control-Allow-Headers": {
                "description": "Specify the headers allowed when accessing the resource",
                "schema": {
                  "type": "string"
                },
                "example": "Content-Type, Authorization"
              },
              "Access-Control-Allow-Credentials": {
                "description": "Indicates whether the browser should include credentials",
                "schema": {
                  "type": "boolean"
                }
              },
              "Access-Control-Expose-Headers": {
                "description": "Headers exposed to the client",
                "schema": {
                  "type": "string",
                  "example": "X-Custom-Header1, X-Custom-Header2"
                }
              }
            },
            "description": "Found"
          }
        },
        "security": [],
        "operationId": "FetchAuthorize"
      }
    },
    "/v1/token": {
      "servers": [
        {
          "url": "https://oauth.twilio.com"
        }
      ],
      "description": "",
      "x-twilio": {
        "defaultOutputProperties": [],
        "pathType": "list"
      },
      "post": {
        "description": "Issues a new Access token (optionally identity_token & refresh_token) in exchange of Oauth grant",
        "summary": "Issues a new Access token (optionally identity_token & refresh_token) in exchange of Oauth grant",
        "tags": [
          "OauthV1Token"
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/oauth.v1.token"
                },
                "examples": {
                  "create": {
                    "value": {
                      "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
                      "refresh_token": "ghjbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
                      "id_token": "eyJhbdGciOiIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
                      "expires_in": 1438315200000,
                      "token_type": "bearer"
                    }
                  }
                }
              }
            },
            "headers": {
              "Access-Control-Allow-Origin": {
                "description": "Specify the origin(s) allowed to access the resource",
                "schema": {
                  "type": "string"
                },
                "example": "*"
              },
              "Access-Control-Allow-Methods": {
                "description": "Specify the HTTP methods allowed when accessing the resource",
                "schema": {
                  "type": "string"
                },
                "example": "POST, OPTIONS"
              },
              "Access-Control-Allow-Headers": {
                "description": "Specify the headers allowed when accessing the resource",
                "schema": {
                  "type": "string"
                },
                "example": "Content-Type, Authorization"
              },
              "Access-Control-Allow-Credentials": {
                "description": "Indicates whether the browser should include credentials",
                "schema": {
                  "type": "boolean"
                }
              },
              "Access-Control-Expose-Headers": {
                "description": "Headers exposed to the client",
                "schema": {
                  "type": "string",
                  "example": "X-Custom-Header1, X-Custom-Header2"
                }
              }
            },
            "description": "Created"
          }
        },
        "security": [],
        "operationId": "CreateToken",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "title": "CreateTokenRequest",
                "properties": {
                  "GrantType": {
                    "type": "string",
                    "description": "Grant type is a credential representing resource owner's authorization which can be used by client to obtain access token."
                  },
                  "ClientId": {
                    "type": "string",
                    "description": "A 34 character string that uniquely identifies this OAuth App."
                  },
                  "ClientSecret": {
                    "type": "string",
                    "description": "The credential for confidential OAuth App."
                  },
                  "Code": {
                    "type": "string",
                    "description": "JWT token related to the authorization code grant type."
                  },
                  "RedirectUri": {
                    "type": "string",
                    "description": "The redirect uri"
                  },
                  "Audience": {
                    "type": "string",
                    "description": "The targeted audience uri"
                  },
                  "RefreshToken": {
                    "type": "string",
                    "description": "JWT token related to refresh access token."
                  },
                  "Scope": {
                    "type": "string",
                    "description": "The scope of token"
                  }
                },
                "required": [
                  "GrantType",
                  "ClientId"
                ]
              },
              "examples": {
                "create": {
                  "value": {
                    "ClientId": "OQ7cda1a615f05a95634e643aaaf7081d7",
                    "ClientSecret": "sUWblrQ4wx_aYkdAWjHXNvHinynkYOgBoiRyEQUeEntpgDEG47qnBFD98yoEzsTh",
                    "GrantType": "client_credentials",
                    "RedirectUri": "",
                    "Audience": "",
                    "Code": "",
                    "RefreshToken": "refresh_token",
                    "Scope": "scope"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://oauth.twilio.com"
    }
  ],
  "tags": [
    {
      "name": "OauthV1Authorize"
    },
    {
      "name": "OauthV1Index"
    },
    {
      "name": "OauthV1Token"
    },
    {
      "name": "OauthV1Version"
    }
  ],
  "security": [
    {
      "accountSid_authToken": []
    }
  ]
}