# SDKs

> Install an official Chunkify SDK and make your first API request.

Use an official SDK to call the [Chunkify API](/docs/api-reference) from your server. Choose your language below to install the SDK and create a Source from a hosted video.

Use the [playback tracker](/docs/integration/analytics) for browser events and the [Analytics Server SDKs](/docs/integration/analytics/server/sdk) to query playback reports or manage an Analytics Server.

## Create a Project access token

In the Chunkify app, open your Project and go to **Developers → API tokens**. Click **New Access Token** and copy the token, which starts with `sk_project_`.

Replace `My Project Access Token` in the examples with your token. See [API authentication](/docs/api-reference/authentication) for more information.

<warning>
    Keep access tokens on your server. Never expose them in browser code or commit them to source control.
</warning>


## Install and test your SDK

Each example creates a Source from a public sample video and prints its details.

<tabs>
    <tab title="TypeScript">
        The TypeScript SDK also supports server-side JavaScript. Use a [supported Node.js or Bun version](https://github.com/chunkifydev/chunkify-typescript#requirements).

        Install the SDK with npm:

        ```sh
        npm install @chunkify/chunkify
        ```

        Save the following as `example.mjs`. This JavaScript example runs in Node.js without a TypeScript build step:

        ```javascript
        import Chunkify from '@chunkify/chunkify';

        const client = new Chunkify({
            projectAccessToken: 'My Project Access Token',
        });

        const source = await client.sources.create({
            url: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
        });

        console.log(source);
        ```

        Run the example:

        ```sh
        node example.mjs
        ```

        With Bun, install using `bun add @chunkify/chunkify` and run using `bun run example.mjs`.

        <card layout="horizontal" title="Learn more on GitHub" icon="<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-code-icon lucide-code"><path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/></svg>" href="https://github.com/chunkifydev/chunkify-typescript">
            SDK documentation and examples for TypeScript.
        </card>
    </tab>
    <tab title="Python">
        Requires Python 3.9 or later.

        Install the SDK:

        ```sh
        python -m pip install chunkify-sdk
        ```

        Save the following as `example.py`:

        ```python
        from chunkify import Chunkify

        client = Chunkify(
            project_access_token="My Project Access Token",
        )

        source = client.sources.create(
            url="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
        )

        print(source)
        ```

        Run the example:

        ```sh
        python example.py
        ```

        <card layout="horizontal" title="Learn more on GitHub" icon="<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-code-icon lucide-code"><path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/></svg>" href="https://github.com/chunkifydev/chunkify-python">
            SDK documentation and examples for Python.
        </card>
    </tab>
    <tab title="PHP">
        Requires PHP 8.1 or later and Composer.

        Install the SDK:

        ```sh
        composer require chunkify/chunkify-php
        ```

        Save the following as `example.php`:

        ```php
        <?php

        use Chunkify\Client;

        require_once __DIR__ . '/vendor/autoload.php';

        $client = new Client(
            projectAccessToken: 'My Project Access Token',
        );

        $source = $client->sources->create(
            url: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
        );

        print_r($source);
        ```

        Run the example:

        ```sh
        php example.php
        ```

        <card layout="horizontal" title="Learn more on GitHub" icon="<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-code-icon lucide-code"><path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/></svg>" href="https://github.com/chunkifydev/chunkify-php">
            SDK documentation and examples for PHP.
        </card>
    </tab>
    <tab title="Go">
        Requires Go 1.22 or later. In your application's Go module, install the SDK:

        ```sh
        go get github.com/chunkifydev/chunkify-go
        ```

        Save the following as `example.go`:

```go
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/chunkifydev/chunkify-go"
	"github.com/chunkifydev/chunkify-go/option"
)

func main() {
	client := chunkify.NewClient(
		option.WithProjectAccessToken("My Project Access Token"),
	)

	source, err := client.Sources.New(
		context.Background(),
		chunkify.SourceNewParams{
			URL: chunkify.String("https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"),
		},
	)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("%+v\n", source)
}
```

        Run the example:

        ```sh
        go run example.go
        ```

        <card layout="horizontal" title="Learn more on GitHub" icon="<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-code-icon lucide-code"><path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/></svg>" href="https://github.com/chunkifydev/chunkify-go">
            SDK documentation and examples for Go.
        </card>
    </tab>
</tabs>

## Next steps

Follow [Create your first video stream](/docs/video-streaming/quickstart) to create a video asset, receive its playback URL through a webhook, and play the video.
