API POST for New User

Thanks. I’m realizing I don’t want to use PHP at all; I just want to use Javascript as that’s what I’ll use with GTM.

Perhaps this is getting me closer? Though I don’t know where to add the API key in this script:

<script>
$.ajax({
method: "POST",
url: "https://site.com/invites",
data: { email: "foo@gmail.com", group_names: "Paid_Members" }
})
.done(function( msg ) {
alert( "Data Saved: " + msg );
});
</script>