# Authentication & Swagger

## Intro

The full list of API functions with descriptions and JSON schema can be found here: <https://safcregistry.energyweb.org/api/swagger#/>

This list includes functions for internal use only and will throw a 403 error if you attempt to call them.

Warning - only attempt to use the POST, PATCH, and DELETE functions if you completely understand how they work. These functions can cause irreversible changes to your company's presence on the registry, your accounts, users from your company, and your SAF Certificates

## Authentication

You'll need to provide your auth token each time you make a request to the SAFc Registry and you'll need to include it in the header. Example Python code with the auth token "abcd123456789":

```
import requests

auth_header = { 'Authorization': 'Bearer abcd123456789'}

my_info = 'https://safcregistry.energyweb.org/api/users/me'

r = requests.get(my_info, header=auth_header)
```

## Noteworthy functions

| Function                                                                                                                                                                                                                                 | Purpose                                                     | Inputs                        | Outputs                                                                |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------- | ---------------------------------------------------------------------- |
| [GET](https://safcregistry.energyweb.org/api/swagger#/user/UserController_getMyUserData)[/api/users/me](https://safcregistry.energyweb.org/api/swagger#/user/UserController_getMyUserData)                                               | Gets information about the API user                         | None                          | User's: ID, email, name, companies, accounts, account memberships      |
| [GET/api/unit](https://safcregistry.energyweb.org/api/swagger#/unit/UnitController_getUnits)                                                                                                                                             | Provide list of all SAF certificates for a specific account | Account ID                    | Large JSON with all certificates in an account and all of their fields |
| [GET](https://safcregistry.energyweb.org/api/swagger#/unit/UnitController_getUnitById)[/api/unit/{id}](https://safcregistry.energyweb.org/api/swagger#/unit/UnitController_getUnitById)                                                  | Get information about a specific certificate                | Certificate ID                | Information about specific certificate                                 |
| [GET](https://safcregistry.energyweb.org/api/swagger#/unit-process/UnitProcessController_getUnitProcesses)[/api/unit-process/query](https://safcregistry.energyweb.org/api/swagger#/unit-process/UnitProcessController_getUnitProcesses) | Get a list of pending actions for a specific account        | Account ID, Pending\|Finished | Detailed list of actions for an account                                |
