{"_id":"59796d1140a3a2001f068cbe","category":{"_id":"59796d1140a3a2001f068cb5","version":"59796d1140a3a2001f068cb4","project":"5669937dfc5abf2300afe7de","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-12-10T15:00:15.293Z","from_sync":false,"order":0,"slug":"documentation","title":"Documentation"},"project":"5669937dfc5abf2300afe7de","user":"543532513513400800a144f4","parentDoc":null,"version":{"_id":"59796d1140a3a2001f068cb4","project":"5669937dfc5abf2300afe7de","__v":2,"createdAt":"2017-07-27T04:33:21.278Z","releaseDate":"2017-07-27T04:33:21.278Z","categories":["59796d1140a3a2001f068cb5","59796d1140a3a2001f068cb6","59796d1140a3a2001f068cb7","59796d1140a3a2001f068cb8","5acb7bc606a2ce0003f28da4"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2.0"},"githubsync":"","__v":0,"metadata":{"title":"","description":"","image":[]},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-01-04T17:31:53.123Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[]},"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"Authenticating to SafeStream requires a Client ID and API Key. You can authenticate by including them in the header of each request you make. Here's an example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /2.0/videos?key=myvideo HTTP/1.1\\nx-api-client-id: YOUR-CLIENT-ID\\nx-api-key: YOUR-API-KEY\\nHost: s2-api.safestream.com\\nConnection: close\\nUser-Agent: Paw/3.1.2 (Macintosh; OS X/10.12.6) GCDHTTPRequest\",\n      \"language\": \"http\"\n    }\n  ]\n}\n[/block]\nNotice the headers **x-api-client-id** and ** x-api-key**. You should include these in every request that you make to the SafeStream API. \n\nOnce you have your auth token you can begin making requests to the SafeStream API. Requests using your authentication token will look slightly different. Instead of sending your API key and client ID with each request you will send your authentication token in the authorization header. Here's an example:\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"HMAC Authentication\",\n  \"body\": \"When you're watermarking your videos, SafeStream will return URL's where you can access them. These URLs will be HMAC signed and do not require these authentication headers.\"\n}\n[/block]","excerpt":"This page describes how to authenticate to the SafeStream API","slug":"authentication","type":"basic","title":"Authentication"}

Authentication

This page describes how to authenticate to the SafeStream API

Authenticating to SafeStream requires a Client ID and API Key. You can authenticate by including them in the header of each request you make. Here's an example: [block:code] { "codes": [ { "code": "GET /2.0/videos?key=myvideo HTTP/1.1\nx-api-client-id: YOUR-CLIENT-ID\nx-api-key: YOUR-API-KEY\nHost: s2-api.safestream.com\nConnection: close\nUser-Agent: Paw/3.1.2 (Macintosh; OS X/10.12.6) GCDHTTPRequest", "language": "http" } ] } [/block] Notice the headers **x-api-client-id** and ** x-api-key**. You should include these in every request that you make to the SafeStream API. Once you have your auth token you can begin making requests to the SafeStream API. Requests using your authentication token will look slightly different. Instead of sending your API key and client ID with each request you will send your authentication token in the authorization header. Here's an example: [block:callout] { "type": "warning", "title": "HMAC Authentication", "body": "When you're watermarking your videos, SafeStream will return URL's where you can access them. These URLs will be HMAC signed and do not require these authentication headers." } [/block]