# API Documentation

**URL:** https://community.zymbit.com/t/api-documentation/189
**Category:** ZYMKEY4
**Created:** [June 11, 2017, 4:24pm UTC](https://community.zymbit.com/t/api-documentation/189 "2017-06-11T16:24:12Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![Phil\_S\_Zymbit\_1](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@Phil\_S\_Zymbit\_1](https://community.zymbit.com/u/Phil_S_Zymbit_1)
#### Post date: [June 11, 2017, 4:24pm UTC](https://community.zymbit.com/t/api-documentation/189/1 "2017-06-11T16:24:12Z")

</div>

## API DOCUMENTATION

Documentation is updated from time to time. Be sure to clear your browser cache so that you get the latest version.

The latest API documentation can be found on line at:  
[https://docs.zymbit.com/](https://docs.zymbit.com/quickstart/api/)

> **Legacy PDF documents**
>
> [Python API](https://s3.amazonaws.com/zk-sw-repo/zk_app_utils.py.pdf)  
> [C++ API](https://s3.amazonaws.com/zk-sw-repo/zkAppUtilsClass.cpp.pdf)  
> [C API](https://s3.amazonaws.com/zk-sw-repo/zk_app_utils.c.pdf)

---

<div class="post-metadata">

### Author: ![Tgratier](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@Tgratier](https://community.zymbit.com/u/Tgratier)
#### Post date: [November 17, 2017, 10:18pm UTC](https://community.zymbit.com/t/api-documentation/189/2 "2017-11-17T22:18:52Z")

</div>

Hi, I finally received my zymkey 4i and it looks great!

I have a few question, I just tried to start to play to my zymkey:

- I am using jessie
- I installed all the packages thanks to your script
- my zymkey looks to works “good”: blink and I also was able to run your two python examples scripts with success

I am interested to use C code. I look your API and tried to include “/home/zymbit/zk\_app\_utils/zk\_app\_utils.h” but I couldn’t find any zymkey user in /home !!

I finally was able to compile my C script with including \<zymkey/zymkey.h\> in my headers but got these error lines:

zymbit.c:(.text+0x18): undefined reference to ‘zkOpen’  
zymbit.c:(.text+0x2c): undefined reference to ‘zkLEDFlash’  
zymbit.c:(.text+0x34): undefined reference to ‘zkClose’

Could you help me and tell me what I missed??

Thx by advance!

---

<div class="post-metadata">

### Author: ![Tgratier](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@Tgratier](https://community.zymbit.com/u/Tgratier)
#### Post date: [November 21, 2017, 8:44pm UTC](https://community.zymbit.com/t/api-documentation/189/3 "2017-11-21T20:44:44Z")

</div>

Hi

I can play fine the python module, but I still can’t use the C API.  
Could you help me? Is there something I should link to my gcc line?

Thx by advance

---

<div class="post-metadata">

### Author: ![Bob\_of\_Zymbit](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@Bob\_of\_Zymbit](https://community.zymbit.com/u/Bob_of_Zymbit)
#### Post date: [November 22, 2017, 6:19pm UTC](https://community.zymbit.com/t/api-documentation/189/4 "2017-11-22T18:19:35Z")

</div>

@Tgratier sorry for the late response. The include files for C/C++ are located in /usr/include/zymkey. You can directly include this path in your C code `#include "/usr/include/zymkey/zk_app_utils.h"`. Or, you could `#include <zk_app_utils.h>` and put the path on the gcc include line:  
`gcc -I /usr/include/zymkey my_zymkey_program.c -o my_zymkey_program`

The reason that you don’t see a user directory for user zymbit in /home (/home/zymbit) is that the account is deliberately created in the systemd service with no /home directory for security.

Please let us know if you have further questions.

---

<div class="post-metadata">

### Author: ![Tgratier](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@Tgratier](https://community.zymbit.com/u/Tgratier)
#### Post date: [November 23, 2017, 8:47pm UTC](https://community.zymbit.com/t/api-documentation/189/5 "2017-11-23T20:47:17Z")

</div>

Hi

Thx for your help.

I am sorry but it didn’t change anything, I have the same “undefined reference to” errors than with  
#include \<zymkey/zk\_app\_utils.h\>

You say the C/C++ files can be found in /usr/include/zymkey, but I only have these 3 files:

- zkAppUtilsClass.h
- zk\_app\_utils.h
- zk\_b64.h

I guess my code can’t find the code declaration of the functions I am calling. Where could I find the c code for these? don’t they should be in the same /usr/include/zymkey folder? If the answer is yes, could you help me to find what have I missed during my installation please?

Thx

---

<div class="post-metadata">

### Author: ![Bob\_of\_Zymbit](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@Bob\_of\_Zymbit](https://community.zymbit.com/u/Bob_of_Zymbit)
#### Post date: [November 25, 2017, 5:20am UTC](https://community.zymbit.com/t/api-documentation/189/6 "2017-11-25T05:20:15Z")

</div>

@Tgratier  
You will also need to reference the Zymkey App Utilities, located at /usr/lib/libzk\_app\_utils.so, with the `-l` directive. For example:  
`gcc -I /usr/include/zymkey -lzk_app_utils my_zymkey_program.c -o my_zymkey_program`

---

<div class="post-metadata">

### Author: ![Tgratier](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@Tgratier](https://community.zymbit.com/u/Tgratier)
#### Post date: [November 26, 2017, 11:25am UTC](https://community.zymbit.com/t/api-documentation/189/7 "2017-11-26T11:25:46Z")

</div>

Ok thx that was the thing I missed.

---

<div class="post-metadata">

### Author: ![Tgratier](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@Tgratier](https://community.zymbit.com/u/Tgratier)
#### Post date: [January 10, 2018, 12:14am UTC](https://community.zymbit.com/t/api-documentation/189/8 "2018-01-10T00:14:42Z")

</div>

Hi (it’s me again ¯\_(ツ)\_/¯ )

I just did a new clean install on a raspberry, but I suddenly have a segfault error just after these two lines:  
zkCTX \*ctx;  
zkOpen(\*ctx);

The compilation works fine with the previous help you told me above.  
I am working on jessie distrib, and I enabled the I2C device, and the blue light of the zymbit is blinking every 3s.z

BTW The two python examples you gave are working fine.

Could you help me (again) to find what I forgot?

---

<div class="post-metadata">

### Author: ![Tgratier](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@Tgratier](https://community.zymbit.com/u/Tgratier)
#### Post date: [January 10, 2018, 12:43am UTC](https://community.zymbit.com/t/api-documentation/189/9 "2018-01-10T00:43:46Z")

</div>

and I have the same results with two different zymkey 4i modules and different raspberry and SD cards :-/

---

<div class="post-metadata">

### Author: ![Bob\_of\_Zymbit](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@Bob\_of\_Zymbit](https://community.zymbit.com/u/Bob_of_Zymbit)
#### Post date: [January 10, 2018, 3:08am UTC](https://community.zymbit.com/t/api-documentation/189/10 "2018-01-10T03:08:19Z")

</div>

You need to declare the Zymkey context plainly and then pass in the pointer to the context:

```auto
zkCTX ctx;
zkOpen(&ctx);

```

---

<div class="post-metadata">

### Author: ![Tgratier](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@Tgratier](https://community.zymbit.com/u/Tgratier)
#### Post date: [January 10, 2018, 5:54am UTC](https://community.zymbit.com/t/api-documentation/189/11 "2018-01-10T05:54:57Z")

</div>

Ok my bad… thx again

---

<div class="post-metadata">

### Author: ![Bob\_of\_Zymbit](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@Bob\_of\_Zymbit](https://community.zymbit.com/u/Bob_of_Zymbit)
#### Post date: [January 10, 2018, 6:35am UTC](https://community.zymbit.com/t/api-documentation/189/12 "2018-01-10T06:35:27Z")

</div>

No problem. Happy to help 🙂

---

<div class="post-metadata">

### Author: ![vis-k](https://avatars.discourse-cdn.com/v4/letter/v/96bed5/32.png) [@vis-k](https://community.zymbit.com/u/vis-k)
#### Post date: [May 7, 2018, 8:24am UTC](https://community.zymbit.com/t/api-documentation/189/13 "2018-05-07T08:24:46Z")

</div>

> [@Bob\_of\_Zymbit](#):
>
> de this path in your C cod

Hi, I have the same problem. I tried your solutions (path included in my C code or in the gcc command), but I cannot compile my code.  
Please help me.

---

<div class="post-metadata">

### Author: ![Michelle\_of\_Zymbit](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michelle\_of\_Zymbit](https://community.zymbit.com/u/Michelle_of_Zymbit)
#### Post date: [August 4, 2020, 8:20pm UTC](https://community.zymbit.com/t/api-documentation/189/14 "2020-08-04T20:20:05Z")

</div>



---

<div class="post-metadata">

### Author: ![Michelle\_of\_Zymbit](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michelle\_of\_Zymbit](https://community.zymbit.com/u/Michelle_of_Zymbit)
#### Post date: [August 12, 2020, 5:18pm UTC](https://community.zymbit.com/t/api-documentation/189/15 "2020-08-12T17:18:33Z")

</div>



---

<div class="post-metadata">

### Author: ![Michelle\_of\_Zymbit](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michelle\_of\_Zymbit](https://community.zymbit.com/u/Michelle_of_Zymbit)
#### Post date: [November 16, 2020, 8:05pm UTC](https://community.zymbit.com/t/api-documentation/189/16 "2020-11-16T20:05:41Z")

</div>



---

<div class="post-metadata">

### Author: ![Michelle\_of\_Zymbit](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michelle\_of\_Zymbit](https://community.zymbit.com/u/Michelle_of_Zymbit)
#### Post date: [August 25, 2021, 4:55pm UTC](https://community.zymbit.com/t/api-documentation/189/17 "2021-08-25T16:55:29Z")

</div>


