{
    "openapi": "3.0.0",
    "info": {
        "title": "Calls APIs",
        "description": "Manage calls using our API.",
        "version": "3.0"
    },
    "servers": [
        {
            "url": "https://{appId}.call-{region}.cometchat.io/v3",
            "variables": {
                "appId": {
                    "default": "appId",
                    "description": "(Required) App ID"
                },
                "region": {
                    "enum": [
                        "us",
                        "eu",
                        "in"
                    ],
                    "default": "us",
                    "description": "Select Region"
                }
            }
        }
    ],
    "paths": {
        "/calls": {
            "get": {
                "tags": [
                    "Calls"
                ],
                "summary": "List Calls",
                "description": "lists all the calls that are available in the app. It can include participants, and recordings property in the response (if present).",
                "operationId": "list-calls",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/onBehalfOf"
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "description": "It includes the type of the call, possible values: audio & video",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "audio",
                                "video"
                            ]
                        }
                    },
                    {
                        "name": "mode",
                        "in": "query",
                        "description": "It represents the mode of call, possible values: call, meet & presenter.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "call",
                                "meet",
                                "presenter"
                            ]
                        }
                    },
                    {
                        "name": "participantsCount",
                        "in": "query",
                        "description": "This query parameter allows you to filter the list of calls based on the number of participants involved in each call. For example, participantsCount=5 will return calls that had exactly 5 participants.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "startedAt",
                        "in": "query",
                        "description": "It represents when the call was started. It's 10 digit unix timestamp.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "description": "It indicates the status of the call. Possible values are unanswered, rejected, ongoing, ended.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "rejected",
                                "ongoing",
                                "ended"
                            ]
                        }
                    },
                    {
                        "name": "receiverType",
                        "in": "query",
                        "description": "It indicates if it was 1-1 call of group call. Possible values: user & group.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "user",
                                "group"
                            ]
                        }
                    },
                    {
                        "name": "endedAt",
                        "in": "query",
                        "description": "It represents when the call was ended.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "hasRecording",
                        "in": "query",
                        "description": "It's a boolean field indicating if the call has recording present or not.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "uid",
                        "in": "query",
                        "description": "It fetches only those calls in which the passed uid is a part of.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Lists Calls",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "": {
                                                        "$ref": "#/components/schemas/callSchema"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        },
                                        "meta": {
                                            "properties": {
                                                "": {
                                                    "$ref": "#/components/schemas/metaSchema"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                },
                                "example": {
                                    "data": [
                                        {
                                            "sessionId": "v1.us.31780434a95d45.1692368168aefba73a1e5938ad7a02f8e61ea1c9a287a08aeb",
                                            "totalAudioMinutes": 0.31666666666666665,
                                            "totalVideoMinutes": 0,
                                            "totalDuration": "00:00:19",
                                            "hasRecording": false,
                                            "initiatedAt": 1692368168,
                                            "initiator": "superhero8",
                                            "mode": "call",
                                            "receiver": "sivamathewstestgroup",
                                            "receiverType": "group",
                                            "status": "ended",
                                            "totalDurationInMinutes": 0.31666666666666665,
                                            "totalParticipants": 2,
                                            "type": "audio",
                                            "mid": "3f7596ac-854b-484d-b36c-d623e193bd81",
                                            "startedAt": 1692368180,
                                            "endedAt": 1692368199,
                                            "participants": [
                                                {
                                                    "uid": "superhero2",
                                                    "totalAudioMinutes": 0.31666666666666665,
                                                    "totalVideoMinutes": 0,
                                                    "isJoined": true,
                                                    "state": "ended",
                                                    "totalDuration": 0.31666666666666665,
                                                    "deviceId": "b7683aaf-090a-4204-8f84-7ddd652923aa@rtc.cometchat-staging.com/ucTKf4eq",
                                                    "joinedAt": 1692368180,
                                                    "mid": "3f7596ac-854b-484d-b36c-d623e193bd81",
                                                    "leftAt": 1692368199
                                                },
                                                {
                                                    "uid": "superhero8",
                                                    "totalAudioMinutes": 0.2833333333333333,
                                                    "totalVideoMinutes": 0,
                                                    "isJoined": true,
                                                    "state": "ended",
                                                    "totalDuration": 0.2833333333333333,
                                                    "deviceId": "f55d46e5-2b1c-4b02-9072-382209a8753f@rtc.cometchat-staging.com/K-s6dB3N",
                                                    "joinedAt": 1692368180,
                                                    "mid": "3f7596ac-854b-484d-b36c-d623e193bd81",
                                                    "leftAt": 1692368197
                                                },
                                                {
                                                    "uid": "superhero4",
                                                    "totalAudioMinutes": 0,
                                                    "totalVideoMinutes": 0,
                                                    "isJoined": false,
                                                    "state": "unanswered",
                                                    "totalDuration": 0
                                                },
                                                {
                                                    "uid": "superhero7",
                                                    "totalAudioMinutes": 0,
                                                    "totalVideoMinutes": 0,
                                                    "isJoined": false,
                                                    "state": "unanswered",
                                                    "totalDuration": 0
                                                },
                                                {
                                                    "uid": "superhero6",
                                                    "totalAudioMinutes": 0,
                                                    "totalVideoMinutes": 0,
                                                    "isJoined": false,
                                                    "state": "unanswered",
                                                    "totalDuration": 0
                                                }
                                            ]
                                        },
                                        {
                                            "sessionId": "v1.us.31780434a95d45.16923681138d75114d60d1345a22e4cc612263fb26c0b5cf92",
                                            "totalAudioMinutes": 0.31666666666666665,
                                            "totalVideoMinutes": 0,
                                            "totalDuration": "00:00:19",
                                            "hasRecording": false,
                                            "initiatedAt": 1692368113,
                                            "initiator": "superhero8",
                                            "mode": "call",
                                            "receiver": "superhero2",
                                            "receiverType": "user",
                                            "status": "ended",
                                            "totalDurationInMinutes": 0.31666666666666665,
                                            "totalParticipants": 2,
                                            "type": "audio",
                                            "mid": "855e1519-1244-4213-8e40-53044c1e9e43",
                                            "startedAt": 1692368127,
                                            "endedAt": 1692368146,
                                            "participants": [
                                                {
                                                    "uid": "superhero8",
                                                    "totalAudioMinutes": 0.26666666666666666,
                                                    "totalVideoMinutes": 0,
                                                    "totalDuration": 0.26666666666666666,
                                                    "deviceId": "70ecae89-b71c-4bb3-8220-b7c99ec1658f@rtc.cometchat-staging.com/hsYWb5ul",
                                                    "isJoined": true,
                                                    "joinedAt": 1692368128,
                                                    "mid": "855e1519-1244-4213-8e40-53044c1e9e43",
                                                    "state": "ended",
                                                    "leftAt": 1692368144
                                                },
                                                {
                                                    "uid": "superhero2",
                                                    "totalAudioMinutes": 0.23333333333333334,
                                                    "totalVideoMinutes": 0,
                                                    "totalDuration": 0.23333333333333334,
                                                    "deviceId": "c9ed493e-8495-428d-b6ee-b32019cc57ce@rtc.cometchat-staging.com/CKT3xgR4",
                                                    "isJoined": true,
                                                    "joinedAt": 1692368132,
                                                    "mid": "855e1519-1244-4213-8e40-53044c1e9e43",
                                                    "state": "ended",
                                                    "leftAt": 1692368146
                                                }
                                            ]
                                        }
                                    ],
                                    "meta": {
                                        "pagination": {
                                            "total": 2,
                                            "count": 2,
                                            "total_pages": 1,
                                            "current_page": 1
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "apiKey": []
                    }
                ]
            }
        },
        "/calls/{sessionId}": {
            "get": {
                "tags": [
                    "Calls"
                ],
                "summary": "Get Call",
                "description": "Fetches all the details of the call whose sessionId is passed in the URL.",
                "operationId": "retrieve-call-details",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/onBehalfOf"
                    },
                    {
                        "name": "sessionId",
                        "in": "path",
                        "description": "Call to Retreive",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Rereives Call Details",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "properties": {
                                                "": {
                                                    "$ref": "#/components/schemas/callSchema"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                },
                                "example": {
                                    "data": {
                                        "sessionId": "v1.us.31780434a95d45.16923681138d75114d60d1345a22e4cc612263fb26c0b5cf92",
                                        "totalAudioMinutes": 0.31666666666666665,
                                        "totalVideoMinutes": 0,
                                        "totalDuration": "00:00:19",
                                        "metaData": [],
                                        "hasRecording": false,
                                        "initiatedAt": 1692368113,
                                        "initiator": "superhero8",
                                        "mode": "call",
                                        "receiver": "superhero2",
                                        "receiverType": "user",
                                        "status": "ended",
                                        "tags": [],
                                        "totalDurationInMinutes": 0.31666666666666665,
                                        "totalParticipants": 2,
                                        "type": "audio",
                                        "mid": "855e1519-1244-4213-8e40-53044c1e9e43",
                                        "startedAt": 1692368127,
                                        "endedAt": 1692368146,
                                        "participants": [
                                            {
                                                "uid": "superhero2",
                                                "totalAudioMinutes": 0.23333333333333334,
                                                "totalVideoMinutes": 0,
                                                "totalDuration": 0.23333333333333334,
                                                "deviceId": "c9ed493e-8495-428d-b6ee-b32019cc57ce@rtc.cometchat-staging.com/CKT3xgR4",
                                                "isJoined": true,
                                                "joinedAt": 1692368132,
                                                "mid": "855e1519-1244-4213-8e40-53044c1e9e43",
                                                "state": "ended",
                                                "leftAt": 1692368146
                                            },
                                            {
                                                "uid": "superhero8",
                                                "totalAudioMinutes": 0.26666666666666666,
                                                "totalVideoMinutes": 0,
                                                "totalDuration": 0.26666666666666666,
                                                "deviceId": "70ecae89-b71c-4bb3-8220-b7c99ec1658f@rtc.cometchat-staging.com/hsYWb5ul",
                                                "isJoined": true,
                                                "joinedAt": 1692368128,
                                                "mid": "855e1519-1244-4213-8e40-53044c1e9e43",
                                                "state": "ended",
                                                "leftAt": 1692368144
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "apiKey": []
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "callSchema": {
                "description": "Response data",
                "properties": {
                    "sessionId": {
                        "type": "string"
                    },
                    "totalAudioMinutes": {
                        "type": "integer"
                    },
                    "totalVideoMinutes": {
                        "type": "integer"
                    },
                    "totalDuration": {
                        "type": "integer"
                    },
                    "hasRecording": {
                        "type": "boolean"
                    },
                    "initiatedAt": {
                        "type": "integer"
                    },
                    "initiator": {
                        "type": "string"
                    },
                    "mode": {
                        "type": "string"
                    },
                    "receiver": {
                        "type": "string"
                    },
                    "receiverType": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "totalDurationInMinutes": {
                        "type": "integer"
                    },
                    "totalParticipants": {
                        "type": "integer"
                    },
                    "type": {
                        "type": "string"
                    },
                    "mid": {
                        "type": "string"
                    },
                    "startedAt": {
                        "type": "integer"
                    },
                    "endedAt": {
                        "type": "integer"
                    },
                    "participants": {
                        "type": "array",
                        "items": {
                            "properties": {
                                "": {
                                    "$ref": "#/components/schemas/participantSchema"
                                }
                            },
                            "type": "object"
                        }
                    }
                },
                "type": "object"
            },
            "deleteSchema": {
                "properties": {
                    "success": {
                        "type": "boolean"
                    },
                    "message": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "metaSchema": {
                "properties": {
                    "pagination": {
                        "properties": {
                            "total": {
                                "type": "integer"
                            },
                            "count": {
                                "type": "integer"
                            },
                            "per_page": {
                                "type": "integer"
                            },
                            "current_page": {
                                "type": "integer"
                            },
                            "total_pages": {
                                "type": "integer"
                            }
                        },
                        "type": "object"
                    }
                },
                "type": "object"
            },
            "participantSchema": {
                "properties": {
                    "uid": {
                        "type": "string"
                    },
                    "totalAudioMinutes": {
                        "type": "integer"
                    },
                    "totalVideoMinutes": {
                        "type": "integer"
                    },
                    "isJoined": {
                        "type": "boolean"
                    },
                    "state": {
                        "type": "string"
                    },
                    "totalDuration": {
                        "type": "integer"
                    },
                    "deviceId": {
                        "type": "integer"
                    },
                    "joinedAt": {
                        "type": "integer"
                    },
                    "mid": {
                        "type": "string"
                    },
                    "leftAt": {
                        "type": "integer"
                    }
                },
                "type": "object"
            }
        },
        "parameters": {
            "uid": {
                "name": "uid",
                "in": "path",
                "description": "An UID of a user.",
                "required": true,
                "schema": {
                    "type": "string"
                },
                "examples": {
                    "string": {
                        "summary": "UID",
                        "value": ""
                    }
                }
            },
            "guid": {
                "name": "guid",
                "in": "path",
                "description": "A GUID of a group.",
                "required": true,
                "schema": {
                    "type": "string"
                },
                "examples": {
                    "string": {
                        "summary": "GUID",
                        "value": ""
                    }
                }
            },
            "requiredonBehalfOf": {
                "name": "onBehalfOf",
                "in": "header",
                "description": "UID of the user on whose behalf the action is performed.",
                "required": true,
                "schema": {
                    "type": "string"
                }
            },
            "onBehalfOf": {
                "name": "onBehalfOf",
                "in": "header",
                "description": "UID of the user on whose behalf the action is performed.",
                "schema": {
                    "type": "string"
                }
            }
        },
        "securitySchemes": {
            "apiKey": {
                "type": "apiKey",
                "description": "API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).",
                "name": "apikey",
                "in": "header"
            }
        }
    },
    "tags": [
        {
            "name": "Calls",
            "description": "The Calls tag"
        }
    ]
}