> ## Documentation Index
> Fetch the complete documentation index at: https://dev.pika.art/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Pikaswaps

> Swap out any object or region of your video with a new image or object. Define areas to replace either with a mask or coordinates.



## OpenAPI

````yaml post /generate/pikaswaps
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security: []
paths:
  /generate/pikaswaps:
    post:
      summary: Generate Pikaswaps
      description: >-
        Exactly one of `modifyRegionMask` and `modifyRegionRoi` must be
        provided.
      operationId: generate_pikaswaps_generate_pikaswaps_post
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: >-
                #/components/schemas/Body_generate_pikaswaps_generate_pikaswaps_post
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: curl
          label: modifyRegionMask
          source: |-
            curl -X POST 'https://devapi.pika.art/generate/pikaswaps' \
            -H 'X-API-KEY: your_api_key' \
            -H 'Accept: multipart/form-data' \
            -F 'video=@video.mp4;type=video/mp4' \
            -F 'image=@image.jpg;type=image/jpg' \
            -F 'modifyRegionMask=@mask.jpg;type=image/jpg' \
            -F 'promptText=Replace the background with a beautiful beach' \
            -F 'negativePrompt=blurry, low quality' \
            -F 'seed=12345'
        - lang: python
          label: modifyRegionMask
          source: >

            import requests

            import json


            url = "https://devapi.pika.art/generate/pikaswaps"

            payload = {
                "promptText": "Replace the background with a beautiful beach",
                "negativePrompt": "blurry, low quality",
                "seed": 12345,
            }

            headers = {
                "X-API-KEY": "your_api_key",
                "Accept": "multipart/form-data"
            }

            files = [
                ("video", ("video.mp4", open("video.mp4", "rb"), "video/mp4")),
                ("image", ("image.jpg", open("image.jpg", "rb"), "image/jpg")),
                ("modifyRegionMask", ("mask.jpg", open("mask.jpg", "rb"), "image/jpg"))
            ]

            response = requests.post(url, data=payload, headers=headers,
            files=files)

            print(response.json())
        - lang: curl
          label: modifyRegionRoi
          source: |-
            curl -X POST 'https://devapi.pika.art/generate/pikaswaps' \
            -H 'X-API-KEY: your_api_key' \
            -H 'Accept: multipart/form-data' \
            -F 'video=@video.mp4;type=video/mp4' \
            -F 'image=@image.jpg;type=image/jpg' \
            -F 'modifyRegionRoi=The person wearing red clothes' \
            -F 'promptText=Replace the person in the video with a monster' \
            -F 'negativePrompt=blurry, low quality' \
            -F 'seed=12345'
        - lang: python
          label: modifyRegionRoi
          source: >

            import requests

            import json


            url = "https://devapi.pika.art/generate/pikaswaps"

            payload = {
                "promptText": "Replace the person in the video with a monster",
                "negativePrompt": "blurry, low quality",
                "seed": 12345,
                "modifyRegionRoi": "The person wearing red clothes",
            }

            headers = {
                "X-API-KEY": "your_api_key",
                "Accept": "multipart/form-data"
            }

            files = [
                ("video", ("video.mp4", open("video.mp4", "rb"), "video/mp4")),
                ("image", ("image.jpg", open("image.jpg", "rb"), "image/jpg"))
            ]

            response = requests.post(url, data=payload, headers=headers,
            files=files)

            print(response.json())
components:
  schemas:
    Body_generate_pikaswaps_generate_pikaswaps_post:
      properties:
        video:
          type: string
          format: binary
          title: Video
        image:
          anyOf:
            - type: string
              format: binary
            - type: 'null'
          title: Image
        promptText:
          anyOf:
            - type: string
            - type: 'null'
          title: Prompttext
        modifyRegionMask:
          anyOf:
            - type: string
              format: binary
            - type: 'null'
          title: Modifyregionmask
          description: >-
            A mask image that specifies the region to modify, where the mask is
            white and the background is black
        modifyRegionRoi:
          anyOf:
            - type: string
            - type: 'null'
          title: Modifyregionroi
          description: Plaintext description of the object / region to modify
        negativePrompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Negativeprompt
        seed:
          anyOf:
            - type: integer
            - type: 'null'
          title: Seed
      type: object
      required:
        - video
      title: Body_generate_pikaswaps_generate_pikaswaps_post
    GenerateResponse:
      properties:
        video_id:
          type: string
          title: Video Id
      type: object
      required:
        - video_id
      title: GenerateResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````