# Pipes2 Signed URLs JSON schema

Following is the documentation of the expected JSON response provided by your Signed URLs service.

:::tip
If you want to know how to implement your own `Signed URL Endpoints` please read the
[Signed URL Endpoints doc](./pipes2-signed-urls).
:::

## The Structure of a JSON response

The expected JSON response should follow [JSON:API](https://jsonapi.org/) specifications for successful or failed response, setting using `application/vnd.api+json` as content-type.

Following JSON:API specs each response MUST contain at least one of the following top-level members:

- `data`: the document’s "primary data"
- `errors`: an array of error objects.
- `meta`: a meta object that contains non-standard meta-information.

## Example of Successful Response

HTTP/1.1 200 OK

Content-Type: application/vnd.api+json

```json
{
  "data": {
    "type": "video",
    "id": "1",
    "attributes": {
      "stream_src": "https://example.com/videos/1.m3u8?some_token=exp=1568618354~acl=/*~hmac=0531950b24caa52cec6f481f50b9747786b9&stime=1568618054&etime=1568618354"
    }
  }
}
```

## Fields

### `id`

(required, string) A unique id for the resource.

### `type`

(required, object) Should identify the resource type

### `attributes.stream_src`

(required, string) In plain text. Should return a playable stream to be used in the video player.

## Example of Failed Response

HTTP/1.1 422 Unprocessable Entity

Content-Type: application/vnd.api+json

```json
{
  "errors": [
    {
      "status": "422",
      "title": "Invalid Attribute",
      "detail": "src must must be one of the following types: m3u8, mpd."
    }
  ]
}
```
