Skip to content

Create a mailing list member

Request

Adds a new member to the mailing list. For adding many list members, consider bulk upload endpoints "POST /v3/lists/{list_address}/members.json" or "members.csv".

Security
basicAuth
Path
list_addressstringrequired

The mailing list's address

Bodymultipart/form-data
addressstring

Valid email address specification.

namestring

An optional member name.

varsobject

JSON-encoded dictionary string with arbitrary parameters.

subscribedboolean

Set the member as subscribed or not. Defaults to true.

upsertboolean

Set to True to update member if present, False to raise error in case of a duplicate member. Defaults to false.

curl -i -X POST \
  -u '<username>:<password>' \
  'https://api.mailgun.net/v3/lists/{list_address}/members' \
  -H 'Content-Type: multipart/form-data' \
  -F address=alice@example.com \
  -F name=Alice \
  -F 'vars={"gender":"female","age":27}' \
  -F subscribed=true \
  -F upsert=true

Responses

OK

Bodyapplication/json
memberobject(ListMemberResponse)
messagestring

Success message

Response
{ "member": { "address": "alice@example.com", "name": "Alice", "vars": {}, "subscribed": true }, "message": "Mailing list member has been created" }