> ## Documentation Index
> Fetch the complete documentation index at: https://docs.creditriskmonitor.com/llms.txt
> Use this file to discover all available pages before exploring further.

# INITIAL SETUP

> Learn how to get started with CreditRiskMonitor API.

## Prerequisites

Before you begin, you'll need: 

* An active account on [api.creditriskmonitor.com](https://api.creditriskmonitor.com/) 
* API credentials (username and password) 

<Tip>
  To get started, [request developer access here.](/developer-access/developer-access) This allows you to test the APIs and evaluate if they meet your specific needs before committing to a full account.
</Tip>

<AccordionGroup>
  <Accordion title="Full Access Account" defaultOpen="false">
    1. Contact our Sales team:
       1. Email: [info@creditriskmonitor.com](mailto:info@creditriskmonitor.com) 
       2. Phone: (845) 230-3000 
    2. Discuss your specific needs 
    3. Get personalized onboarding support 
  </Accordion>

  <Accordion title="Developer Account" defaultOpen="true">
    1. Perfect for evaluation and testing 
    2. Free 30-day access 
    3. [Request Developer Access Here](/developer-access/developer-access) 
    4.  
       * North American business coverage 
       * 200 requests per hour 
       * 30-day validity 
       * API-only access (no web platform access) 
  </Accordion>
</AccordionGroup>

## Authentication Process

### Generate Session Key

Your first API call should be to the [**<u>login endpoint</u>**](/api-reference/user/logs-a-user-in) to obtain a : 

<CodeGroup>
  ```javascript cURL theme={null}
  curl -d "Username=[USERNAME]&Password=[PASSWORD]" -X POST "https://api.creditriskmonitor.com/v1/Users/Login"
  ```
</CodeGroup>

A successful login returns a response containing a : 

<CodeGroup>
  ```javascript Response theme={null}
  {"Success":true,"Data":{"SessionKey":"1/1/2025 2:00:00 abcd1234ABCD1234abcd1234ABCD1234"}}
  ```
</CodeGroup>

<Note>
  There is a rate limit based on the type of user account you have:

  | User Type     | Requests per hour |
  | ------------- | ----------------- |
  | Ordinary      | 10                |
  | API Developer | 200               |
  | API User      | no limit          |

  Each request will return three headers that describe the rate limit values.

  | Header Name           | Description                                                                   |
  | --------------------- | ----------------------------------------------------------------------------- |
  | X-RateLimit-Limit     | The maximum number of request the user is allowed per hour.                   |
  | X-RateLimit-Remaining | The number of requests remaining for the current hour.                        |
  | X-RateLimit-Reset     | The number of seconds until a new quota of requests is allocated to the user. |
</Note>

### Use Session Key

Include the  in the header of all subsequent API requests. For example, a subsequent request to the News endpoint would be:

<CodeGroup>
  ```javascript cURL theme={null}
  curl -H "Authorization: Bearer 1/1/2025 2:00:00 abcd1234ABCD1234abcd1234ABCD1234" -X GET "https://api.creditriskmonitor.com/v1/News"
  ```
</CodeGroup>

<Note>
  **Important notes**:

  * All API endpoints require a valid
  * Requests without a valid session key will return an error
  * Session keys expire after a period of inactivity
  * If your session key expires, simply generate a new one by logging in again
</Note>

<Tip>
  The API can respond in either XML or JSON, defined by setting the  parameter.

  ```javascript theme={null}
  curl -H "Authorization: Bearer 1/1/2025 2:00:00 abcd1234ABCD1234abcd1234ABCD1234" -X GET "https://api.creditriskmonitor.com/v1/News?type=xml"
  ```
</Tip>

## Querying Business Info

In this example, we will write Python code to get basic business info using CreditRiskMonitor API.

Let's define our `CRMZApi` class function.

<CodeGroup>
  ```python Creating CRMZ API Class theme={null}
  import requests

  class CRMZApi:
      baseUrl = 'https://api.creditriskmonitor.com/v1'

      def __init__(self):
          self.sessionKey = None

      def postRequest(self, inputs, endpoint):
          response = requests.post(self.baseUrl + endpoint, data=inputs)
          return json.loads(response.text)
      
      def getRequest(self, endpoint):  
          response = requests.get(self.baseUrl + endpoint, params = '',headers={'Authorization': 'Bearer ' + self.sessionKey})
          return json.loads(response.text)
      
      def login(self, username, password):
          creds = {
              'Username': username,
              'Password': password
          }
          response = self.postRequest(creds, '/Users/Login')
          print(f"Login response: {response}")  
          
          if response["Success"] == True:
              self.sessionKey = response["Data"]["SessionKey"]
              print(f"SessionKey: {self.sessionKey}")  # Added print statement
              return True
          else:
              print("Login failed")  # Added print statement
              return False
      
      def getBusinessInfo(self, BusinessId):
          return self.getRequest('/Business/IdentificationGroup?id=' + str(BusinessId))

  # Initialize the CRMZ API
  crmz_api = CRMZApi()
  username = 'your_username'
  password = 'your_password'
  ```
</CodeGroup>

Finally, let's create a function to get information from a business:

<CodeGroup>
  ```python Defining the final function theme={null}
  def return_business_info(business_id):
      if not crmz_api.sessionKey:
          if not crmz_api.login(username, password):
              return "Failed to login to CRMZ API"
      return crmz_api.getBusinessInfo(business_id)
       
  return_business_info(16177150)
  ```
</CodeGroup>

By running this code, you will get the output for Tesla Inc as follows:

<CodeGroup>
  ```json Response theme={null}
  {'Success': True,
   'Data': {
    'Name': 'Tesla Inc',
    'ParentBusinessId': None,
    'ParentBusinessName': None,
    'BusinessId': 16177150,
    'Address1': '1 Tesla Road',
    'CityName': 'AUSTIN',
    'StateProvinceName': 'TX',
    'PostalCode': '78725',
    'CountryName': 'United States',
    'PhoneNumber': None,
    'FaxNumber': None,
    'EmailAddress': None,
    'TradingStatus': 'A',
    'IncorporatedDate': '2024-06-14',
    'IncorporatedIn': 'USA',
    'IncorporatedInState': 'TX',
    'FederalTaxId': '912197729',
    'CIKNumber': '0001318605',
    'TickerSymbol': 'TSLA',
    'StockExchange': 'NASD',
    'MarketCap': 1267781000000,
    'Employees': 140473,
    'EmployeesAsOfDate': '2023-12-31T00:00:00',
    'PAYCEScore': None,
    'PAYCEScoreDate': None,
    'FriskScore': 10,
    'FriskScoreDate': '2025-01-10T00:00:00',
    'ZScore': 4.2153,
    'ZScoreDate': '2024-09-30T00:00:00',
    'DBTIndex': 9,
    'DBTIndexDate': '2024-11-01T00:00:00',
    'FSRScore': None,
    'FSRScoreDate': None,
    'PublicFilings': 85,
    'WebSite': 'https://www.tesla.com/',
    'SIC': '3711',
    'NAICS': '336110',
    'LatestStatementDate': '2024-09-30T00:00:00',
    'CurrentFiscalYear': 2024,
    'CurrentFiscalQuarter': 3,
    'BankruptcyType': None,
    'BankruptcyDate': None,
    'BankruptcyExitDate': None,
    'TradeAccounts': 315,
    'TotalDue': 400155491,
    'PastDue': 67169118,
    'HighRiskLink': None,
    'CaseStudyLink': None,
    'LastBlogLink': None,
    'FRISKLastChangeDate': '2024-12-20T00:00:00',
    'PAYCELastChangeDate': None,
    'ZScoreLastChangeDate': '2024-10-25T00:00:00',
    'FinancialsLastChangeDate': '2024-10-25T00:00:00',
    'MarketGuideSectorName': 'Consumer Cyclical',
    'MarketGuideIndustryName': 'Auto & Truck Manufacturers',
    'CreditLimitMedian': 386270,
    'CreditLimitVeryHigh': 4775669,
    'ParentFriskScore': None,
    'ParentFriskDate': None,
    'ParentPayceScore': None,
    'ParentPayceDate': None,
    'ParentZScore': None,
    'ParentZDate': None,
    'ParentFSRScore': None,
    'ParentFSRDate': None,
    'ParentDBTIndex': None,
    'ParentDBTDate': None
    }}
  ```

  ```
  Login response: 
  {'Success': True, 
    'Data': {
    'SessionKey': '1/10/2025 4:03:31 sessionKey', 
    'Username': 'your_username', 
    'SessionId': sessionId, 
    'TwoFactorAuthenticationRequired': False
    }}
  SessionKey: 1/10/2025 4:03:31 sessionKey
  ```

  ```json Login Response theme={null}
  Login response: {'Success': True, 
    'Data': {
      'SessionKey': '1/10/2025 4:03:31 sessionKey', 
      'Username': 'your_username', 
      'SessionId': sessionId, 
      'TwoFactorAuthenticationRequired': False
      }}
  SessionKey: 1/10/2025 4:03:31 sessionKey
  ```
</CodeGroup>

<Tip>
  Add more API endpoints to the CRMZ API Class to easily access other data points in your code.
</Tip>

This fast configuration demonstrates how to create a basic code to extract data from CreditRiskMonitor. You can go ahead and expand on this workflow to suit your particular requirements.

## Next Steps

Having engaged swiftly with our APIs, it's now the moment to delve into additional possibilities:

<CardGroup cols="1">
  <Card title="API Reference" icon="code" iconType="solid" color="#C72A2D" href="/api-reference/gettingstarted">
    Explore how to get business information, financial data, risk scores, and more.
  </Card>
</CardGroup>
