# Add a host automatically - /v2/script authentication string

**URL:** <https://forums.suse.com/t/add-a-host-automatically-v2-script-authentication-string/13474>\
**Category:** Rancher 1.x\
**Created:** [February 27, 2019, 4:33pm UTC](https://forums.suse.com/t/add-a-host-automatically-v2-script-authentication-string/13474 "2019-02-27T16:33:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinci](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@vinci](https://forums.suse.com/u/vinci)\
**Post date:** [February 27, 2019, 4:33pm UTC](https://forums.suse.com/t/add-a-host-automatically-v2-script-authentication-string/13474/1 "2019-02-27T16:33:03Z")

</div>

I’m trying to find a way of automatically adding a host to a Rancher 1.6.26 Server, and I’m not sure how I can find the url string that appears after /v2/scripts when I add a host in the interface. So basically I’m trying to do it within a vagrant environment for testing purposes.

Any advice on how I can get hold of the string automatically without having to manually copying it from the GUI?

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [February 27, 2019, 10:18pm UTC](https://forums.suse.com/t/add-a-host-automatically-v2-script-authentication-string/13474/2 "2019-02-27T22:18:48Z")

</div>

`/v2-beta/projects/<project-id>/registrationTokens` . The UI requests the creation of the first one so if there isn’t already one, send a POST to there first.

---

<div class="post-metadata">

**Author:** ![vinci](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@vinci](https://forums.suse.com/u/vinci)\
**Post date:** [March 1, 2019, 3:47pm UTC](https://forums.suse.com/t/add-a-host-automatically-v2-script-authentication-string/13474/3 "2019-03-01T15:47:18Z")

</div>

I’m not sure if I understood the whole procedure correctly. So I’m trying this on a newly installed rancher server from what should become one of the hosts:

> curl -X POST [http://192.168.99.15:8080/v2-beta/projects/default/registrationTokens](http://192.168.99.15:8080/v2-beta/projects/default/registrationTokens)  
> {“id”:“4e314cf4-aae0-47db-b14f-55f1a2463286”,“type”:“error”,“links”:{},“actions”:{},“status”:403,“code”:“Forbidden”,“message”:“Forbidden”,“detail”:null,“baseType”:“error”}

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [March 1, 2019, 5:26pm UTC](https://forums.suse.com/t/add-a-host-automatically-v2-script-authentication-string/13474/4 "2019-03-01T17:26:20Z")

</div>

Project IDs are not the same as the name of the project. They are of the form `1a<number>`. On a new installation, the “Default” project is always `1a5`.
