Runway API

API

Runway AI API Overview

Welcome to the Runway AI API, a comprehensive suite designed to facilitate AI-powered image and video generation, editing, and transformation. This API enables developers to seamlessly integrate the power of Runway AI into their applications, offering extensive functionality across various media tasks such as generating creative images, transforming video sequences, and applying advanced filters.

The base URL for accessing the API is:

Base URL: https://api.runway-ai.ai/

To obtain an API key for the Runway AI, log in to your account and navigate to the Personal Cabinet section. Once there, go to the API Access tab, where you will find the option to generate a new API key. Click the Generate API Key button, and a unique key will be created for your account. You can copy the API key and use it for authenticating your API requests. Ensure that you store the key securely, as it will be required for accessing the various endpoints of the Runway AI API.

Obtaining an API key for the Runway AI API

Below is a detailed description of all endpoints available in the Runway AI API.


1. Generate Image

URL: POST /v1/generate-image

Parameters:

  • prompt (string, required): The textual description to generate the image.
  • style (string, optional): The artistic style to apply to the image. Options include “photorealistic”, “sketch”, “abstract”.

Output:
Returns a JSON object with the URL of the generated image.

{
  "image_url": "https://api.runway-ai.ai/images/{image_id}.jpg"
}

2. Edit Image

URL: POST /v1/edit-image

Parameters:

  • image_url (string, required): The URL of the image to edit.
  • edit_type (string, required): Specifies the type of edit. Options include “color-adjust”, “add-filter”, “resize”.
  • filter (string, optional): Name of the filter to apply, e.g., “sepia”, “black-and-white”.
  • resize_width (int, optional): New width for resizing the image.
  • resize_height (int, optional): New height for resizing the image.

Output:
Returns a JSON object with the URL of the edited image.

{
  "edited_image_url": "https://api.runway-ai.ai/images/{edited_image_id}.jpg"
}

3. Generate Video from Text

URL: POST /v1/generate-video

Parameters:

  • prompt (string, required): The textual description to generate a video sequence.
  • duration (int, required): The duration of the video in seconds.
  • fps (int, optional): Frames per second, default is 24.

Output:
Returns a JSON object with the URL of the generated video.

{
  "video_url": "https://api.runway-ai.ai/videos/{video_id}.mp4"
}

4. Edit Video

URL: POST /v1/edit-video

Parameters:

  • video_url (string, required): The URL of the video to edit.
  • edit_type (string, required): Specifies the type of edit. Options include “trim”, “add-filter”, “adjust-speed”.
  • start_time (int, optional): The starting point of trimming (in seconds).
  • end_time (int, optional): The ending point of trimming (in seconds).

Output:
Returns a JSON object with the URL of the edited video.

{
  "edited_video_url": "https://api.runway-ai.ai/videos/{edited_video_id}.mp4"
}

5. Apply Filter to Video

URL: POST /v1/video-filter

Parameters:

  • video_url (string, required): The URL of the video to apply the filter.
  • filter (string, required): Name of the filter to apply, e.g., “vintage”, “cinematic”, “black-and-white”.

Output:
Returns a JSON object with the URL of the filtered video.

{
  "filtered_video_url": "https://api.runway-ai.ai/videos/{filtered_video_id}.mp4"
}

6. Get Image Metadata

URL: GET /v1/image-metadata

Parameters:

  • image_url (string, required): The URL of the image to retrieve metadata for.

Output:
Returns metadata for the specified image, including size, dimensions, and creation time.

{
  "image_id": "{image_id}",
  "size": "2MB",
  "width": 1024,
  "height": 768,
  "created_at": "2024-09-12T10:00:00Z"
}

7. Get Video Metadata

URL: GET /v1/video-metadata

Parameters:

  • video_url (string, required): The URL of the video to retrieve metadata for.

Output:
Returns metadata for the specified video, including size, duration, and creation time.

{
  "video_id": "{video_id}",
  "size": "50MB",
  "duration": "30s",
  "created_at": "2024-09-12T10:00:00Z"
}

8. Convert Image to Video

URL: POST /v1/image-to-video

Parameters:

  • image_url (string, required): The URL of the image to convert.
  • duration (int, required): The duration of the video in seconds.

Output:
Returns a video generated from the image.

{
  "video_url": "https://api.runway-ai.ai/videos/{video_id}.mp4"
}

9. Add Text to Image

URL: POST /v1/add-text-to-image

Parameters:

  • image_url (string, required): The URL of the image to add text to.
  • text (string, required): The text to overlay on the image.
  • position (string, required): The position where the text should be added (e.g., “top-left”, “bottom-right”).
  • font_size (int, optional): The size of the font for the text.

Output:
Returns the edited image with the added text.

{
  "text_image_url": "https://api.runway-ai.ai/images/{text_image_id}.jpg"
}

10. Apply Image Style Transfer

URL: POST /v1/style-transfer

Parameters:

  • image_url (string, required): The URL of the image to apply style transfer.
  • style_reference (string, required): The style reference image URL.

Output:
Returns the image with the transferred style.

{
  "styled_image_url": "https://api.runway-ai.ai/images/{styled_image_id}.jpg"
}

11. Resize Video

URL: POST /v1/resize-video

Parameters:

  • video_url (string, required): The URL of the video to resize.
  • new_width (int, required): The new width for the video.
  • new_height (int, required): The new height for the video.

Output:
Returns the resized video.

{
  "resized_video_url": "https://api.runway-ai.ai/videos/{resized_video_id}.mp4"
}

12. Generate Thumbnail for Video

URL: POST /v1/generate-thumbnail

Parameters:

  • video_url (string, required): The URL of the video to generate a thumbnail from.
  • time_position (int, optional): The time in the video (in seconds) where the thumbnail should be generated.

Output:
Returns the URL of the generated thumbnail image.

{
  "thumbnail_url": "https://api.runway-ai.ai/images/{thumbnail_image_id}.jpg"
}

13. Extract Audio from Video

URL: POST /v1/extract-audio

Parameters:

  • video_url (string, required): The URL of the video to extract audio from.

Output:
Returns a JSON object with the URL of the extracted audio file.

{
  "audio_url": "https://api.runway-ai.ai/audios/{audio_id}.mp3"
}

14. Apply Video Speed Adjustment

URL: POST /v1/speed-adjust

Parameters:

  • video_url (string, required): The URL of the video to adjust speed.
  • speed_factor (float, required): The factor by which the speed should be adjusted (e.g., 0.5 for half speed, 2 for double speed).

Output:
Returns the video with adjusted speed.

{
  "adjusted_speed_video_url": "https://api.runway-ai.ai/videos/{adjusted_speed_video_id}.mp4"
}

15. Delete Media

URL: DELETE /v1/delete-media

Parameters:

  • media_url (string, required): The URL of the image or video to delete.
  • auth_token (string, required): A token to authenticate the deletion request.

Output:
Returns a success message confirming deletion.

{
  "message": "Media successfully deleted"
}

This API documentation provides a detailed overview of the Runway AI API endpoints and their capabilities. For more information or assistance, please contact our support team.