For the complete documentation index, see [llms.txt](https://docs.certn.co/api/llms.txt). This page is also available as [Markdown](https://docs.certn.co/api/certn-api-v-1.0/getting-started/demo-account/send-request.md).

To follow this guide, you need a demo account. Make sure it's fully setup! If not, follow our instructions on how to [create a demo account](https://docs.certn.co/api/certn-api-v-1.0/getting-started/demo-account).

## Request

To communicate with our API, you'll need to build HTTP requests. You can use the programming language of your choice to achieve this. We provide examples of scripts using [Python](https://www.python.org/), but most of the content you'll work with will be in [JSON](https://en.wikipedia.org/wiki/JSON)!

### Get the URL

You can find the URLs for all our endpoints in the API Reference section of this documentation. Knowing how to use them can be helpful, so we'll show you how they're created.

In this example, you'll be making calls to our demo environment, at `https://demo-api.certn.co`.

We currently divide our endpoints by industry:

- **Human resources** endpoints start with `/hr/v1/`
- **Property management** endpoints start with `/api/v2/`

Later on, you'll request a [Softcheck](https://docs.certn.co/api/certn-api-v-1.0/guides/checks/softcheck), which is under `/applications`. You'll also make it a [quickscreen](https://docs.certn.co/api/certn-api-v-1.0/faq#what-is-a-quickscreen-and-how-do-i-use-it), so you'll be filling all of the information yourself instead of sending it to your applicant. To make it a quick screen, add `/quick` to your URL.

Place this together, and you get the URL for your call:

- Choose the URL that corresponds to your industry to continue:

Human Resources

``` 
"https://demo-api.certn.co/hr/v1/applications/quick/"
```

Property Management

```
"https://demo-api.certn.co/api/v2/applications/quick/"
```

### Get your API key

[To gain access to our API](https://docs.certn.co/api/start/demo-account#setup-your-account-for-api-tests), you need an [Authorization header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization) with a valid Bearer token. The token is your API key.

- Replace `<token>` with your API key in the following header:

```
{ "Authorization": "Bearer <token>" }
```

Include this header in every call to our API, and keep it secure. It is your access key.

### Add the content

1. To request a Softcheck, add the request-flag `'request_softcheck': true` to your content.
2. For your applicant, use our CEO's name, Andrew McLeod.
3. For the address, use our office location in Victoria, BC.
4. Fill the SIN/SSN number with a placeholder.

```
{
    "request_softcheck": true,
    "information": {
            "first_name": "Andrew",
            "last_name": "McLeod",
            "addresses": [
                    {
                            "address": "1006 Fort St Unit 300",
                            "city": "Victoria",
                            "province_state": "BC",
                            "country": "CA"
                    }
            ],
            "sin_ssn": "123456789"
        },
}
```

### Send the request

Now we're ready to bring it all together. Our `/application` endpoint accepts POST requests, so make sure that is what you use.

Here is what your full script may look like when using Python:

```python
import requests

### Replace <token> with your API Key
headers = { "Authorization": "Bearer <token>" }

### Replace <URL> with the URL that corresponds to your industry
url = "<URL>"

content = {
    "request_softcheck": True,
    "information": {
            "first_name": "Andrew",
            "last_name": "McLeod",
            "addresses": [
                    {
                            "address": "1006 Fort St Unit 300",
                            "city": "Victoria",
                            "province_state": "BC",
                            "country": "CA"
                    }
            ],
            "sin_ssn": "123456789"
        },
}

# Sends the HTTP request to the API via POST
response = requests.post(url, headers=headers, json=content)

############### Optional ###############

# Brings errors to the forefront
response.raise_for_status()

# Writes the contents of the response in a file named "softcheckDemo.json"
with open("softcheckDemo.json", "w") as f:
    f.write(response.text)

############# End Optional ##############
```

In the previous example, we saved the results of the call to a new file named `softcheckDemo.json`.

With everything set properly and a good internet connection, you should receive a response status of `201 Created`.

**201 Created**

`[...]`{"id": "<number>",
[...]  
"report_status": "ANALYZING",  
[...]`

## Errors

Errors are a relatively common occurrence when working with APIs. It's always good to know how to prevent them and what to do when they arise.

Here are some errors you may encounter when doing this exercise, and how to fix them.

### 400 Bad Request

You may receive a `400 Bad Request` when:

- Some required fields are missing in your request

```json
"information": {
     "addresses": ["This field is required."]
}
```

#### How to fix this issue

Add the missing fields to the [body of your request](https://docs.certn.co/api/certn-api-v-1.0/getting-started/demo-account/send-request#add-the-content) and verify your syntax.

### 401 Unauthorized

You may receive a `401 Unauthorized` if:

- You sent your request without an authorization header

```json
"detail": "Authentication credentials were not provided."
```

- You sent your request with an authorization header, but without an API Key
- You provided an incorrect API key in the header of your request

```json
"detail": "Invalid token."
```

#### How to fix this issue

[Add your API key](https://docs.certn.co/api/certn-api-v-1.0/getting-started/demo-account/send-request#get-your-api-key) in the authorization header, and include it in every call.

### 403 Forbidden

You may receive a `403 Forbidden` if:

- You sent your request to an endpoint you don't have access to

```json
"detail": "You do not have permission to perform this action."
```

#### How to fix this issue

Use the URL that corresponds to [your industry](https://docs.certn.co/api/certn-api-v-1.0/getting-started/demo-account/send-request#get-the-url).

[Error codes](https://docs.certn.co/api/certn-api-v-1.0/api-reference/resources/error-codes)
