{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"a7ee6b6a-5889-4be3-bae8-294c5434038c","name":"Prevail API","description":"Welcome to the Prevail API. Version 1 (V1) allows you to interact with core features of our product, including requesting new sessions, retrieving scheduled sessions, and accessing session recordings and transcripts.\n\n## Authentication\n\n### About JWTs\n\nAuthentication for the Prevail API is handled using JWTs (JSON Web Tokens). JWTs provide a secure and compact way to send data to our API. More information about JWTs can be found at [https://jwt.io/](https://jwt.io/).\n\n### **Forming a JWT for Prevail**\n\nEach request must include a JWT that is passed in as either a:\n\n- `Bearer` token in the Authorization header\n    \n- A query string parameter `jwt_payload=[signed_jwt]`\n    \n- In the POST body as a `jwt_payload`\n    \n\nJWT tokens should be signed with a JWT Secret, which in this case will be your Prevail API key. An organization member can retrieve their API key by clicking on their Profile Avatar > Selecting Organizations > Click on your Organization name > and clicking on \"Copy\" next to \"Active API Key\".\n\nThe payload data is used to send in parameters to the Prevail API. It is required that you pass in both the `exp` and the `slug` parameters at minimum for the API to accept the token.\n\n- `exp` - epoch time in seconds (refer to the below example)\n    \n- `slug` - this is your company_id that can be found in Organization settings. This is used to validate the organization of the requester.\n    \n\n_Note - For additional security, parameters can be passed in the JWT payload instead of the Query Sring or POST body._\n\n### Using Prevail API in Postman\n\nIf you click on \"Run in Postman\" at the top right of this page, you will be able to import the Prevail API postman collection, which contains sample requests, and a prerequest script that will generate a JWT for you on each request. You must provide your API Key and Company ID in the included Environment for the script to work. In the provided \"Prevail Environment\", you will need to replace any template variable value (ie. \"\\[:session_slug\\]\") with the value of a real session for that call to work.\n\nThe following is an example of how to create a JWT for Prevail API using Javascript.\n\n``` javascript\n// JWT generation script adapted from\n// https://gist.github.com/corbanb/db03150abbe899285d6a86cc480f674d\nvar jwtSecret = pm.environment.get('prevail_api_key') || ''\n// Set headers for JWT\nvar header = {\n    'typ': 'JWT',\n    'alg': 'HS256'\n};\n// Prepare timestamp in seconds\nvar currentTimestamp = Math.floor(Date.now() / 1000)\nvar data = {\n    'exp': currentTimestamp,\n    // company_id can be found in organization settings\n    'slug': pm.environment.get('company_id') || '' \n}\nfunction base64url(source) {\n    // Encode in classical base64\n    encodedSource = CryptoJS.enc.Base64.stringify(source)\n    // Remove padding equal characters\n    encodedSource = encodedSource.replace(/=+$/, '')\n    // Replace characters according to base64url specifications\n    encodedSource = encodedSource.replace(/\\+/g, '-')\n    encodedSource = encodedSource.replace(/\\//g, '_')\n    return encodedSource\n}\n// encode header\nvar stringifiedHeader = CryptoJS.enc.Utf8.parse(JSON.stringify(header))\nvar encodedHeader = base64url(stringifiedHeader)\n// // encode data\nvar stringifiedData = CryptoJS.enc.Utf8.parse(JSON.stringify(data))\nvar encodedData = base64url(stringifiedData)\n// build token\nvar token = `${encodedHeader}.${encodedData}`\n// sign token\nvar signature = CryptoJS.HmacSHA256(token, jwtSecret)\nsignature = base64url(signature)\nvar signedToken = `${token}.${signature}`\npm.globals.set('jwt_signed', signedToken)\n\n ```","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"30023744","team":5776203,"collectionId":"a7ee6b6a-5889-4be3-bae8-294c5434038c","publishedId":"2s9YysENBH","public":true,"publicUrl":"https://documenter-api.postman.tech/view/30023744/2s9YysENBH","privateUrl":"https://go.postman.co/documentation/30023744-a7ee6b6a-5889-4be3-bae8-294c5434038c","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"documentationLayout":"classic-double-column","customisation":{"metaTags":[{"name":"description","value":""},{"name":"title","value":""}],"appearance":{"default":"light","themes":[{"name":"dark","logo":null,"colors":{"top-bar":"212121","right-sidebar":"303030","highlight":"FF6C37"}},{"name":"light","logo":null,"colors":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"}}]}},"version":"8.11.6","publishDate":"2024-02-24T17:24:05.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{"title":"","description":""},"logos":{"logoLight":null,"logoDark":null}},"statusCode":200},"environments":[{"name":"Prevail Environment","id":"1cfed8f1-5d34-4f94-970c-827bbafcd67b","owner":"30023744","values":[{"key":"prevail_api_key","value":"[:prevail_api_key]","enabled":true,"type":"default"},{"key":"env_prefix","value":"https://[:env_prefix]","enabled":true,"type":"default"},{"key":"ext_id_key","value":"","enabled":true,"type":"default"},{"key":"ext_id_value","value":"","enabled":true,"type":"default"},{"key":"session_slug","value":"[:session_slug]","enabled":true,"type":"default"},{"key":"company_id","value":"[:company_id]","enabled":true,"type":"default"},{"key":"session_request_id","value":"[:session_request_id]","enabled":true,"type":"default"}],"published":true}],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/39f107a678cf284b54712bd8c0c3508b68c3c43bfe6ff58a883b943e0ea13f2c","favicon":""},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"},{"label":"Prevail Environment","value":"30023744-1cfed8f1-5d34-4f94-970c-827bbafcd67b"}],"canonicalUrl":"https://documenter.gw.postman.com/view/metadata/2s9YysENBH"}