# iOS / Swift Integration

If you work on an e-commerce iOS app, you know how important it is to provide users with high-quality images of the products they want to sell. However, taking pictures with a clean background can be a challenge for many users. This is where the Photoroom API comes in handy!

With the Photoroom API, you can easily remove the background of images in your iOS app, improving the overall quality of the pictures your users will upload.

In this tutorial, I will show you how you can integrate the Photoroom API into your iOS app in just a few minutes.

### Step 1: Get Your API Key

The first thing you need to do is get your API key.

If you don't already have an API key, here are the [steps to create yours](/getting-started/introduction.md#how-can-i-get-my-api-key).

### Step 2: Use our Sample Code

Visit [Photoroom’s GitHub](https://github.com/PhotoRoom/api-code-samples) to find a sample code that's ready to use. Simply copy and paste the code into your Xcode project, and update the placeholder with your own API key.

![](https://a.storyblok.com/f/191576/2878x2382/5065fd3da2/how-to-easily-remove-the-background-of-images-inside-your-ios-app-002.png)

### Step 3: Call the API

Now it's time to call the API in your code! Just use the function removeBackground(of: yourImage) and pass in your original UIImage as an argument. The function will return a new UIImage with the background removed.

```swift
// with Swift Concurrency
Task { @MainActor in
    imageView.image = try await removeBackground(of: yourImage)
}

// without Swift Concurrency
removeBackground(of: yourImage) { result in
    switch result {
    case let .success(backgroundRemoved):
        imageView.image = backgroundRemoved
    case let .failure(error):
        // handle the `error`
    }
}
```

### ![](https://a.storyblok.com/f/191576/256x555/fc72482859/how-to-easily-remove-the-background-of-images-inside-your-ios-app-003.gif)You're done!

That's it! With just these three easy steps, you can integrate the Photoroom Background Removal API into your iOS app and provide your users with high-quality images with clean backgrounds.

According to resellers who use the Photoroom app, this feature can increase sales by 20 up to 100%.

If you want to learn more about the Photoroom API and get your API key, visit <https://www.photoroom.com/api>.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.photoroom.com/remove-background-api-basic-plan/code-samples/ios-swift-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
