# Getting API Key and passing it as a \_proc/procname(parameter) value

**URL:** <https://community.dreamfactory.com/t/getting-api-key-and-passing-it-as-a-proc-procname-parameter-value/4416>\
**Category:** uncategorized\
**Created:** [May 10, 2018, 9:17pm UTC](https://community.dreamfactory.com/t/getting-api-key-and-passing-it-as-a-proc-procname-parameter-value/4416 "2018-05-10T21:17:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![beskone](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@beskone](https://community.dreamfactory.com/u/beskone)\
**Post date:** [May 10, 2018, 9:17pm UTC](https://community.dreamfactory.com/t/getting-api-key-and-passing-it-as-a-proc-procname-parameter-value/4416/1 "2018-05-10T21:17:59Z")

</div>

I need to take an api key used to submit a call via: /api/v2/\_proc/procname?api\_key=xx00xx00

and append it to the api call as a parameter so that the full API call would be:

/api/v2/\_proc/procname(xx00xx00)?api\_key=xx00xx00

I don’t want my customers to have to add the api\_key value as the (parameter) value as well as the api\_key value when calling this stored process.

I’m guessing it’s a pre-process script that will call platform.session.api\_key somehow but I’m lost as to how to accomplish this.

---

<div class="post-metadata">

**Author:** ![formerstaff](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/formerstaff/32/1133_2.png) [@formerstaff](https://community.dreamfactory.com/u/formerstaff)\
**Post date:** [May 14, 2018, 1:23pm UTC](https://community.dreamfactory.com/t/getting-api-key-and-passing-it-as-a-proc-procname-parameter-value/4416/2 "2018-05-14T13:23:58Z")

</div>

You’re right, you want to access the value through `platform.session.api_key`. You could then use a pre-process script to add this value to your procedure parameters. There are a number of different ways to provide parameters to your procedure call ( [https://wiki.dreamfactory.com/DreamFactory/Features/Database/SQL/Stored\_Procedures\_And\_Functions#Calling\_a\_Stored\_Procedure\_or\_Function](https://wiki.dreamfactory.com/DreamFactory/Features/Database/SQL/Stored_Procedures_And_Functions#Calling_a_Stored_Procedure_or_Function) ) so the specifics of the script will change depending on which method you use.  
For the sake of example, let’s say you’re using the second example under POST.

```json
{
    "params": {
        "<param_name>": "<param_value>",
        "<param_name>": "<param_value>",
        "<param_name>": "<param_value>"
    }
}

```

And, let’s say that the name of the parameter you want to add the api key value to is `my_api_key`.

You could do a v8js script that looks like this:

```javascript
    event.request.payload.params.my_api_key = platform.session.api_key;

```
