The OCS Registration API allows you to register for an account, check the status of the registration and get initial login credentials from within clients.
The base URL for all calls to the API is: <nextcloud_base_url>/ocs/v2.php/apps/registration/api/v1
If cloud providers implement that api they need to provide all of the endpoints described in the following.
All calls to OCS endpoints require the OCS-APIRequest header to be set to true.
This API documentation is still a DRAFT and still can change
Verify that user data is valid before sending a registration request
- username - (string) unique username on the nextcloud instance
- displayname - (string) display name of the user
- email - (string) email of the user
- username - (string)
- displayname - (string)
- email - (string)
- 200 - Data is valid
- 400 - Data is invalid (see OCS message for details)
- username - (string) unique username on the nextcloud instance
- displayname - (string) display name of the user
- email - (string) email of the user
- password - (string) password of the user
- secret - (string) secret to allow the client to check the status of the registration
- registrationStatus - (int) Status of the registration - message - (string) Message about the current state of the registration
- 0 - Registration complete (ready to login)
- 1 - Further steps required (see message for details)
- 2 - Registration already exists
- 200 - Registration successful
- 400 - Registration failed (see OCS message for details)
- clientSecret - (string) client secret to identify
- cloudUrl - (string) Url of the Nextcloud instance to authenticate with
- appPassword - (string) Generated app password the client to login (optional)
- registrationStatus - (int) Status of the registration
- 0 - Registration complete (ready to login)
- 1 - Further steps required (see message for details)
- 2 - Registration already exists
- 200 - Success (See registrationStatus for further details)
- 404 - Registration not found
curl http://localhost:8080/ocs/v1.php/registration/v1/validate\?format\=json \
-H "OCS-APIRequest:true" -v \
--data "username=foobar&displayname=foobar&email=foobar@example.com"
{
"ocs": {
"meta": {
"status": "ok",
"statuscode": 100,
"message": "OK",
"totalitems": "",
"itemsperpage": ""
},
"data": {
"username": "foobar",
"displayname": "foobar",
"email": "foobar@example.com"
}
}
}
{
"ocs": {
"meta": {
"status": "failure",
"statuscode": 999,
"message": "A user has already taken this email, maybe you already have an account?",
"totalitems": "",
"itemsperpage": ""
},
"data": []
}
}
curl http://localhost:8080/ocs/v1.php/registration/v1/register\?format\=json \
-H "OCS-APIRequest:true" -v \
--data "username=foobar&displayname=foobar&email=foobar@example.com&password=foobar"
{
"ocs": {
"meta": {
"status": "ok",
"statuscode": 100,
"message": "OK",
"totalitems": "",
"itemsperpage": ""
},
"data": {
"message": "Your registration is pending. Please confirm your email address.",
"status": 1,
"secret": "L2qdLAtrJTx499ErjwkwnZqGmLdm3Acp"
}
}
}
curl http://localhost:8080/ocs/v1.php/registration/v1/status\?format\=json \
-H "OCS-APIRequest:true" --data \
"clientSecret=L2qdLAtrJTx499ErjwkwnZqGmLdm3Acp"
{
"ocs": {
"meta": {
"status": "ok",
"statuscode": 100,
"message": "OK",
"totalitems": "",
"itemsperpage": ""
},
"data": {
"status": 1,
"message": "Your registration is pending. Please confirm your email address."
}
}
}
curl http://localhost:8080/index.php/apps/registration/verify/RDTK1V
curl http://localhost:8080/ocs/v1.php/registration/v1/status\?format\=json \
-H "OCS-APIRequest:true" --data\
"clientSecret=L2qdLAtrJTx499ErjwkwnZqGmLdm3Acp"
{
"ocs": {
"meta": {
"status": "ok",
"statuscode": 100,
"message": "OK",
"totalitems": "",
"itemsperpage": ""
},
"data": {
"status": 0,
"appPassword": "PsaBw-Xordt-yGGjZ-TARCe-RRJFW",
"cloudUrl": "https://nextcloud.example.com"
}
}
}
curl http://localhost:8080/ocs/v1.php/registration/v1/status\?format\=json \
-H "OCS-APIRequest:true" --data \
"clientSecret=L2qdLAtrJTx499ErjwkwnZqGmLdm3Acp"
{
"ocs": {
"meta": {
"status": "failure",
"statuscode": 998,
"message": "No pending registration.",
"totalitems": "",
"itemsperpage": ""
},
"data": []
}
}