This is an older version of the Campaign Monitor API. We strongly encourage you to quit livin' in the past and use the shiny new RESTful version with lots of new functionality. You won't regret it.
User.GetApiKey
Gets the API key for a Campaign Monitor user or client, given site URL, username, password. If the user has not already had their API key generated at the time this method is called, the user’s API key will be generated and returned by this method.
We recommend that everyone use the HTTP Secure endpoint for all API method calls, however due to the authentication mechanism of this method being based on a user’s username and password, we would strongly recommend that you use the secure API endpoint for all calls to this method.
Parameters and required information
Here’s a list of all the parameters you’ll need to pass to the User.GetApiKey method. All of the parameters are required unless otherwise noted.
SiteUrl
The base URL of the site you use to login to Campaign Monitor. e.g. http://example.createsend.com/
Username
The username you use to login to Campaign Monitor.
Password
The password you use to login to Campaign Monitor.
Return Codes
Success
Upon a successful call, this method will return a string containing the API key for the user identified by the username and password entered.
Error
105: Invalid Login
Your login URL, username and password combination is incorrect.
SOAP 1.1
The following is a sample SOAP request and response. The placeholders shown need to be replaced with actual values.
POST /api/api.asmx HTTP/1.1
Host: api.createsend.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://api.createsend.com/api/User.GetApiKey"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<User.GetApiKey xmlns="http://api.createsend.com/api/">
<SiteUrl>string</SiteUrl>
<Username>string</Username>
<Password>string</Password>
</User.GetApiKey>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<User.GetApiKeyResponse xmlns="http://api.createsend.com/api/">
<User.GetApiKeyResult>string</User.GetApiKeyResult>
</User.GetApiKeyResponse>
</soap:Body>
</soap:Envelope>
HTTP GET
The following is a sample HTTP GET request and response. The placeholders shown need to be replaced with actual values.
GET /api/api.asmx/User.GetApiKey?SiteUrl=string&Username=string&Password=string HTTP/1.1
Host: api.createsend.com
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://api.createsend.com/api/">string</string>
HTTP POST
The following is a sample HTTP POST request and response. The placeholders shown need to be replaced with actual values.
POST /api/api.asmx/User.GetApiKey HTTP/1.1
Host: api.createsend.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
SiteUrl=string&Username=string&Password=string
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://api.createsend.com/api/">string</string>