> ## Documentation Index
> Fetch the complete documentation index at: https://developer.rocket.chat/llms.txt
> Use this file to discover all available pages before exploring further.

# Create OAuth App

> Create an app to log in to third-party applications. For details, you can refer to the <a href='https://docs.rocket.chat/docs/third-party-login' target='_blank'> Third-party login user guide</a>. Permission required: `manage-oauth-apps`'

## OpenAPI

````json POST /api/v1/oauth-apps.create
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Integrations"
  },
  "servers": [
    {
      "url": "https://apiexplorer.support.rocket.chat"
    }
  ],
  "paths": {
    "/api/v1/oauth-apps.create": {
      "post": {
        "tags": [
          "OAuth Apps"
        ],
        "summary": "Create OAuth App",
        "description": "Create an app to log in to third-party applications. For details, you can refer to the <a href='https://docs.rocket.chat/docs/third-party-login' target='_blank'> Third-party login user guide</a>. Permission required: `manage-oauth-apps`'",
        "operationId": "post-api-v1-oauth-apps.create",
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Auth-Token"
          },
          {
            "$ref": "#/components/parameters/X-User-Id"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Name of the app that you want to create."
                  },
                  "redirectUri": {
                    "type": "string",
                    "description": "The URL to redirect the OAuth app."
                  },
                  "active": {
                    "type": "boolean",
                    "description": "Whether the app will be active or not. Enter a boolean value, `true` or `false`."
                  }
                },
                "required": [
                  "name",
                  "redirectUri",
                  "active"
                ]
              },
              "examples": {
                "Example 1": {
                  "value": {
                    "name": "test-oauth-app",
                    "redirectUri": "https://testuri.com",
                    "active": "true"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "application": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "redirectUri": {
                          "type": "string"
                        },
                        "active": {
                          "type": "boolean"
                        },
                        "clientId": {
                          "type": "string"
                        },
                        "clientSecret": {
                          "type": "string"
                        },
                        "_createdAt": {
                          "type": "string"
                        },
                        "_updatedAt": {
                          "type": "string"
                        },
                        "_createdBy": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "username": {
                              "type": "string"
                            }
                          }
                        },
                        "_id": {
                          "type": "string"
                        }
                      }
                    },
                    "success": {
                      "type": "boolean"
                    }
                  }
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "application": {
                        "name": "test-oauth-app",
                        "redirectUri": "https://testuri.com",
                        "active": "true",
                        "clientId": "bN9D5TjY8Cv8GqWfE",
                        "clientSecret": "l3HAl0lSr2VaTYZVED6EabyhNzovS8Je2JYmbjNT-V1",
                        "_createdAt": "2024-01-17T13:30:41.521Z",
                        "_updatedAt": "2024-01-17T13:30:41.521Z",
                        "_createdBy": {
                          "_id": "JFTcMhEAFbNPfnp49",
                          "username": "math.bar"
                        },
                        "_id": "65a7d68142a7e12453052d56"
                      },
                      "success": "true"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    },
                    "errorType": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "success": "false",
                      "error": "must have required property 'name' [invalid-params]",
                      "errorType": "invalid-params"
                    }
                  },
                  "Example 2": {
                    "value": {
                      "success": "false",
                      "error": "must have required property 'active' [invalid-params]",
                      "errorType": "invalid-params"
                    }
                  },
                  "Example 3": {
                    "value": {
                      "success": "false",
                      "error": "must have required property 'redirectUri' [invalid-params]",
                      "errorType": "invalid-params"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/authorizationError"
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "X-Auth-Token": {
        "name": "X-Auth-Token",
        "in": "header",
        "description": "The authorization token of the user.",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "9HqLlyZOugD_0YdwAJF8V47U3QHXSq"
      },
      "X-User-Id": {
        "name": "X-User-Id",
        "in": "header",
        "description": "The user ID of the user.",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "aobEdbYhXfu5hkeqG"
      }
    },
    "responses": {
      "authorizationError": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "Authorization Error": {
                "value": {
                  "status": "error",
                  "message": "You must be logged in to do this."
                }
              }
            }
          }
        }
      }
    }
  }
}
````

