> ## 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 DM > Create a direct message session with another user or more than one user. #### Change Log | Version | Description | | ------- | ------------------------ | | 0.59.0 | Added | | 3.1.0 | Added usernames fields | | 3.18.0 | Added excludeSelf option | ## OpenAPI ````json POST /api/v1/dm.create { "openapi": "3.0.0", "info": { "version": "1.0.0", "title": "Messaging" }, "servers": [ { "url": "https://apiexplorer.support.rocket.chat" } ], "tags": [ { "name": "Chat" }, { "name": "Direct Messages" }, { "name": "Auto-Translate" } ], "paths": { "/api/v1/dm.create": { "post": { "tags": [ "Direct Messages" ], "summary": "Create DM", "description": "Create a direct message session with another user or more than one user.\n\n#### Change Log\n| Version | Description |\n| ------- | ------------------------ |\n| 0.59.0 | Added |\n| 3.1.0 | Added usernames fields |\n| 3.18.0 | Added excludeSelf option |", "operationId": "post-api-v1-im.create", "parameters": [ { "$ref": "#/components/parameters/Auth-Token" }, { "$ref": "#/components/parameters/UserId" } ], "requestBody": { "content": { "application/json": { "schema": { "oneOf": [ { "type": "object", "properties": { "username": { "type": "string", "description": "The username of the user to open a direct message session." }, "excludeSelf": { "type": "boolean", "description": "Creates the direct message session excluding the current authenticated user. The session will only be opened if the current user has the `view-room-administration` permission" } } }, { "type": "object", "properties": { "usernames": { "type": "string", "description": "Comma-seperated list of usernames to open a multiple direct message session. " }, "excludeSelf": { "type": "boolean", "description": "Creates the direct message session excluding the current authenticated user. The session will only be opened if the current user has the `view-room-administration` permission" } } } ] }, "examples": { "Example": { "value": { "username": "kim.dok", "excludeSelf": true } } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "room": { "type": "object", "properties": { "t": { "type": "string" }, "rid": { "type": "string" }, "usernames": { "type": "array", "items": { "type": "string" } } } }, "success": { "type": "boolean" } } }, "examples": { "Example": { "value": { "room": { "t": "d", "rid": "PMrDaS4axRqkjY7errocket.cat", "usernames": [ "g1", "rocket.cat" ] }, "success": true } } } } } }, "401": { "$ref": "#/components/responses/authorizationError" }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "error": { "type": "string" }, "errorType": { "type": "string" } } }, "examples": { "Missing parameter": { "value": { "success": false, "error": "must have required property 'usernames'\n must have required property 'username'\n must match exactly one schema in oneOf [invalid-params]", "errorType": "invalid-params" } }, "Invalid User": { "value": { "success": false, "error": "Invalid user [error-invalid-user]", "errorType": "error-invalid-user", "details": { "method": "createDirectMessage" } } } } } } } } } } }, "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." } } } } } } } } } ````