> For the complete documentation index, see [llms.txt](https://capsule-video.gitbook.io/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://capsule-video.gitbook.io/cloud/capsule-cloud/getting-started.md).

# Getting Started

The Hypno Cloud API gives developers a way to leverage the power of the Hypno API from any online application. You won't get the instant playback capability provided by the iOS library, but the same scripts can be used for both and will generate the same output.

Full API documentation can be found here: <https://app.swaggerhub.com/apis-docs/hypno/cloud/>

Here are some usage examples:

**`POST /packages`**

Create new package. A package is a zip file with a hypno script and supporting assets, usually created with Nyx (using the "Share project" button in the upper right).&#x20;

{% hint style="info" %}
The package .zip file must include a .nyxproj including all files referenced inside the Nyx project file or inside any JavaScript files within the project. Use "Share Project" button in the upper right of the Nyx IDE.
{% endhint %}

{% hint style="info" %}
The following cURL examples use a "test" API key for demo purposes only. The requests made with this key are throttled to minimize performance degradation on our system. Please contact us for a production API key if you are planning to use HYPNO cloud in a production environment.
{% endhint %}

```bash
curl -X POST \
-H "Authorization: Bearer sk_test_9fa9650d5ffc4109ac1ccd63999b928f" \
-F "package=@NyxProject.zip" \
"https://cloud-api.hypno.com/packages"
```

This will return a `packageId` that can be used for subsequent job requests (renders) using that package.

**`POST /jobs`**

Create new job with a specified package.

```bash
curl -X POST \
-H "Authorization: Bearer sk_test_9fa9650d5ffc4109ac1ccd63999b928f" \
-F "camera=@input.mp4" \
"https://cloud-api.hypno.com/jobs?packageId=5f0601e142b7f7704e33dd2e"
```

This will return a `jobId` that can be used for downloading complete job request renders.

**`GET /jobs/{id}`**

Gets status for a specific job.

```bash
curl -X GET \
-H "Authorization: Bearer sk_test_9fa9650d5ffc4109ac1ccd63999b928f" \
"https://cloud-api.hypno.com/jobs/5f06026642b7f7704e33dd30"
```

Below is a list of status codes that can be used to determine the state of a job.

| Status Code | Status Message |
| ----------- | -------------- |
| 0           | Unknown        |
| 1           | Waiting        |
| 2           | Exporting      |
| 3           | Completed      |
| 4           | Failed         |
| 5           | Cancelled      |

**`GET /media/{id}`**

Returns the completed media file for the specified `jobId`.

```bash
curl -X GET \
-H "Authorization: Bearer sk_test_9fa9650d5ffc4109ac1ccd63999b928f" \
-o output.mp4 \
"https://cloud-api.hypno.com/media/5f06026642b7f7704e33dd30"
```

### Support

If you have any questions or run into issues please reach out to <developer-support@hypno.com> and we'll get back to you as soon as possible.&#x20;

We also have a support channel on Slack. Email us at the address above if you'd like an invite.
