{"Status":true,"Message":"","Response":{"post":{"postuid":"8cc14bea-67f2-4d49-9d4a-ae3d262c5b14","tenantuid":"d8b744fc-2e70-4089-bb80-dd1d08f6c7b2","projectuid":"542e5f51-33cf-401f-aebe-4324ebe36fe4","title":"Authorization and Authentication","slug":"docs/create-and-use-an-api-token","html":"\u003Cp\u003ETo use the DailyStory REST API you will first need an API token. To create an API token login to DailyStory and then go to\u0026nbsp;\u003Ccode\u003EAccount Settings \u0026gt; API Tokens\u003C/code\u003E:\u003C/p\u003E\u003Cimg class=\u0022lazy-load\u0022 data-width=\u00221059\u0022 data-height=\u0022662\u0022 data-src=\u0022https://graffiti-auf7e6dwhxhcbwek.z03.azurefd.net/d8b744fc-2e70-4089-bb80-dd1d08f6c7b2/542e5f51-33cf-401f-aebe-4324ebe36fe4/6544ace4-9dd0-40a4-943b-db1c909a9308.png?v=1361764743\u0022 style=\u0022\u0022 alt=\u0022\u0022/\u003E\u003Cp\u003EFrom here you can click the \u0022\u002B Create new\u0022 to generate a new token or revoke existing tokens.\n\n\u003C/p\u003E\u003Ccite class=\u0022recommended\u0022\u003E\u003Cspan class=\u0022title\u0022\u003ERecommended\u003C/span\u003E\u003Cp\u003EAs a best practice, we recommend creating separate tokens for each application integrated with DailyStory.\u003C/p\u003E\u003C/cite\u003E\u003Ch2 id=\u0022using_the_api_token_in_a_requesta_hrefhttpsdevdailystorycomdocscreateanduseanapitokenusingtheapitokeninarequesta\u0022\u003EUsing the API Token in a Request\u003Ca href=\u0022https://dev.dailystory.com/docs/create-and-use-an-api-token#using-the-api-token-in-a-request\u0022\u003E\u003C/a\u003E\u003C/h2\u003E\u003Cp\u003EAll requests made to the DailyStory API require 2 pieces of information:\u003C/p\u003E\u003Cul\u003E\u003Cli\u003E\u003Cb\u003EAPI end point\u003C/b\u003E - the end point of the API and it is unique to the instance of DailyStory your app is running on.\u003C/li\u003E\u003Cli\u003E\u003Cb\u003ERequest Authorization\u003C/b\u003E - request authorization is achieved by including the API token with the request. \u003C/li\u003E\u003C/ul\u003E\u003Ch2 id=\u0022api_end_pointa_hrefhttpsdevdailystorycomdocscreateanduseanapitokenapiendpointa\u0022\u003EAPI End Point\u003Ca href=\u0022https://dev.dailystory.com/docs/create-and-use-an-api-token#api-end-point\u0022\u003E\u003C/a\u003E\u003C/h2\u003E\u003Cp\u003EUse of the API requires you to use a specific data center identifier (or instance identifier) when making an API request. When logged in to DailyStory this can be determined by examining the URL.\u003C/p\u003E\u003Cp\u003EFor example,\u0026nbsp;\u003Ca target=\u0022_self\u0022 href=\u0022https://us-1.dailystory.com/\u0022\u003Ehttps://us-1.dailystory.com\u003C/a\u003E\u0026nbsp;uses the\u0026nbsp;\u003Ccode\u003Eus-1\u003C/code\u003E\u0026nbsp;data center. Whereas\u0026nbsp;\u003Ca target=\u0022_self\u0022 href=\u0022https://uk-3.dailystory.com/\u0022\u003Ehttps://uk-3.dailystory.com\u003C/a\u003E\u0026nbsp;uses the\u0026nbsp;\u003Ccode\u003Euk-3\u003C/code\u003E\u0026nbsp;data center.\u003C/p\u003E\u003Ccite class=\u0022important\u0022\u003E\u003Cspan class=\u0022title\u0022\u003EImportant\u003C/span\u003E\u003Cp\u003EAll API requests are made using the URL that includes your data center, e.g.\u0026nbsp;\u003Ca target=\u0022_self\u0022 href=\u0022https://us-1.dailystory.com/api/v1/about\u0022\u003Ehttps://us-1.dailystory.com/api/v1/about\u003C/a\u003E. In this example, us-1 is the data center. DailyStory\u0027s application centers are provided regionally.\u003C/p\u003E\u003C/cite\u003E\u003Ch2 id=\u0022request_authorizationa_hrefhttpsdevdailystorycomdocscreateanduseanapitokenrequestauthorizationa\u0022\u003ERequest Authorization\u003Ca href=\u0022https://dev.dailystory.com/docs/create-and-use-an-api-token#request-authorization\u0022\u003E\u003C/a\u003E\u003C/h2\u003E\u003Cp\u003EThe DailyStory API requires that all API requests are made over HTTPS and is authenticated using either a\u0026nbsp;\u003Ca target=\u0022_self\u0022 href=\u0022https://en.wikipedia.org/wiki/OAuth\u0022\u003Ebearer token\u003C/a\u003E\u0026nbsp;(preferred)\u0026nbsp;\u003Ca target=\u0022_self\u0022 href=\u0022https://en.wikipedia.org/wiki/Basic_access_authentication\u0022\u003Ebasic authentication\u003C/a\u003E\u0026nbsp;(supported) in the Authorization HTTP header.\u003C/p\u003E\u003Ch3 id=\u0022bearer_tokena_hrefhttpsdevdailystorycomdocscreateanduseanapitokenbearertokena\u0022\u003EBearer Token\u003Ca href=\u0022https://dev.dailystory.com/docs/create-and-use-an-api-token#bearer-token\u0022\u003E\u003C/a\u003E\u003C/h3\u003E\u003Cp\u003EUsing API token as a bearer token is this recommended and simplest way to work with the DailyStory API. Simply set your Authorization header to \u0022Bearer [your api token]\u0022.\u003C/p\u003E\u003Cp\u003EFor example, if your API token is:\u0026nbsp;\u003Ccode class=\u0022inline-code\u0022\u003Esp2r7s6zvq2pkvgwosgu92xuw-us-1\u003C/code\u003E\u003C/p\u003E\u003Cp\u003EThe Authorization header for bearer authentication would look as follows:\u003C/p\u003E\u003Cdiv class=\u0022code_wrapper\u0022\u003E\u003Cdiv class=\u0022code\u0022 data-language=\u0022sh\u0022\u003EAuthorization: Bearer sp2r7s6zvq2pkvgwosgu92xuw-us-1\u003C/div\u003E\u003C/div\u003E\u003Ch4 id=\u0022get_request_example\u0022\u003EGET request example\u003C/h4\u003E\u003Cdiv class=\u0022code_wrapper\u0022\u003E\u003Cdiv class=\u0022code\u0022 data-language=\u0022sh\u0022\u003Ecurl -H \u0026quot;Authorization: Bearer sp2r7s6zvq2pkvgwosgu92xuw-us-1\u0026quot; https://us-1.dailystory.com/api/v1/campaigns\u003C/div\u003E\u003C/div\u003E\u003Ch4 id=\u0022post_request_example\u0022\u003EPOST request example\u003C/h4\u003E\u003Cdiv class=\u0022code_wrapper\u0022\u003E\u003Cdiv class=\u0022code\u0022 data-language=\u0022sh\u0022\u003Ecurl -X POST -H \u0026quot;Authorization: Bearer sp2r7s6zvq2pkvgwosgu92xuw-us-1\u0026quot; -H \u0026quot;Content-Type: application/json\u0026quot; -d \u0026quot;{\\\u0026quot;email\\\u0026quot;:\\\u0026quot;hello@example.com\\\u0026quot;}\u0026quot; https://us-1.dailystory.com/api/v1/contact\u003C/div\u003E\u003C/div\u003E\u003Ch3 id=\u0022basic_authenticationa_hrefhttpsdevdailystorycomdocscreateanduseanapitokenbasicauthenticationa\u0022\u003EBasic Authentication\u003Ca href=\u0022https://dev.dailystory.com/docs/create-and-use-an-api-token#basic-authentication\u0022\u003E\u003C/a\u003E\u003C/h3\u003E\u003Ccite class=\u0022important\u0022\u003E\u003Cspan class=\u0022title\u0022\u003EImportant\u003C/span\u003E\u003Cp\u003EBasic Authentication is supported, but Bearer authentication is recommended.\u003C/p\u003E\u003C/cite\u003E\u003Cp\u003EIf you are using Basic authentication there are additional steps required.\u003C/p\u003E\u003Cp\u003EBasic Authentication requires:\u003C/p\u003E\u003Col\u003E\u003Cli\u003EA username and a password. Use \u003Ccode class=\u0022inline-code\u0022\u003Eapi\u003C/code\u003E as the username.\u003C/li\u003E\u003Cli\u003EThe username and password to be concatenated with a colon separating them, e.g. \u003Ccode class=\u0022inline-code\u0022\u003Eapi:sp2r7s6zvq2pkvgwosgu92xuw-us-1\u003C/code\u003E.\u003C/li\u003E\u003Cli\u003EThe concatenated string of username and password must be \u003Ca target=\u0022_self\u0022 href=\u0022https://www.base64encode.org/\u0022\u003Ebase 64 encoded.\u003C/a\u003E\u003C/li\u003E\u003C/ol\u003E\u003Cp\u003EBelow is the base 65 encoded string for\u0026nbsp;\u003Ccode class=\u0022inline-code\u0022\u003Eapi:sp2r7s6zvq2pkvgwosgu92xuw-us-1\u003C/code\u003E\u003C/p\u003E\u003Cp\u003E\u003Ccode class=\u0022inline-code\u0022\u003EYXBpOnNwMnI3czZ6dnEycGt2Z3dvc2d1OTJ4dXctdXMtMQ==\u003C/code\u003E\u003C/p\u003E\u003Cp\u003EThe Authorization header for basic authentication would then look as follows:\u003C/p\u003E\u003Cdiv class=\u0022code_wrapper\u0022\u003E\u003Cdiv class=\u0022code\u0022 data-language=\u0022sh\u0022\u003EAuthorization: Basic YXBpOnNwMnI3czZ6dnEycGt2Z3dvc2d1OTJ4dXctdXMtMQ==\u003C/div\u003E\u003C/div\u003E\u003Ccite class=\u0022important\u0022\u003E\u003Cspan class=\u0022title\u0022\u003EImportant\u003C/span\u003E\u003Cp\u003EIn the examples below the username and password are base 64 encoded automatically when using curl.\u003C/p\u003E\u003C/cite\u003E\u003Ch4 id=\u0022get_request_example\u0022\u003EGET request example\u003C/h4\u003E\u003Cdiv class=\u0022code_wrapper\u0022\u003E\u003Cdiv class=\u0022code\u0022 data-language=\u0022sh\u0022\u003Ecurl --user api:sp2r7s6zvq2pkvgwosgu92xuw-us-1 https://us-1.dailystory.com/api/v1/campaigns\u003C/div\u003E\u003C/div\u003E\u003Ch4 id=\u0022post_request_example\u0022\u003EPOST request example\u003C/h4\u003E\u003Cdiv class=\u0022code_wrapper\u0022\u003E\u003Cdiv class=\u0022code\u0022 data-language=\u0022sh\u0022\u003Ecurl -X POST --user api:sp2r7s6zvq2pkvgwosgu92xuw-us-1 -H \u0026quot;Content-Type: application/json\u0026quot; -d \u0026quot;{\\\u0026quot;email\\\u0026quot;:\\\u0026quot;hello@example.com\\\u0026quot;}\u0026quot; https://us-1.dailystory.com/api/v1/contact\u003C/div\u003E\u003C/div\u003E\u003Ch2 id=\u0022api_responsea_hrefhttpsdevdailystorycomdocscreateanduseanapitokenapiresponsea\u0022\u003EAPI Response\u003Ca href=\u0022https://dev.dailystory.com/docs/create-and-use-an-api-token#api-response\u0022\u003E\u003C/a\u003E\u003C/h2\u003E\u003Cp\u003EThe API will always respond with a JSON response. Even in the case of errors. Typically the API response will be wrapped in a Response object. For example, a request to list all campaigns end-point returns and array of campaign objects:\u003C/p\u003E\u003Cdiv class=\u0022code_wrapper\u0022\u003E\u003Cdiv class=\u0022code\u0022 data-language=\u0022json\u0022\u003E{\r\n    \u0026quot;Status\u0026quot;:true,\r\n    \u0026quot;Message\u0026quot;:\u0026quot;\u0026quot;,\r\n    \u0026quot;Response\u0026quot;:{\r\n        \u0026quot;campaigns\u0026quot;: [... array of campaign objects]\r\n    }\r\n}\u003C/div\u003E\u003C/div\u003E\u003Cp\u003EThe Status, along with the HTTP status code, indicates if the request was processed successfully. If an error occurred, the Message will contain details about the error.\u003C/p\u003E\u003Cp\u003EThe Response may contain multiple values.\u003C/p\u003E","publish_status":0,"post_type":"Article","authoruid":"3dde8c16-763a-4a2b-ae0b-1d8c50c62e3d","author":{"authoruid":"3dde8c16-763a-4a2b-ae0b-1d8c50c62e3d","name":"Rob Howard"},"featured_image_updating":false,"meta_description":"Learn how to create and use API tokens for DailyStory\u2019s REST API, including authentication methods, endpoint setup, and example requests.","display_toc":true,"has_workingcopy":false,"allow_indexing":true,"sort_order":2,"total_views":1132,"date_published":"2025-09-22T18:54:03.59","date_updated":"2025-09-27T17:52:46.147","date_created":"2025-09-22T18:43:45.49"}}}