# Obtaining API Authorization

## Obtaining access

Log in to the elven system, navigate to the entity where api access is required, go to the journals page, and click on the integrations button in the top right corner of the journals page.

<div data-full-width="false"><figure><img src="/files/U7JQjD0elRKih71Iawbi" alt=""><figcaption></figcaption></figure></div>

In the pop-up integrations management window, click the “add new integration” button.

<figure><img src="/files/38mJnPC4kDQUjew2KCmn" alt=""><figcaption></figcaption></figure>

Name the new data type and click the “add” button.

<figure><img src="/files/MYvyimSoqLPTtyPuyD8m" alt=""><figcaption></figcaption></figure>

Once the data type is added, you can add new data. click the “add data” button and select “openapi integration” from the drop-down menu.

<figure><img src="/files/K2Ne8fppt0NE8tbNIYC1" alt=""><figcaption></figcaption></figure>

In the api key/secret management window that pops up, click the “create” button.

<figure><img src="/files/2H0AncmhgkGOZMXM3wur" alt=""><figcaption></figcaption></figure>

In the next window, name the newly created api key.

<figure><img src="/files/UbpUWlsdoL9piEj6xhjh" alt=""><figcaption></figcaption></figure>

Click the “create” button to complete the creation of the new api key.\
You can click the copy icon next to each key/secret to copy the contents to your clipboard for use.

<figure><img src="/files/3FSwYucxysPrCFfQ82Ab" alt=""><figcaption></figcaption></figure>

## Using api access

Provide the following parameters in the request header:

```javascript
elven-api-key: obtained api key
elven-api-sign: base64-encoded signature, e.g., LVT5aXA9064gpgZrPXPLJB/Aq9r45yMF10sTZQTteyE=
elven-api-timestamp: timestamp in milliseconds, e.g., 1721209655047, expires after 30 seconds
```

The sign algorithm as follows: concatenate the timestamp, request method, and request route, then encrypt using hmac sha256 with the secret.

```javascript
// uses the crypto library from https://github.com/nodejs/node/blob/v16.9.0/lib/crypto.js
/**
 * generate signature
 * apiSecret: BjGiqCWfHGCrl065dlEBWFO5vLj7Hqiexxx,
 * timestamp: 1721205912758
 * method: POST
 * path: /open/v3/businessData
 */
buildSign(apiSecret: string, timestamp: number, method: string, path: string) {
  const str = `${timestamp}${method}${path}`
  return crypto.createHmac('sha256', apiSecret).update(str).digest('base64')
}
```

Example:

```javascript
// example parameters
[
  'D7JLJ3awwrTdNXtSrPI1GlYE', // key
  'BjGiqCWfHGCrl065dlEBWFO5vLj7Hqie', // secret
  'POST', // method, must be uppercase
  '/open/v3/businessData' // path, must start with '/'
]

// headers
{
  'elven-api-key': 'D7JLJ3awwrTdNXtSrPI1GlYE',
  'elven-api-sign': 'LVT5aXA9064gpgZrPXPLJB/Aq9r45yMF10sTZQTteyE=',
  'elven-api-timestamp': 1721209655047
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.elven.com/v3/openapi/obtaining-api-authorization.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
