# Upload File API

{% openapi src="<https://4054772100-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUAxFCxNtDJTPCgUnSsK1%2Fuploads%2Fgit-blob-2a23140791b57b4d43d3eb7a3a5ef34462c26407%2Fopenapi.json?alt=media>" path="/projects/upload-file" method="post" %}
[openapi.json](https://4054772100-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUAxFCxNtDJTPCgUnSsK1%2Fuploads%2Fgit-blob-2a23140791b57b4d43d3eb7a3a5ef34462c26407%2Fopenapi.json?alt=media)
{% endopenapi %}

## Overview

Upload a packaged Unreal Engine build (`.zip`) to your Streampixel project by providing a publicly accessible download URL. This API is used by CI/CD pipelines, automation tools, and the official Unreal Plugin.

### Typical Workflow

1. **Build** your Unreal Engine project
2. **Package** it into a `.zip` file
3. **Upload** the `.zip` to your own cloud storage (S3, GCS, etc.)
4. **Call this API** with the public download link

## Prerequisites

Before calling this endpoint, ensure you have:

| Requirement | Where to Get It                                                                                           |
| ----------- | --------------------------------------------------------------------------------------------------------- |
| API Key     | [API Authentication](https://docs.streampixel.io/resources/api-reference/api-authentication)              |
| User ID     | [Finding Your IDs](https://docs.streampixel.io/resources/api-reference/finding-your-user-and-project-ids) |
| Project ID  | [Finding Your IDs](https://docs.streampixel.io/resources/api-reference/finding-your-user-and-project-ids) |
| File URL    | Your cloud storage (see requirements below)                                                               |

## File URL Requirements

{% hint style="danger" %}
The `fileUrl` must be a **direct download link**. The moment Streampixel accesses it, the `.zip` download must begin immediately — no login pages, redirects, HTML wrappers, or download buttons.
{% endhint %}

**Supported hosting:**

* AWS S3 (signed or public URL)
* Google Cloud Storage
* DigitalOcean Spaces
* Any HTTP-accessible file server

**Examples:**

|           | URL                                                |
| --------- | -------------------------------------------------- |
| ✅ Valid   | `https://your-bucket.s3.amazonaws.com/MyBuild.zip` |
| ❌ Invalid | `https://drive.google.com/file/d/abc123/view`      |

## Code Examples

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST https://api.streampixel.io/pixelStripeApi/projects/upload-file \
  -H "Content-Type: application/json" \
  -d '{
    "apiKey": "[YOUR_API_KEY]",
    "userId": "[YOUR_USER_ID]",
    "fileUrl": "[PUBLIC_FILE_URL]",
    "projectId": "[YOUR_PROJECT_ID]",
    "autoRelease": true
  }'
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const axios = require('axios');

const response = await axios.post(
  'https://api.streampixel.io/pixelStripeApi/projects/upload-file',
  {
    apiKey: '[YOUR_API_KEY]',
    userId: '[YOUR_USER_ID]',
    fileUrl: '[PUBLIC_FILE_URL]',
    projectId: '[YOUR_PROJECT_ID]',
    autoRelease: false,
  }
);

console.log('Upload successful:', response.data);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

response = requests.post(
    "https://api.streampixel.io/pixelStripeApi/projects/upload-file",
    json={
        "apiKey": "[YOUR_API_KEY]",
        "userId": "[YOUR_USER_ID]",
        "fileUrl": "[PUBLIC_FILE_URL]",
        "projectId": "[YOUR_PROJECT_ID]",
        "autoRelease": False,
    }
)

print("Upload successful:", response.json())
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
  "bytes"
  "encoding/json"
  "fmt"
  "net/http"
)

func main() {
  url := "https://api.streampixel.io/pixelStripeApi/projects/upload-file"

  data := map[string]interface{}{
    "apiKey":      "[YOUR_API_KEY]",
    "userId":      "[YOUR_USER_ID]",
    "fileUrl":     "[PUBLIC_FILE_URL]",
    "projectId":   "[YOUR_PROJECT_ID]",
    "autoRelease": false,
  }

  body, _ := json.Marshal(data)
  resp, err := http.Post(url, "application/json", bytes.NewBuffer(body))
  if err != nil {
    fmt.Println("Request failed:", err)
    return
  }
  defer resp.Body.Close()

  fmt.Println("Response status:", resp.Status)
}
```

{% endtab %}

{% tab title="Java" %}

```java
import okhttp3.*;

public class UploadFile {
    public static void main(String[] args) throws Exception {
        OkHttpClient client = new OkHttpClient();

        MediaType mediaType = MediaType.parse("application/json");
        String jsonBody = "{"
            + "\"apiKey\":\"[YOUR_API_KEY]\","
            + "\"userId\":\"[YOUR_USER_ID]\","
            + "\"fileUrl\":\"[PUBLIC_FILE_URL]\","
            + "\"projectId\":\"[YOUR_PROJECT_ID]\","
            + "\"autoRelease\":false"
            + "}";

        RequestBody body = RequestBody.create(mediaType, jsonBody);
        Request request = new Request.Builder()
            .url("https://api.streampixel.io/pixelStripeApi/projects/upload-file")
            .post(body)
            .addHeader("Content-Type", "application/json")
            .build();

        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}
```

{% endtab %}
{% endtabs %}

## What Happens After Upload

Once your request is accepted:

1. The build is sent to the **Build Manager Server** for downloading and validation
2. The system verifies that the `.zip` is accessible and properly structured
3. If validation passes, the build is linked to your project

{% hint style="info" %}
You can track each stage of this pipeline via [Webhooks](https://docs.streampixel.io/resources/api-reference/webhooks) — listen for `build.downloading`, `build.extracting`, `build.saving`, and `build.approved` events.
{% endhint %}

## Confirming Success

Verify your build was uploaded by:

* Logging in to your [Streampixel Dashboard](https://dashboard.streampixel.io)
* Navigating to your project's detail page
* The uploaded build will appear in the build list, showing its processing status
