# API POST for New User

**URL:** https://meta.discourse.org/t/api-post-for-new-user/148676
**Category:** Development
**Tags:** rest-api
**Created:** [April 20, 2020, 10:53pm UTC](https://meta.discourse.org/t/api-post-for-new-user/148676 "2020-04-20T22:53:30Z")
**Posts on this page:** 3
**Page:** 2

<div class="post-metadata">

### Author: ![waffleslop](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/waffleslop/32/244974_2.png) [@waffleslop](https://meta.discourse.org/u/waffleslop)
#### Post date: [April 22, 2020, 4:00pm UTC](https://meta.discourse.org/t/api-post-for-new-user/148676/21 "2020-04-22T16:00:38Z")

</div>

I’m stuck and don’t know if this is merely my own error, if I’m receiving a false positive, or something else.

When I do a POST request via Postman, I get a SUCCESS message:  
`https://site.co/users.json?Api-Key=12345abcde12345&Api-Username=system&email=name@email.co&group_names=Alumni&custom_message=Welcome321`

Message:

```
{
    "success": true,
    "active": false,
    "message": "<p>You’re almost done! We sent an activation mail to <b>name@email.co</b>. Please follow the instructions in the mail to activate your account.</p><p>If it doesn’t arrive, check your spam folder.</p>"
}

```

However, when I check my inbox, I have no notification. Nothing in my `/logs`, no user.

In an attempt to troubleshoot, I do a simple GET request:

`https://site.co/admin/email.json?Api-Key=12345abcde12345&Api-Username=system`

I get no success reply. The reply is `<!DOCTYPE html> ...`

So I manually go to [https://site.co/admin/email.json](https://site.co/admin/email.json) and see:  
`{"delivery_method":"smtp","settings":[{"name":"address","value":"smtp.sendgrid.net"},{"name":"port","value":2525},{"name":"user_name","value":"apikey"},{"name":"authentication","value":"plain"},{"name":"enable_starttls_auto","value":true}]}`

Any ideas what I can try? My outcome is being able to invite a new user, added to a Group, via Webhook/POST.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [April 23, 2020, 12:48pm UTC](https://meta.discourse.org/t/api-post-for-new-user/148676/22 "2020-04-23T12:48:55Z")

</div>

You’ll need to move the API key into the header.

A long time ago I solved what I think is your problem by creating, deactivating, and activating the user.

---

<div class="post-metadata">

### Author: ![neounix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neounix/32/215617_2.png) [@neounix](https://meta.discourse.org/u/neounix)
#### Post date: [April 23, 2020, 1:00pm UTC](https://meta.discourse.org/t/api-post-for-new-user/148676/23 "2020-04-23T13:00:43Z")

</div>

> [@waffleslop](#):
>

Your script is Javascript (jQuery). Using `type="application/json"` is generally for JSON in the script not Javascript. Here is an example:

```plaintext
<script id="data" type="application/json">
{"org": 10, "items":["one","two"]}
</script>

```

My understanding is your script tags should look like this:

```plaintext
<script>
$.ajax({
method: "POST",
url: "https://site.co/invites",
headers: { "Api-Username": "system", "Api-Key": "12345" },
data: { 
"email": "grow@site.co",
"group_names": "Alumni",
"custom_message": "Welcome123"
}
});
</script>

```

For Javascript, you don’t need to specify `type="javascript"` anymore, as this was made obsolete a while back.

[Previous page](https://meta.discourse.org/t/api-post-for-new-user/148676.md?page=1)
