Appearance
Fresh 2026
Test Account
Reading
A test user account for a Facebook app
Example
HTTPPHP SDKJavaScript SDKAndroid SDKiOS SDK Graph API Explorer
GET v25.0/...?fields={fieldname_of_type_TestAccount} HTTP/1.1
Host: graph.facebook.com/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->get(
'...?fields={fieldname_of_type_TestAccount}',
'{access-token}'
);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
/* handle the result *//* make the API call */
FB.api(
"...?fields={fieldname_of_type_TestAccount}",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"...?fields={fieldname_of_type_TestAccount}",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]\
initWithGraphPath:@"...?fields={fieldname_of_type_TestAccount}"\
parameters:params\
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,\
id result,\
NSError *error) {\
// Handle the result\
}];If you want to learn how to use the Graph API, read our Using Graph API guide.
Parameters
This endpoint doesn't have any parameters.
Fields
| Field | Description |
|---|---|
id<br>numeric string | User ID<br>Default |
login_url<br>string | A link to log in to Facebook as this test user<br>Default |
Creating
You can make a POST request to accounts edge from the following paths:
/{application_id}/accounts
When posting to this edge, a TestAccount will be created.
Parameters
| Parameter | Description |
|---|---|
installed<br>boolean | Automatically installs the app for the test user once it is created or associated |
minor<br>boolean | Is this test user a minor |
name<br>string | The name for the test user. When left blank, a random name will be automatically generated |
owner_access_token<br>string | When associating existing test users with other apps, this is the app access token of any app that is already associated with the test user. The {app-id} in the publishing request in this case should be the app that will is the target to associate with the test user. The API request should also be signed with the app access token of that target app. Required when associating test users, but should not be used when creating new test users |
permissions<br>List<Permission> | Default value: Set<br>List of permissions that are automatically granted for the app when it is created or associated |
type<br>enum{test-users} | Type |
uid<br>int | ID of an existing test user to associate with another app. Required when associating test users, but should not be used when creating new test users |
Return Type
This endpoint supports read-after-write and will read the node represented by id in the return type.
Struct {
id: numeric string,
access_token: string,
login_url: string,
email: string,
password: string,
}
Error Codes
| Error | Description |
|---|---|
| 2900 | Too many test accounts |
| 195 | The name you are trying to use is invalid |
Updating
You can't perform this operation on this endpoint.
Deleting
You can dissociate a TestAccount from an Application by making a DELETE request to /{application_id}/accounts.
Parameters
| Parameter | Description |
|---|---|
type<br>enum {TEST_USERS} | Account type |
uid<br>UID | Account UID<br>Required |
Return Type
Struct {
success: bool,
}
Error Codes
| Error | Description |
|---|---|
| 2902 | Cannot remove test account from this app |