{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Authentication","meta":[{"name":"robots","content":"noindex"}],"llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"authentication","__idx":0},"children":["Authentication"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Spotnana APIs use a Bearer token to authenticate incoming requests."," ","The following authorization header must be included in all requests to access Spotnana APIs."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"Authorization: \"Bearer <YOUR_TOKEN_HERE>\"\n"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," API calls to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v2/auth/oauth2-token"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/get-auth-token"]}," endpoints are rate limited."," ","We recommend reusing the existing tokens until they expire."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"generating-an-authentication-token","__idx":1},"children":["Generating an authentication token"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following steps explain how to generate an authentication token."]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Contact your Spotnana account representative to obtain a unique ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client_id"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client_secret"]}," credentials."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After receiving your credentials, you can generate the bearer authentication token by"," ","making a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST"]}," API request to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v2/auth/oauth2-token"]}," endpoint. The request must contain the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client_id"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client_secret"]},","," ","and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["grant_type=client_credentials"]}," in the request body."]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The old token generation endpoint ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/get-auth-token"]}," has been deprecated."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Existing API users who want to migrate to the new ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v2/auth/oauth2-token"]}," endpoint must obtain new"," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client_id"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client_secret"]}," credentials from Spotnana."]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"sample-request-and-response","__idx":2},"children":["Sample request and response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following code snippet is a sample ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["curl"]}," request to generate a bearer token."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --location 'https://api.spotnana.com/v2/auth/oauth2-token' \\\n--header 'Content-Type: application/x-www-form-urlencoded' \\\n--data-urlencode 'client_id=client_id' \\\n--data-urlencode 'client_secret=client_secret' \\\n--data-urlencode 'grant_type=client_credentials'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A successful response for the above ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["curl"]}," request will contain a temporary bearer token and its expiration time displayed in seconds."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"\n{\n  \"access_token\": \"<access_token>\",\n  \"expires_in\": 3600,\n  \"token_type\": \"Bearer\"\n}\n\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When you're working with Spotnana APIs, this bearer ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["access_token"]}," must be included in every request as authorization header to validate the"," ","API calls. The following code snippet is a sample ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["curl"]}," request which shows how you can include the bearer token in a request header."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"curl https://api.spotnana.com/v2/companies -H \"Authorization: Bearer <YOUR_TOKEN_HERE>\"\n"},"children":[]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," ","When making an API call, if the bearer token has exceeded the expiration time limit, you will receive an error code of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["401"]}," ","with a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message"]}," in the JSON response indicating ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Access Token Invalid"]},". In such cases, use the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v2/auth/oauth2-token"]}," endpoint again"," ","to generate another unique bearer token."]}]}]},"headings":[{"value":"Authentication","id":"authentication","depth":1},{"value":"Generating an authentication token","id":"generating-an-authentication-token","depth":2},{"value":"Sample request and response","id":"sample-request-and-response","depth":2}],"frontmatter":{"seo":{"title":"Authentication"}},"lastModified":"2025-12-01T12:50:05.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/spotnana/authentication","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}