> ## 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.
# Find or Create Invite
> Creates or return an existing invite with the specified parameters.
Permission required: `create-invite-links`
## OpenAPI
````json POST /api/v1/findOrCreateInvite
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "Rooms"
},
"servers": [
{
"url": "https://apiexplorer.support.rocket.chat"
}
],
"tags": [
{
"name": "Channels"
},
{
"name": "Directory"
},
{
"name": "Groups"
},
{
"name": "Rooms"
},
{
"name": "Teams"
},
{
"name": "Room Invites"
},
{
"name": "Subscriptions"
},
{
"name": "ABAC"
}
],
"paths": {
"/api/v1/findOrCreateInvite": {
"post": {
"tags": [
"Room Invites"
],
"summary": "Find or Create Invite",
"description": "Creates or return an existing invite with the specified parameters. \n\nPermission required: `create-invite-links`",
"operationId": "post-api-v1-findOrCreateInvite",
"parameters": [
{
"$ref": "#/components/parameters/Auth-Token"
},
{
"$ref": "#/components/parameters/UserId"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"rid": {
"type": "string",
"description": "The room ID that the invite is being created for."
},
"days": {
"type": "integer",
"description": "The number of days that the invite will be valid for. Send `0` for unlimited."
},
"maxUses": {
"type": "integer",
"description": "The number of times that the invite can be used. Send `0` for unlimited."
}
},
"required": [
"rid",
"days",
"maxUses"
]
},
"examples": {
"Example": {
"value": {
"rid": "csFYrDeixJG7PnrAh",
"days": 10,
"maxUses": 0
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"_id": {
"type": "string"
},
"days": {
"type": "integer"
},
"maxUses": {
"type": "integer"
},
"rid": {
"type": "string"
},
"userId": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"expires": {
"type": "string",
"nullable": true
},
"uses": {
"type": "integer"
},
"_updatedAt": {
"type": "string"
}
}
}
},
"examples": {
"Success": {
"value": [
{
"_id": "kDKQ3H",
"days": 1,
"maxUses": 1,
"rid": "s7CE842q9WtvLctD7",
"userId": "sNiDqHit5nGAGFg8X",
"createdAt": "2019-12-20T03:31:56.774Z",
"expires": "2019-12-21T03:31:56.774Z",
"uses": 1,
"_updatedAt": "2019-12-20T03:33:40.065Z"
},
{
"_id": "99ScEP",
"days": 1,
"maxUses": 0,
"rid": "s7CE842q9WtvLctD7",
"userId": "sNiDqHit5nGAGFg8X",
"createdAt": "2019-12-20T03:38:20.485Z",
"expires": "2019-12-21T03:38:20.485Z",
"uses": 0,
"_updatedAt": "2019-12-20T03:38:20.485Z"
},
{
"_id": "Y5JKM4",
"days": 0,
"maxUses": 1,
"rid": "s7CE842q9WtvLctD7",
"userId": "sNiDqHit5nGAGFg8X",
"createdAt": "2019-12-20T03:38:25.313Z",
"expires": null,
"uses": 1,
"_updatedAt": "2019-12-20T03:38:40.116Z"
}
]
}
}
}
}
},
"401": {
"$ref": "#/components/responses/authorizationError"
}
}
}
}
},
"components": {
"parameters": {
"Auth-Token": {
"name": "X-Auth-Token",
"in": "header",
"description": "The `authToken` of the authenticated user.",
"required": true,
"schema": {
"type": "string"
},
"example": "RScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f"
},
"UserId": {
"name": "X-User-Id",
"in": "header",
"description": "The `userId` of the authenticated user.",
"required": true,
"schema": {
"type": "string"
},
"example": "rbAXPnMktTFbNpwtJ"
}
},
"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."
}
}
}
}
}
}
}
}
}
````