### Call CentralReach Public API using cURL Source: https://centralreach.com/resources/api/index This snippet shows how to make an authenticated call to the CentralReach Public API after obtaining a JWT. It includes the necessary headers: 'x-api-key' for the CR API Key and 'Authorization' for the JWT obtained in the previous step. The example targets the 'contacts/employee' endpoint. ```curl curl --location 'https://partners-api.centralreach.com/enterprise/v1/contacts/employee/12345' \ --header 'x-api-key: {CR API Key}' \ --header 'Content-Type: application/json' \ --header 'Authorization: {JWT}' \ ``` -------------------------------- ### Contacts API - Get Employee Source: https://centralreach.com/resources/api/index Retrieves details for a specific employee contact using their ID. This endpoint requires authentication with a JWT and the organization's CR API Key. ```APIDOC ## GET /enterprise/v1/contacts/employee/{contactId} ### Description Retrieves details for a specific employee contact by their unique identifier. Requires authentication via JWT and CR API Key. ### Method GET ### Endpoint https://partners-api.centralreach.com/enterprise/v1/contacts/employee/{contactId} ### Parameters #### Path Parameters - **contactId** (string) - Required - The unique identifier of the employee contact. #### Query Parameters None #### Request Body None ### Request Example ``` curl --location 'https://partners-api.centralreach.com/enterprise/v1/contacts/employee/12345' \ --header 'x-api-key: {CR API Key}' \ --header 'Content-Type: application/json' \ --header 'Authorization: {JWT}' ``` ### Response #### Success Response (200) - **contactId** (string) - The unique identifier of the contact. - **firstName** (string) - The first name of the employee. - **lastName** (string) - The last name of the employee. - ... (other contact details) #### Response Example ```json { "contactId": "12345", "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com" } ``` ``` -------------------------------- ### Generate Access Token using cURL Source: https://centralreach.com/resources/api/index This snippet demonstrates how to generate an access token (JWT) by making an HTTP POST request to the CentralReach SSO service. It utilizes the client ID and client secret provided by the CR team. The request specifies the grant type as 'client_credentials' and requests the 'cr-api' scope. ```curl curl --location 'https://login.centralreach.com/connect/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=client_credentials' \ --data-urlencode 'client_id={CLIENT_ID}' \ --data-urlencode 'client_secret={CLIENT_SECRET}' \ --data-urlencode 'scope=cr-api' ``` -------------------------------- ### User Authentication API Source: https://centralreach.com/resources/api/index This endpoint is used to obtain an access token (JWT) by exchanging client credentials with the CentralReach SSO service. This token is then used to authenticate subsequent API requests. ```APIDOC ## POST /connect/token ### Description Obtains an access token (JWT) using the OAuth 2.0 Client Credentials Grant Type. This token is required for authenticating with the CentralReach Public API. ### Method POST ### Endpoint https://login.centralreach.com/connect/token ### Parameters #### Query Parameters - **grant_type** (string) - Required - Must be 'client_credentials'. - **client_id** (string) - Required - The client ID provided by the CR team. - **client_secret** (string) - Required - The client secret provided by the CR team. - **scope** (string) - Required - Must be 'cr-api'. ### Request Example ``` curl --location 'https://login.centralreach.com/connect/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=client_credentials' \ --data-urlencode 'client_id={CLIENT_ID}' \ --data-urlencode 'client_secret={CLIENT_SECRET}' \ --data-urlencode 'scope=cr-api' ``` ### Response #### Success Response (200) - **access_token** (string) - The JWT access token. - **expires_in** (integer) - The lifetime in seconds of the access token. - **token_type** (string) - The type of token, typically 'Bearer'. #### Response Example ```json { "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ij...", "expires_in": 3600, "token_type": "Bearer" } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.