# Create composition **POST /v1/Compositions** Recording compositions ## Servers - https://video.twilio.com: https://video.twilio.com () ## Authentication methods - Account sid auth token ## Parameters ### Body: application/x-www-form-urlencoded (object) - **RoomSid** (string) The SID of the Group Room with the media tracks to be used as composition sources. - **VideoLayout** () An object that describes the video layout of the composition in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request - **AudioSources** (array[string]) An array of track names from the same group room to merge into the new composition. Can include zero or more track names. The new composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which will match zero or more characters in a track name. For example, `student*` includes `student` as well as `studentTeam`. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request - **AudioSourcesExcluded** (array[string]) An array of track names to exclude. The new composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which will match zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. - **Resolution** (string) A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to `640x480`. The string's format is `{width}x{height}` where: * 16 <= `{width}` <= 1280 * 16 <= `{height}` <= 1280 * `{width}` * `{height}` <= 921,600 Typical values are: * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240` Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. - **Format** (string) The container format of the composition's media files as specified in the POST request that created the Composition resource. See [POST Parameters](https://www.twilio.com/docs/video/api/compositions-resource#http-post-parameters) for more information. - **StatusCallback** (string(uri)) The URL we should call using the `status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched. - **StatusCallbackMethod** (string(http-method)) The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. - **Trim** (boolean) Whether to clip the intervals where there is no active media in the composition. The default is `true`. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. ## Responses ### 201 Created #### Headers - **Access-Control-Allow-Origin** (string) Specify the origin(s) allowed to access the resource - **Access-Control-Allow-Methods** (string) Specify the HTTP methods allowed when accessing the resource - **Access-Control-Allow-Headers** (string) Specify the headers allowed when accessing the resource - **Access-Control-Allow-Credentials** (boolean) Indicates whether the browser should include credentials - **Access-Control-Expose-Headers** (string) Headers exposed to the client #### Body: application/json (object) - **account_sid** (string | null) The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Composition resource. - **status** (string) The status of the composition. Can be: `enqueued`, `processing`, `completed`, `deleted` or `failed`. `enqueued` is the initial state and indicates that the composition request has been received and is scheduled for processing; `processing` indicates the composition is being processed; `completed` indicates the composition has been completed and is available for download; `deleted` means the composition media has been deleted from the system, but its metadata is still available for 30 days; `failed` indicates the composition failed to execute the media processing task. - **date_created** (string(date-time) | null) The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - **date_completed** (string(date-time) | null) The date and time in GMT when the composition's media processing task finished, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - **date_deleted** (string(date-time) | null) The date and time in GMT when the composition generated media was deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - **sid** (string | null) The unique string that we created to identify the Composition resource. - **room_sid** (string | null) The SID of the Group Room that generated the audio and video tracks used in the composition. All media sources included in a composition must belong to the same Group Room. - **audio_sources** (array[string] | null) The array of track names to include in the composition. The composition includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. - **audio_sources_excluded** (array[string] | null) The array of track names to exclude from the composition. The composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. - **video_layout** (object | null) An object that describes the video layout of the composition in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. - **resolution** (string | null) The dimensions of the video image in pixels expressed as columns (width) and rows (height). The string's format is `{width}x{height}`, such as `640x480`. - **trim** (boolean | null) Whether to remove intervals with no media, as specified in the POST request that created the composition. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. - **format** (string) The container format of the composition's media files as specified in the POST request that created the Composition resource. See [POST Parameters](https://www.twilio.com/docs/video/api/compositions-resource#http-post-parameters) for more information. - **bitrate** (integer) The average bit rate of the composition's media. - **size** (integer(int64) | null) The size of the composed media file in bytes. - **duration** (integer) The duration of the composition's media file in seconds. - **media_external_location** (string(uri) | null) The URL of the media file associated with the composition when stored externally. See [External S3 Compositions](/docs/video/api/external-s3-compositions) for more details. - **status_callback** (string(uri) | null) The URL called using the `status_callback_method` to send status information on every composition event. - **status_callback_method** (string(http-method) | null) The HTTP method used to call `status_callback`. Can be: `POST` or `GET`, defaults to `POST`. - **url** (string(uri) | null) The absolute URL of the resource. - **links** (object(uri-map) | null) The URL of the media file associated with the composition. [Powered by Bump.sh](https://bump.sh)