# Regenerate local\_api\_credentials.yaml?

**URL:** <https://discourse.crowdsec.net/t/regenerate-local-api-credentials-yaml/456>\
**Category:** crowdsec\
**Created:** [December 15, 2021, 3:44pm UTC](https://discourse.crowdsec.net/t/regenerate-local-api-credentials-yaml/456 "2021-12-15T15:44:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![racitup](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@racitup](https://discourse.crowdsec.net/u/racitup)\
**Post date:** [December 15, 2021, 3:44pm UTC](https://discourse.crowdsec.net/t/regenerate-local-api-credentials-yaml/456/1 "2021-12-15T15:44:57Z")

</div>

Is there a way to regenerate the credentials in `local_api_credentials.yaml` and `online_api_credentials.yaml` ?

I would think a fairly common requirement would be to clone containers, overwrite the credentials as a new server, then register with a central LAPI.  
I tried `dpkg-reconfigure crowdsec` which seemed to ask the right questions, but the files above are still empty.  
TIA!

---

<div class="post-metadata">

**Author:** ![thibault](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/thibault/32/2_2.png) [@thibault](https://discourse.crowdsec.net/u/thibault)\
**Post date:** [December 15, 2021, 4:08pm UTC](https://discourse.crowdsec.net/t/regenerate-local-api-credentials-yaml/456/2 "2021-12-15T16:08:57Z")

</div>

`cscli machines add -a` would do the trick (if LAPI is on the same machine), otherwise `cscli machines register` (and you need to accept it on LAPI)

---

<div class="post-metadata">

**Author:** ![racitup](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@racitup](https://discourse.crowdsec.net/u/racitup)\
**Post date:** [December 15, 2021, 4:57pm UTC](https://discourse.crowdsec.net/t/regenerate-local-api-credentials-yaml/456/3 "2021-12-15T16:57:29Z")

</div>

Thanks @thibault just figured it out:

```auto
cscli capi register
cscli lapi register

```

Must have `url: http://lapi_IP:port` in the local\_api\_credentials.yaml file
