# Registering a new gateway with V3 API

**URL:** <https://www.thethingsnetwork.org/forum/t/registering-a-new-gateway-with-v3-api/62023>\
**Category:** Gateways\
**Tags:** gateways\
**Created:** [March 17, 2023, 11:01am UTC](https://www.thethingsnetwork.org/forum/t/registering-a-new-gateway-with-v3-api/62023 "2023-03-17T11:01:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![barry-bridges](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/b/b5a626/32.png) [@barry-bridges](https://www.thethingsnetwork.org/forum/u/barry-bridges)\
**Post date:** [March 17, 2023, 11:01am UTC](https://www.thethingsnetwork.org/forum/t/registering-a-new-gateway-with-v3-api/62023/1 "2023-03-17T11:01:18Z")

</div>

Hi,  
I’m trying to register a new gateway through the v3 API. I’ve had success with registering/deleting devices, but the API for the gateways seems to be confusing me.

I have the usual headers with bearer token etc.  
The raw data I’m sending is

{  
“gateway”: {“ids”:  
{  
“gateway\_id”: “eui-c0ee40ffffxxxxx”,  
“eui”: “xxxxxxxxxxxxxxxx”  
},  
“name”: “test-gateway”,  
“gateway\_server\_address”: “tenant\_name.eu1.cloud.thethings.industries”,  
“frequency\_plan\_id”: “AS\_923”  
}  
}  
The POST request is as follows  
https://tenant\_name.eu1.cloud.thethings.industries/api/v3/users/username@tenant\_name/gateways

And the response I get back is as follows

{  
“code”: 3,  
“message”: “error:pkg/errors:validation (invalid `collaborator`: embedded message failed validation)”,  
“details”: [  
{  
“@type”: “[type.googleapis.com/ttn.lorawan.v3.ErrorDetails](http://type.googleapis.com/ttn.lorawan.v3.ErrorDetails)”,  
“namespace”: “pkg/errors”,  
“name”: “validation”,  
“message\_format”: “invalid `{field}`: {reason}”,  
“attributes”: {  
“field”: “collaborator”,  
“name”: “CreateGatewayRequestValidationError”,  
“reason”: “embedded message failed validation”  
},  
“correlation\_id”: “e30da9e72fcf4f1a8e9a79266b26823c”,  
“cause”: {  
“namespace”: “pkg/errors”,  
“name”: “validation”,  
“message\_format”: “invalid `{field}`: {reason}”,  
“attributes”: {  
“field”: “user\_ids”,  
“name”: “OrganizationOrUserIdentifiersValidationError”,  
“reason”: “embedded message failed validation”  
},  
“correlation\_id”: “078e82453c7b468ca8ee2cd0a3718f41”,  
“cause”: {  
“namespace”: “pkg/errors”,  
“name”: “validation”,  
“message\_format”: “invalid `{field}`: {reason}”,  
“attributes”: {  
“field”: “user\_id”,  
“name”: “UserIdentifiersValidationError”,  
“reason”: “value does not match regex pattern "^a-z0-9{1,}$"”  
},  
“correlation\_id”: “43236594c2444191bfbeaca494c739e6”,  
“code”: 3  
},  
“code”: 3  
},  
“code”: 3  
}  
]  
}

Many thanks

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [March 17, 2023, 11:51am UTC](https://www.thethingsnetwork.org/forum/t/registering-a-new-gateway-with-v3-api/62023/2 "2023-03-17T11:51:01Z")

</div>

Please format logs & JSON with the \</\> tool - click the … button for the pencil tool to edit your post.

Plus what does the error message tell you - all the info you need is there!

---

<div class="post-metadata">

**Author:** ![barry-bridges](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/b/b5a626/32.png) [@barry-bridges](https://www.thethingsnetwork.org/forum/u/barry-bridges)\
**Post date:** [March 21, 2023, 10:51am UTC](https://www.thethingsnetwork.org/forum/t/registering-a-new-gateway-with-v3-api/62023/3 "2023-03-21T10:51:37Z")

</div>

Thanks Nick,  
That got me a little further, but I’m having access rights issues.  
`"message":"error:pkg/auth/rights:no_user_rights (no rights for user `user@company`)"`

On the console I’m set up as a Admin with all rights? Am I using the wrong API key? Or is there somewhere that I’m missing for enabling the gateway create rights?

Many thanks

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [March 21, 2023, 11:10am UTC](https://www.thethingsnetwork.org/forum/t/registering-a-new-gateway-with-v3-api/62023/4 "2023-03-21T11:10:20Z")

</div>

Is your tenant name really tenant-name?

Look at the URL you are using on the console and look at what you’ve got in the JSON.

---

<div class="post-metadata">

**Author:** ![barry-bridges](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/b/b5a626/32.png) [@barry-bridges](https://www.thethingsnetwork.org/forum/u/barry-bridges)\
**Post date:** [March 21, 2023, 11:15am UTC](https://www.thethingsnetwork.org/forum/t/registering-a-new-gateway-with-v3-api/62023/5 "2023-03-21T11:15:32Z")

</div>

> [@descartes](#):
>
> Look at the URL you are using on the console and look at what you’ve got in the JSON.

No, that was just to hide the company name. Sorry I should have stated the URL has changed to use  
`https://'company-name'.eu1.cloud.thethings.industries/api/v3/users/'user-name'/gateways`

The ‘company-name’ and ‘user-name’ are my valid logins details. I can use then successfully to register an end device with the API.

Many thanks

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [March 21, 2023, 11:29am UTC](https://www.thethingsnetwork.org/forum/t/registering-a-new-gateway-with-v3-api/62023/6 "2023-03-21T11:29:31Z")

</div>

Yeah, redaction, doesn’t work for the CIA either - the only real secrets are AppKeys, API keys & passwords!

That API url looks off, I mostly do stuff with devices on the CLI and I don’t recall it pointing to a user endpoint unless you are doing something with users - maybe worth reviewing the docs. I’ll have a squint later, got to herd some staff & cats.

As to the API key, you’ll have to use your master one that is in your personal settings.

---

<div class="post-metadata">

**Author:** ![maateej](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/m/f475e1/32.png) [@maateej](https://www.thethingsnetwork.org/forum/u/maateej)\
**Post date:** [December 13, 2023, 4:22pm UTC](https://www.thethingsnetwork.org/forum/t/registering-a-new-gateway-with-v3-api/62023/7 "2023-12-13T16:22:53Z")

</div>

I have got a similiar problem as Barry. I am trying to register a gateway with bash scirpt. I am getting a “curl: (52) Empty reply from server” which basically means that the server blocked my request.

My command call:

curl -v -d --location   
–header ‘Accept: application/json’   
–header 'Authorization": "Bearer my-api-key   
–header ‘Content-Type: application/json’   
–request POST   
–data-raw ‘{  
“gateway”: {  
“ids”: {  
“gateway\_id”: “8c65f94fc31d”,  
“eui”: “8C65F9FFFE4FC31D”  
},  
“name”: “my gateway”,  
“gateway\_server\_address”: “my-company.eu1.cloud.thethings.industries”,  
“frequency\_plan\_id”: EU\_863\_870\_TTN  
}  
}’   
‘[https://my-company.eu1.cloud.thethings.industries/api/v3/users/my-user/gateways](https://my-company.eu1.cloud.thethings.industries/api/v3/users/my-user/gateways)’

I tried to test the generated api-key with a simple getter request for device informations and it seems to work, I am receiving data from the server. Despite of that, I am not able to register any gateway with the command above.

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [December 13, 2023, 6:16pm UTC](https://www.thethingsnetwork.org/forum/t/registering-a-new-gateway-with-v3-api/62023/8 "2023-12-13T18:16:03Z")

</div>

> [@maateej](#):
>
> which basically means that the server blocked my request.

Surely if it blocked your address it would be access denied?

Please format your logs / JSON / text / console with the \</\> tool, makes it easy to read.

The best way to find out what’s needed and what to call is to observe the browser console when creating one via the web.

Or, as you have a TTI instance, use your support package.
