openapi: 3.0.3
info:
title: Documentation MegaAPI
description: This is a sample documentation for a new API.
version: '6.1'
contact:
name: MegaAPI
url: https://mega-api.app.br
servers:
- url: https://apistart01.megaapi.com.br
tags:
- description: Endpoints related to management of instances
name: InstanceController
- description: Endpoints related to management of messages
name: SendMessageController
- description: Endpoints related to management of groups
name: GroupController
- description: Endpoints related to management of chats
name: ChatController
- description: Endpoints related to management of webhook
name: WebhookController
paths:
/rest/instance/{instance_key}:
get:
tags:
- InstanceController
summary: Get an status of instance
operationId: InstanceController_getInstanceStatus
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
responses:
'200':
description: Success
/rest/instance/downloadMediaMessage/{instance_key}:
post:
tags:
- InstanceController
operationId: InstanceController_downloadMediaMessage
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: >-
#/components/schemas/InstanceControllerDownloadMediaMessageRequest
responses:
'200':
description: Success
/rest/instance/getProfilePicture/{instance_key}:
get:
tags:
- InstanceController
summary: Get image from any whatsapp profile
operationId: InstanceController_getProfilePicture
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
- in: query
name: to
required: false
schema:
type: string
- description: icon/image
in: query
name: type
required: false
schema:
type: string
responses:
'200':
description: Success
/rest/instance/isOnWhatsApp/{instance_key}:
get:
tags:
- InstanceController
summary: Check if the number exists in whatsapp
operationId: InstanceController_checkIfNumberExistsInWhatsApp
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
- in: query
name: jid
required: false
schema:
type: string
responses:
'200':
description: Success
/rest/instance/qrcode/{instance_key}:
get:
tags:
- InstanceController
summary: Get the qrcode
operationId: InstanceController_getQrCode
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
responses:
'200':
description: Success
/rest/instance/qrcode_base64/{instance_key}:
get:
tags:
- InstanceController
summary: Get the qrcode in base64 format
operationId: InstanceController_getQrCodeBase64
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
responses:
'200':
description: Success
/rest/instance/pairingCode/{instance_key}:
get:
tags:
- InstanceController
summary: Get the pairing code to login
operationId: InstanceController_getPairingCode
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
- in: query
name: phoneNumber
required: false
schema:
type: string
responses:
'200':
description: Success
/rest/instance/{instance_key}/logout:
delete:
tags:
- InstanceController
summary: Logout from an instance
operationId: InstanceController_logoutInstanceKey
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
responses:
'200':
description: Success
/rest/instance/{instance_key}/restart:
delete:
tags:
- InstanceController
summary: Restart an instance
operationId: InstanceController_restartInstance
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
responses:
'200':
description: Success
/rest/webhook/{instance_key}:
get:
tags:
- WebhookController
summary: Get an instance webhook data
operationId: WebhookController_getInstanceData
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
responses:
'200':
description: Success
/rest/webhook/{instance_key}/configWebhook:
post:
tags:
- WebhookController
operationId: WebhookController_configureWebhook
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookControllerConfigureWebhookRequest'
responses:
'200':
description: Success
/rest/sendMessage/{instance_key}/text:
post:
tags:
- SendMessageController
summary: Send a text message to an WhatsApp User
operationId: SendMessageController_sendTextMessage
security:
- bearer: []
description: >-
Note that while sending to single chat, the id should not contain
@s.whatsapp.net.
However, while sending to groups, the id should end with @g.us
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/SendMessageControllerSendTextMessageRequest'
responses:
'200':
description: Success
/rest/sendMessage/{instance_key}/mediaUrl:
post:
tags:
- SendMessageController
summary: Send a media message via a URL
operationId: SendMessageController_sendMediaViaUrl
security:
- bearer: []
description: >
The this endpoint allows you to send a media URL to a user.
The url parameter is the URL of the media to be sent.
The to parameter is the phone number of the user to
send the media to.
The type parameter is the type of media to be sent.
The type of media can be one of the following:
- image - an image
- video - a video
- audio - an audio file
- ptt - an audio(ptt) file
- ptv - an video(ptv) file
- document - a document
The caption parameter is the caption of the media to be
sent.
The mimeType parameter is the mimeType of the media.
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/SendMessageControllerSendMediaViaUrlRequest'
responses:
'200':
description: Success
/rest/sendMessage/{instance_key}/mediaBase64:
post:
tags:
- SendMessageController
summary: Send a media message via Base64
operationId: SendMessageController_sendMediaBase64
security:
- bearer: []
description: >
The this endpoint allows you to send a media Base64 to a user.
The base64 parameter is the Base64 of the media to be
sent.
The to parameter is the phone number of the user to
send the media to.
The type parameter is the type of media to be sent.
The type of media can be one of the following:
- image - an image
- video - a video
- audio - an audio file
- ptt - an audio(ptt) file
- ptv - an video(ptv) file
- document - a document
The caption parameter is the caption of the media to be
sent.
The mimeType parameter is the mimeType of the media.
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/SendMessageControllerSendMediaBase64Request'
responses:
'200':
description: Success
/rest/sendMessage/{instance_key}/location:
post:
tags:
- SendMessageController
summary: Send an location to an WhatsApp User
operationId: SendMessageController_sendLocation
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/SendMessageControllerSendLocationRequest'
responses:
'200':
description: Success
/rest/sendMessage/{instance_key}/sendLinkPreview:
post:
tags:
- SendMessageController
summary: Send a message with link preview
operationId: SendMessageController_sendMessageLinkPreview
security:
- bearer: []
description: Send a message with link preview
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: >-
#/components/schemas/SendMessageControllerSendMessageLinkPreviewRequest
responses:
'200':
description: Success
/rest/sendMessage/{instance_key}/listMessage:
post:
tags:
- SendMessageController
summary: Send an List Message to an User
operationId: SendMessageController_listMessageToUser
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: >-
#/components/schemas/SendMessageControllerListMessageToUserRequest
responses:
'200':
description: Success
/rest/sendMessage/{instance_key}/contactMessage:
post:
tags:
- SendMessageController
summary: Send an Vcard message to an User
operationId: SendMessageController_sendVcardMessageToUser
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: >-
#/components/schemas/SendMessageControllerSendVcardMessageToUserRequest
responses:
'200':
description: Success
/rest/sendMessage/{instance_key}/forwardMessage:
post:
tags:
- SendMessageController
summary: Forward message to User
operationId: SendMessageController_forwardToUserMessage
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: >-
#/components/schemas/SendMessageControllerForwardToUserMessageRequest
responses:
'200':
description: Success
/rest/sendMessage/{instance_key}/quoteMessage:
post:
tags:
- SendMessageController
summary: Quote message for User
operationId: SendMessageController_quoteUserMessage
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: >-
#/components/schemas/SendMessageControllerQuoteUserMessageRequest
responses:
'200':
description: Success
/rest/chat/{instance_key}/presenceUpdateChat:
post:
tags:
- ChatController
summary: Change presence for chat
operationId: ChatController_changePresenceForChat
security:
- bearer: []
description: >-
Option:
"unavailable"
"available"
"composing"
"recording"
"paused"
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/ChatControllerChangePresenceForChatRequest'
responses:
'200':
description: Success
/rest/chat/{instance_key}/deleteMessage:
post:
tags:
- ChatController
summary: Delete message in chat
operationId: ChatController_deleteMessageInstanceKey
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: >-
#/components/schemas/ChatControllerDeleteMessageInstanceKeyRequest
responses:
'200':
description: Success
/rest/chat/{instance_key}/deleteMessageFromMe:
post:
tags:
- ChatController
summary: Delete message fromMe in chat
operationId: ChatController_deleteMessageFromMe
security:
- bearer: []
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/ChatControllerDeleteMessageFromMeRequest'
responses:
'200':
description: Success
/rest/group/list/{instance_key}:
get:
tags:
- GroupController
summary: List all groups and communitys
operationId: GroupController_listGroups
security:
- bearer: []
description: List all groups and communitys
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
responses:
'200':
description: Success
/rest/group/{instance_key}/group:
get:
tags:
- GroupController
summary: Get a group info
operationId: GroupController_getGroupInfo
security:
- bearer: []
description: ''
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
- in: query
name: jid
required: false
schema:
type: string
responses:
'200':
description: Success
/rest/group/{instance_key}/create:
post:
tags:
- GroupController
summary: Create a group
operationId: GroupController_createGroup
security:
- bearer: []
description: ''
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/GroupControllerCreateGroupRequest'
responses:
'200':
description: Success
/rest/group/{instance_key}/addParticipants:
post:
tags:
- GroupController
summary: Add participants to a group
operationId: GroupController_addParticipantsToGroup
security:
- bearer: []
description: >-
Please note that the participants should not contain @s.whatsapp.net
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: >-
#/components/schemas/GroupControllerAddParticipantsToGroupRequest
responses:
'200':
description: Success
/rest/group/{instance_key}/removeParticipants:
post:
tags:
- GroupController
summary: Remove participants from group
operationId: GroupController_removeParticipants
security:
- bearer: []
description: >-
Please note that the participants should not contain @s.whatsapp.net
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/GroupControllerRemoveParticipantsRequest'
responses:
'200':
description: Success
/rest/group/{instance_key}/leaveGroup:
delete:
tags:
- GroupController
summary: Leave group
operationId: GroupController_leaveGroup
security:
- bearer: []
description: Leave group
parameters:
- in: path
name: instance_key
required: true
schema:
type: string
- in: query
name: jid
required: false
schema:
type: string
responses:
'200':
description: Success
components:
securitySchemes:
bearer:
description: Your admin token
type: http
scheme: bearer
bearerFormat: JWT
schemas:
MediaMessageKeys:
type: object
properties:
mediaKey:
type: string
example: ''
directPath:
type: string
example: ''
url:
type: string
example: ''
mimetype:
type: string
example: ''
messageType:
type: string
example: ''
ConfigWebhookSchema:
type: object
properties:
webhookUrl:
type: string
example: ''
webhookEnabled:
type: boolean
example: true
TextMessage:
type: object
properties:
to:
type: string
example: ''
text:
type: string
example: ''
MediaUrlMessage:
type: object
properties:
to:
type: string
example: ''
url:
type: string
example: ''
fileName:
type: string
example: ''
type:
type: string
example: ''
caption:
type: string
example: ''
gifPlayback:
type: boolean
example: false
mimeType:
type: string
example: ''
MediaMessageBase64:
type: object
properties:
to:
type: string
example: ''
base64:
type: string
example: ''
fileName:
type: string
example: ''
type:
type: string
example: ''
caption:
type: string
example: ''
gifPlayback:
type: boolean
example: false
mimeType:
type: string
example: ''
LocationMessage:
type: object
properties:
to:
type: string
example: ''
address:
type: string
example: ''
caption:
type: string
example: ''
latitude:
type: number
example: null
longitude:
type: number
example: null
url:
type: string
example: ''
LinkPreview:
type: object
properties:
to:
type: string
example: ''
textWithLink:
type: string
example: ''
SendListMessageData:
type: object
properties:
title:
type: string
example: ''
description:
type: string
example: ''
to:
type: string
example: ''
buttonText:
type: string
example: ''
text:
type: string
example: ''
sections:
type: array
items:
$ref: '#/components/schemas/ListSection'
ListSection:
type: object
properties:
title:
type: string
example: ''
rows:
type: array
items:
$ref: '#/components/schemas/ListRow'
ListRow:
type: object
properties:
title:
type: string
example: ''
description:
type: string
example: ''
rowId:
type: string
example: ''
SendVCardData:
type: object
properties:
to:
type: string
example: ''
vcard:
$ref: '#/components/schemas/ContactData'
ContactData:
type: object
properties:
fullName:
type: string
example: ''
displayName:
type: string
example: ''
organization:
type: string
example: ''
phoneNumber:
type: string
example: ''
ForwardMessage:
type: object
properties:
to:
type: string
example: ''
key:
type: object
example: ''
message:
type: object
example: ''
QuoteMessage:
type: object
properties:
to:
type: string
example: ''
text:
type: string
example: ''
key:
type: object
example: ''
message:
type: object
example: ''
DeleteMessageAndChat:
type: object
properties:
to:
type: string
example: ''
key:
type: object
example: ''
messageTimestamp:
type: number
example: 0
LastMessageClearFromMe:
type: object
properties:
id:
type: string
example: ''
timestamp:
type: number
example: 0
CreateGroupData:
type: object
properties:
group_name:
type: string
example: ''
participants:
type: array
items:
type: string
example:
- ''
GroupData:
type: object
properties:
jid:
type: string
example: ''
participants:
type: array
items:
type: string
example:
- ''
InstanceControllerDownloadMediaMessageRequest:
properties:
messageKeys:
$ref: '#/components/schemas/MediaMessageKeys'
type: object
WebhookControllerConfigureWebhookRequest:
properties:
messageData:
$ref: '#/components/schemas/ConfigWebhookSchema'
type: object
SendMessageControllerSendTextMessageRequest:
properties:
messageData:
$ref: '#/components/schemas/TextMessage'
type: object
SendMessageControllerSendMediaViaUrlRequest:
properties:
messageData:
$ref: '#/components/schemas/MediaUrlMessage'
type: object
SendMessageControllerSendMediaBase64Request:
properties:
messageData:
$ref: '#/components/schemas/MediaMessageBase64'
type: object
SendMessageControllerSendLocationRequest:
properties:
messageData:
$ref: '#/components/schemas/LocationMessage'
type: object
SendMessageControllerSendMessageLinkPreviewRequest:
properties:
messageData:
$ref: '#/components/schemas/LinkPreview'
type: object
SendMessageControllerListMessageToUserRequest:
properties:
messageData:
$ref: '#/components/schemas/SendListMessageData'
type: object
SendMessageControllerSendVcardMessageToUserRequest:
properties:
messageData:
$ref: '#/components/schemas/SendVCardData'
type: object
SendMessageControllerForwardToUserMessageRequest:
properties:
messageData:
$ref: '#/components/schemas/ForwardMessage'
type: object
SendMessageControllerQuoteUserMessageRequest:
properties:
messageData:
$ref: '#/components/schemas/QuoteMessage'
type: object
ChatControllerChangePresenceForChatRequest:
properties:
to:
type: string
option:
type: string
type: object
ChatControllerDeleteMessageInstanceKeyRequest:
properties:
messageData:
$ref: '#/components/schemas/DeleteMessageAndChat'
type: object
ChatControllerDeleteMessageFromMeRequest:
properties:
to:
type: string
messageData:
$ref: '#/components/schemas/LastMessageClearFromMe'
type: object
GroupControllerCreateGroupRequest:
properties:
group_data:
$ref: '#/components/schemas/CreateGroupData'
type: object
GroupControllerAddParticipantsToGroupRequest:
properties:
group_data:
$ref: '#/components/schemas/GroupData'
type: object
GroupControllerRemoveParticipantsRequest:
properties:
group_data:
$ref: '#/components/schemas/GroupData'
type: object