See api-docs Menu

Create an App

Use this API to create a new app based off a OneLogin connector.

Early Access Release

This API is currently in early preview release and may be subject to future breaking changes. If you’re interested in using this API please contact your account manager or our support team.

Resource URL

https://api.<us_or_eu>.onelogin.com/api/2/apps

Header Parameters

Authorization

required

string

Set to bearer <access_token>.

Set <access_token> to the access token you generated using the Generate Token API.

The access token must have been generated using an API credential pair created using the scope required to call this API. This API can be called using any one of the following scopes: Manage All.

Content-Type

required

string

Set to application/json.

Request Parameters

The minimum requirement to create an app is the connector_id and a name.

For a complete list of all possible values for a given app it is recommended to do a Get App request on an app that is based of the same connector.

Also see the App Resource for general app attributes.

connector_id

required

integer

ID of the connector to base the app from.

name

required

string

The name of the app

Adding New Parameters

If the connector allows it, new parameters can be added to an app during creation. To determine if a connector supports custom parameters to be defined check the allows_new_parameters attribute on the List Connectors endpoint.

GET api/1/connectors?name=amazon&auth_method=2

[{
  "allows_new_parameters": true,
  "id": 50534,
  "name": "Amazon Web Services (AWS) Multi Role",
  "icon_url": "https://cdn-shadow.onlgn.net/images/icons/square/amazonwebservices3multirole/old_original.png?1421095823",
  "auth_method": 2
}]

When allowed, any parameter that is added to the parameters object will be automatically created if it does not match a parameter name that already exists on the app.

For example, if the employee_number parameter does not exist on the app and this payload is supplied a new parameter with that name would be created.

{
    "parameters": {
        "employee_number": {
            "values": null,
            "default_values": null,
            "label": "Employee Number"
        }
    }
}

OpenId Connect Sample

This sample request uses the Generic OpenId Connect connector. The response payload when creating an OpenId Connect app will include an SSO object which contains the apps new client_id and client_secret.

{
  "connector_id": 108419,
  "name": "Sample OpenId Connect App",
  "description": "",
  "visible": true,
  "policy_id": 165278,
  "configuration": {
      "login_url": "http://example.com/login",
      "redirect_uri": "http://example.com/callback",
      "access_token_expiration_minutes": 5,
      "refresh_token_expiration_minutes": 60,
      "token_endpoint_auth_method": 0,
      "oidc_application_type": 0
  }
}

SAML Sample

This sample request uses the AWS Multi Role Connector.

{
  "connector_id": 50534,
  "name": "Amazon Web Services (AWS) Multi Role",
  "description": "",
  "visible": true,
  "policy_id": 165278,
  "sso": {
    "certificate": {
      "id": 170216
    }
  },
  "configuration": {
    "signature_algorithm": "SHA-1"
  },
  "parameters": {
    "saml_username": {
      "user_attribute_mappings": "email"
    }
  }
}

Sample Responses

See the App Resource documentation for detail on the app attributes returned via this API.

On success, the full app configuration is returned. This is a sample response for an OpenId Connect app.

{
  "id": 928549,
  "name": "Sample OpenId Connect App",
  "visible": true,
  "description": "",
  "notes": null,
  "icon_url": "/images/missing_connector_icon/square/old_original.png",
  "auth_method": 8,
  "policy_id": 165278,
  "provisioning": {
    "enabled": false
  },
  "allow_assumed_signin": false,
  "tab_id": null,
  "connector_id": 108419,
  "sso": {
    "client_secret": "3acdcdba4e57bbb4f0454a8729fbc4ec5c4ac327c8e1d6d60c305cc9ea5dbcd3",
    "client_id": "b5dee2e0-5cbf-0137-6e19-12c80e5197ec92920"
  },
  "configuration": {
    "redirect_uri": "http://example.com/callback",
    "refresh_token_expiration_minutes": 60,
    "login_url": "http://example.com/login",
    "oidc_encryption_key": "",
    "oidc_application_type": 0,
    "token_endpoint_auth_method": 0,
    "access_token_expiration_minutes": 5
  },
  "created_at": "2019-05-19T23:56:57Z",
  "updated_at": "2019-05-19T23:56:57Z",
  "parameters": {
    "groups": {
      "values": null,
      "user_attribute_mappings": null,
      "provisioned_entitlements": false,
      "skip_if_blank": false,
      "id": 237825,
      "default_values": null,
      "attributes_transformations": null,
      "label": "Groups",
      "user_attribute_macros": null,
      "include_in_saml_assertion": true
    }
  }
}

Typically, this error means that your Authorization header value is missing or incorrectly formatted. The Authorization header value should use this format: bearer:<access_token>.

{
    "message": "Unauthorized",
    "statusCode": 401,
    "name": "UnauthorizedError"
}

Indicates that the syntax of the request is good but a value supplied is not valid.

{
    "message": "Validation failed: The associated Policy with ID 0 could not be found",
    "statusCode": 422,
    "name": "UnprocessableEntityError"
}

Postman Collection

Replace sample variables indicated by {{ }} with your actual values.

Download for the Apps API

Sample Code

cURL

Replace sample values indicated by < > with your actual values.

Create App

curl 'https://api.<us_or_eu>>.onelogin.com/api/2/apps' \
-X POST \
-H "Authorization: bearer:<access_token>" \
-H "Content-Type: application/json" \
-d '{
  "connector_id":"<connector_id>",
  "name":"<app name>"
}'

Have a Question?

Have a how-to question? Seeing a weird error? Ask us about it on StackOverflow.

Found a bug? Submit a support ticket.

Have a product idea or request? Share it with us in our Ideas Portal.