API:Account creation/pre-1.27

Creating accounts
You can create accounts using the API. This can be a new account for yourself, or you can create an account for someone else, with a random password mailed to that person. Account creations are recorded in Special:log/newusers. If you're logged in, your username will also be recorded when creating an account.

Parameters


Extended parameters when used with Extension:ConfirmEdit (except ReCaptcha):

Token
To create an account, a token is required. To retrieve a token, you make the request that you want, except with the token field being an empty string. Once you retrieve the token, you make the request again with the token filled in. This is similar to how the log in module works. See the example below for details.

Example
Note: In this example, all parameters are passed in a GET request just for the sake of simplicity. However, action=createaccount requires POST requests; GET requests will cause an error.

We should now receive a response like:

We take the token given here, and add it to the request:

Assuming everything works, we should get a result like:

And GymBeauWhales@example.com would get an email with instructions on how to log in.

CAPTCHA
When used with Extension:ConfirmEdit, a CAPTCHA may be presented for new account creations. This is supported via extension in the API here.

When submitting per the above rules and receiving a response, you may also receive a  node in the return data, similar to what is sometimes returned by action=edit.

For a text-based CAPTCHA:

For an image-based CAPTCHA:

Be aware that the URL may be site-relative or protocol-relative.

When you receive such a response, you need to submit a third response, which is similar to the one submitted in step 2 but contains the necessary responses. By default, you should return the captcha id in the  parameter, and the value (solution) of the captcha in the   parameter, however some captcha modules, like ReCaptcha, use different parameters. Check the module's documentation for specifics.

As of the current code (see ) you won't receive the captcha prompt response until after basic validation errors have been taken care of.

Possible outputs
The result value can have one of three values (n.b., values are lower-case prior to 1.23):
 * NeedToken: A token is needed. A token parameter should also be set with a token to use.
 * If you get a NeedToken result when you are expecting a success result, make sure the token you are sending is correct, and that you are sending along any cookies sent by the API.
 * Success: Everything worked
 * Warning: Not used in core, however extensions can (in theory) add warnings, in which case the result attribute will be warning. However, this still generally means the account was created successfully.
 * Warning: Not used in core, however extensions can (in theory) add warnings, in which case the result attribute will be warning. However, this still generally means the account was created successfully.
 * Warning: Not used in core, however extensions can (in theory) add warnings, in which case the result attribute will be warning. However, this still generally means the account was created successfully.

Possible errors
All errors are formatted as: Many of the info codes to this module correspond to system messages. As a result the info part may change and in particular will vary with language.

Disable
To disable specifically this API feature, insert the following line in your configuration file: