NAV
curl

Introduction

Welcome to elastic.io. This documentation is a full reference for the REST API documentation v2. The API implements the JSON API specification. We encourage the reader to familiarise himself with the details of the JSON API specification.

Authentication

You authenticate to the elastic.io API by providing your API key in the request.

Authentication to the API occurs via HTTP Basic Auth. Provide your email as the basic auth username and API key as the password.

curl https://api.elastic.io/v2/users/me \
   -u {EMAIL}:{APIKEY}

Status Codes

Success

The elastic.io API responds with following status codes upon successful requests:

Status Code Meaning
200 Ok – Successful HTTP requests
201 Created – requested resource has been created successfully

Errors

The elastic.io API uses the following error codes:

Error Code Meaning
400 Bad Request – The server cannot or will not process the request due to an apparent client error
401 Unauthorized – Your API key is wrong
403 Forbidden – The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource
404 Not Found – The specified resource could not be found
405 Method Not Allowed – You tried to access a resource with an invalid method
406 Not Acceptable – You requested a format that isn’t json
409 The resource object’s type is not among the type(s) that constitute the collection represented by the endpoint or a POST request to create a resource with a client-generated ID that already exists
410 Gone – The resource requested has been removed from our servers
418 I’m a teapot
429 Too Many Requests – You’re requesting too many resources! Slow down!
500 Internal Server Error – We have a problem with our server. Try again later
503 Service Unavailable – We’re temporarily offline for maintenance. Please try again later

Components

Accessing and sharing components

Each Component belongs to a Team. Each User who is a member of the team can edit the component.

The component has an attribute access, which indicates how is the component shared by the other clients. “Shared” means, that the component can be used by the users in their flows. There are three sharing modes:

Accordingly, a set of components, available for each user is consist of: not shared components from the user’s organization, components with tenant access and global components.

Request \ Role Tenant Admin Organization Admin Integrator Guest
Retrieve all components X X X X
Retrieve a component by ID X X X X
Retrieve component versions X X X X
Retrieve a component descriptor X X X X
Create a component repository X X - -
Update component access X - - -
Delete a component X X - -
Retrieve component’s environment variables X X X X
Update component’s environment variables X X - -

Retrieve all components

Example Request:

curl https://api.elastic.io/v2/components \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "data": [
        {
            "id": "{COMPONENT_ID}",
            "type": "component",
            "links": {
                "self": "/v2/components/{COMPONENT_ID}"
            },
            "attributes": {
                "name": "name",
                "team_name": "team_name"
            },
            "relationships": {
                "versions": {
                    "links": {
                        "related": "/v2/components/{COMPONENT_ID}/versions"
                    }
                },
                "latest_version": {
                    "data": {
                        "id": "{GIT_REVISION}",
                        "type": "version"
                    },
                    "links": {
                        "self": "/v2/components/{COMPONENT_ID}/versions/latest"
                    }
                }
            }
        },
//..........................
]
"meta": {},
    "included": [
        {
            "id": "{GIT_REVISION}",
            "type": "version",
            "links": {
                "self": "/v2/versions/{GIT_REVISION}"
            },
            "attributes": {
                "date": 1517392057184,
                "version_number": 69
            },
            "relationships": {
                "descriptor": {
                    "data": {
                        "id": "0eff1d1a46b78ba1f468982e16d0382e8a91280d",
                        "type": "descriptor"
                    },
                    "links": {
                        "self": "/v2/components/{COMPONENT_ID}/versions/{GIT_REVISION}/descriptor"
                    }
                },
                "component": {
                    "data": {
                        "id": "{COMPONENT_ID}",
                        "type": "component"
                    },
                    "links": {
                        "self": "/v2/components/{COMPONENT_ID}"
                    }
                }
            }
        },
        {
            "id": "0eff1d1a46b78ba1f468982e16d0382e8a91280d",
            "type": "descriptor",
            "links": {
                "self": "/v2/descriptors/0eff1d1a46b78ba1f468982e16d0382e8a91280d"
            },
            "attributes": {
                "repo_name": "repo_name",
                "team_name": "team_name",
                "short_revision": "0eff1d1",
                "is_latest": true,
                "description": "desc",
                "icon": "BASE64",
                "language": "nodejs",
                "sailor_version": "2.1.6",
                "title": "Data mapper",
                "service": "mapper",
                "actions": {
                    "map": {
                        "title": "Mapper",
                        "main": "./map.js"
                    },
                    "jsonataMap": {
                        "title": "Jsonata mapper",
                        "main": "./jsonata_map.js"
                    }
                },
                "fields": {
                    "mapper": {
                        "viewClass": "MapperView"
                    }
                }
            },
            "relationships": {
                "version": {
                    "data": {
                        "id": "{GIT_REVISION}",
                        "type": "version"
                    },
                    "links": {
                        "self": "/v2/{COMPONENT_ID}/versions/{GIT_REVISION}"
                    }
                }
            }
        },
//....................................
],
    "links": {
        "self": "/v2/components"
    }
}

This endpoint retrieves a list of available components. Response includes latest descriptor for each component. More details about the component descriptors can be found here.

HTTP Request

GET https://api.elastic.io/v2/components

Query Parameters

Parameter Required Description
filter[access] No Allowed values: private (only components from own organizations returned), public (only shared components from the other organizations) and all (default value, returns all available components).

Returns

Returns repositories metadata object if the call succeeded.

Retrieve a component by ID

Example Request:

curl https://api.elastic.io/v2/components/{COMPONENT_ID} \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "data": {
        "id": "{COMPONENT_ID}",
        "type": "component",
        "links": {
            "self": "/v2/components/{COMPONENT_ID}"
        },
        "attributes": {
            "name": "component name",
            "team_name": "{team_name}"
        },
        "relationships": {
            "versions": {
                "links": {
                    "related": "/v2/components/{COMPONENT_ID}/versions"
                }
            },
            "latest_version": {
                "data": {
                    "id": "{GIT_REVISION}",
                    "type": "version"
                },
                "links": {
                    "self": "/v2/components/{COMPONENT_ID}/versions/latest"
                }
            }
        }
    },
    "meta": {},
    "included": [
        {
            "id": "{GIT_REVISION}",
            "type": "version",
            "links": {
                "self": "/v2/versions/{GIT_REVISION}"
            },
            "attributes": {
                "date": 1513183339032,
                "version_number": 7
            },
            "relationships": {
                "descriptor": {
                    "data": {
                        "id": "{GIT_REVISION}",
                        "type": "descriptor"
                    },
                    "links": {
                        "self": "/v2/components/{COMPONENT_ID}/versions/{GIT_REVISION}/descriptor"
                    }
                },
                "component": {
                    "data": {
                        "id": "{COMPONENT_ID}",
                        "type": "component"
                    },
                    "links": {
                        "self": "/v2/components/{COMPONENT_ID}"
                    }
                }
            }
        },
        {
            "id": "{GIT_REVISION}",
            "type": "descriptor",
            "links": {
                "self": "/v2/descriptors/{GIT_REVISION}"
            },
            "attributes": {
                "repo_name": "repo_name",
                "team_name": "team_name",
                "short_revision": "df7cf1d",
                "is_latest": true,
                "description": "desc",
                "icon": "BASE64",
                "language": "nodejs",
                "sailor_version": "2.2.1",
                "title": "title",
                "actions": {update": "<Actions Object>},
                "triggers": {"select": "<Triggers Object>"},
                "credentials": {
                    "fields": {
                        "apiKey": {
                            "label": "API key",
                            "required": true,
                            "viewClass": "TextFieldWithNoteView",
                            "note": "{note}"
                        }
                    }
                }
            },
            "relationships": {
                "version": {
                    "data": {
                        "id": "{GIT_REVISION}",
                        "type": "version"
                    },
                    "links": {
                        "self": "/v2/{COMPONENT_ID}/versions/{GIT_REVISION}"
                    }
                }
            }
        }
    ]
}

HTTP Request

GET https://api.elastic.io/v2/components/{COMPONENT_ID}

URL Parameters

Parameter Required Description
COMPONENT_ID Yes Component identifier

Authorization

The component should be accessible to the client (e.g. component from the own organization or shared one) unless it has TenantAdmin role. Contact support team to get this role.

Returns

This endpoint returns a component object and includes latest descriptor for each component.

Retrieve component versions

Example Request:

curl https://api.elastic.io/v2/components/{COMPONENT_ID}/versions \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "data": [
        {
            "id": "{GIT_REVISION}",
            "type": "version",
            "links": {
                "self": "/v2/versions/{GIT_REVISION}"
            },
            "attributes": {
                "date": 1508754889997,
                "version_number": 1
            },
            "relationships": {
                "descriptor": {
                    "data": {
                        "id": "{GIT_REVISION}",
                        "type": "descriptor"
                    },
                    "links": {
                        "self": "/v2/components/{COMPONENT_ID}/versions/{GIT_REVISION}/descriptor"
                    }
                },
                "component": {
                    "data": {
                        "id": "{COMPONENT_ID}",
                        "type": "component"
                    },
                    "links": {
                        "self": "/v2/components/{COMPONENT_ID}"
                    }
                }
            }
        }
    ],
    "meta": {},
    "links": {
        "self": "/v2/components/{COMPONENT_ID}/versions"
    }
}

This endpoint retrieves list of component’s versions

HTTP Request

GET https://api.elastic.io/v2/components/{COMPONENT_ID}/versions

URL Parameters

Parameter Required Description
COMPONENT_ID Yes Component identifier

Authorization

The component should be accessible to the client (e.g. component from the own organization or shared one) unless it has TenantAdmin role. Contact support team to get this role.

Returns

Returns repositories build metadata object if the call succeeded.

Retrieve a component descriptor

Example Request:

curl https://api.elastic.io/v2/components/{COMPONENT_ID}/versions/{GIT_REVISION}/descriptor \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "data": {
        "id": "{GIT_REVISION}",
        "type": "descriptor",
        "links": {
            "self": "/v2/descriptors/{GIT_REVISION}"
        },
        "attributes": {
            "repo_name": "repo_name",
            "team_name": "team_name",
            "short_revision": "cf0a2d9",
            "is_latest": true,
            "description": "desc",
            "icon":"BASE64",
            "language": "nodejs",
            "sailor_version": "2.2.1",
            "title": "title",
            "actions": {
                "update": "<Actions Object>"
            },
            "triggers": {
                "select": "<Triggers Object>"
            },
            "credentials": {
                "fields": {
                    "apiKey": {
                        "label": "API key",
                        "required": true,
                        "viewClass": "TextFieldWithNoteView",
                        "note": "note"
                    }
                }
            }
        },
        "relationships": {
            "version": {
                "data": {
                    "id": "{GIT_REVISION}",
                    "type": "version"
                },
                "links": {
                    "self": "/v2/{COMPONENT_ID}/versions/{GIT_REVISION}"
                }
            }
        }
    },
    "meta": {}
}

This endpoint retrieves an information about single component by it’s ID and/or version, for latest version use latest. More details can be find here.

HTTP Request

GET https://api.elastic.io/v2/components/{COMPONENT_ID}/versions/{GIT_REVISION}/descriptor

or

GET https://api.elastic.io/v2/components/{COMPONENT_ID}/versions/latest/descriptor

URL Parameters

Parameter Required Description
COMPONENT_ID Yes Component identifier
GIT_REVISION Yes Revision of the component’s build. Use latest to retrieve the descriptor of the most recent successful build.

Authorization

The component should be accessible for the client (e.g. component from own organization or shared one) unless it has TenantAdmin role. Contact support team to get this role.

Returns

Returns component descriptor if the call succeeded.

Create a component repository

Example Request:

curl https://api.elastic.io/v2/components/ \
   -X POST \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'
   -H 'Content-Type: application/json' -d '
   {
       "data": {
           "type": "component",
           "attributes": {
               "name": "mycomponent"
           },
           "relationships": {
               "team": {
                   "data": {
                       "type": "team",
                       "id": "{TEAM_ID}"
                   }
               }
           }
       }
   }'

Example Response:

HTTP/1.1 201 Created
Content-Type: application/json
{
    "data": {
        "id": "{REPOSITORY_ID}",
        "type": "component",
        "links": {
            "self": "/v2/components/{REPOSITORY_ID}"
        },
        "attributes": {
            "name": "{REPOSITORY_NAME}",
            "team_name": "{TEAM_NAME}"
        },
        "relationships": {
            "versions": {
                "links": {
                    "related": "/v2/components/{REPOSITORY_ID}/versions"
                }
            }
        }
    },
    "meta": {}
}

This resource allows you to create a component repository. A component repository always belongs to a team. If you don’t have any teams yet, please create a team first.

HTTP Request

POST https://api.elastic.io/v2/components

Body Parameters

Parameter Required Description
type yes A value must be component
attributes.name yes Repository name
attributes.icon no Component icon as base64 string
relationships.team.data.id yes Team ID the repository to create for
relationships.team.data.type yes A value must be team

Returns

Returns component’s metadata object if the call succeeded.

Update component access

This resource allows you to changing component’s access level from team to tenant.

Please note, that this action is irreversible i.e. API does not allow to change access back to team.

Example Request:

curl https://api.elastic.io/v2/components/{COMPONENT_ID} \
   -X PATCH \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'
   -H 'Content-Type: application/json' -d '
   {
       "data": {
           "type": "component",
           "attributes": {
               "access": "tenant"
           }
       }
   }'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "data": {
        "id": "{COMPONENT_ID}",
        "type": "component",
        "links": {
            "self": "/v2/components/{COMPONENT_ID}"
        },
        "attributes": {
            "name": "name",
            "team_name": "team_name"
        },
        "relationships": {
            "versions": {
                "links": {
                    "related": "/v2/components/{COMPONENT_ID}/versions"
                }
            }
        }
    },
    "meta": {}
}

HTTP Request

PATCH https://api.elastic.io/v2/components/{COMPONENT_ID}

URL Parameters

Parameter Required Description
COMPONENT_ID Yes Component identifier

Access level

A component may have one of the following access level:

Authorization

This request is authorized for a user with TenantAdmin role only. Contact support team to get this role.

Returns

Returns updated component’s metadata object if the call succeeded.

Delete a component

Example Request:

curl https://api.elastic.io/v2/components/{COMPONENT_ID} \
   -X DELETE \
   -u {EMAIL}:{APIKEY}

Example Response:

HTTP/1.1 204 No Content
Content-Type: application/json

This resource allows you to delete a component. A component may only be delete if it not used in any flow.

HTTP Request

DELETE https://api.elastic.io/v2/components/{COMPONENT_ID}/

URL Parameters

Parameter Required Description
COMPONENT_ID yes Component ID

Authorization

The component must belong to one of the client’s team or organization respectively unless it has TenantAdmin role. Contact support team to get this role.

Returns

200 HTTP response code if the call succeeds, error otherwise.

Retrieve component’s environment variables

Example Request:

curl https://api.elastic.io/v2/components/{COMPONENT_ID}/env \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "data": {
        "attributes": {
            "vars": {
                "MY_ENV_VAR": "env_var_value"
            }
        },
        "id": "{COMPONENT_ID}",
        "type": "component-env",
        "links": {
            "self": "/v2/component-envs/{COMPONENT_ID}"
        }
    },
    "meta": {}
}

This endpoint shows env vars for given component.

HTTP Request

GET https://api.elastic.io/v2/components/{COMPONENT_ID}/env

URL Parameters

Parameter Required Description
COMPONENT_ID yes Component ID

Authorization

The component should be accessible to the client (e.g. component from the own team or shared one) unless it has TenantAdmin role. Contact support team to get this role.

Returns

Returns environment variables

Update component’s environment variables

Example Request:

curl https://api.elastic.io/v2/components/{COMPONENT_ID}/env \
   -X PUT \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
   {
       "data": {
           "type": "component-env",
           "attributes": {
               "vars": {
                   "MY_ENV_VAR": "env_var_value"
               }
           }
       }
   }'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "data": {
        "attributes": {
            "vars": {
                "MY_ENV_VAR": "env_var_value"
            }
        },
        "id": "{COMPONENT_ID}",
        "type": "component-env",
        "links": {
            "self": "/v2/component-envs/{COMPONENT_ID}"
        }
    },
    "meta": {}
}

This endpoint replaces env vars for given component.

HTTP Request

PUT https://api.elastic.io/v2/components/{COMPONENT_ID}/env

URL Parameters

Parameter Required Description
COMPONENT_ID yes Component ID

Body Parameters

Parameter Required Description
type yes A value must be component-env
attributes.vars yes JSON object representing environmental variables mapped to their values.

Authorization

The component should be accessible to the client (e.g. component from the own team or shared one) unless it has TenantAdmin role. Contact support team to get this role.

Returns

Returns environment variables

Resources

Storage: Create a signed url

Example Request:

curl https://api.elastic.io/v2/resources/storage/signed-url \
   -X POST  \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "put_url": "https://steward_host/files/1ksksiaö",
  "get_url": "https://steward_host/files/34rwer34",
  "expires": 18000
}

This endpoint creates a new signed url in Storage

HTTP Request

POST https://api.elastic.io/v2/resources/storage/signed-url

Returns

Returns an HTTP 200 in case of successful url creation

Credentials

Request / Role Tenant Admin Organization Admin Integrator Guest
Retrieve all credentials - X X X
Retrieve a credential by ID X* X X X
Create a credential X X X -
Update a credential X* X X -
Delete a credential X* X X -

*- just only with credentials, which were created by this user

Retrieve all credentials

Example Request:

curl https://api.elastic.io/v2/credentials/?filter[component]={COMPONENT_ID} \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "meta": {},
    "data": [
        {
            "id": "585430d3f02852a8a9fac45e",
            "type": "credential",
            "links": {
                "self": "/v2/credentials/585430d3f02852a8a9fac45e"
            },
            "attributes": {
                "name": "CMS primary",
                "keys": {
                    "oauth": {
                        "key": "secret1"
                    }
                }
            },
            "relationships": {
                "user": {
                    "data": {
                        "id": "585430d3f02852a8a9fac45d",
                        "type": "user"
                    },
                    "links": {
                        "self": "/v2/users/585430d3f02852a8a9fac45d"
                    }
                },
                "component": {
                    "data": {
                        "id": "585430d2f02852a8a9fac456",
                        "type": "component"
                    },
                    "links": {
                        "self": "/v2/components/585430d2f02852a8a9fac456"
                    }
                },
                "organization": {
                    "data": {
                        "id": "59d341e9037f7200184a408b",
                        "type": "organization"
                    },
                    "links": {
                        "self": "/v2/organizations/59d341e9037f7200184a408b"
                    }
                }
            }
        },
        {
            "id": "585430d3f02852a8a9fac45f",
            "type": "credential",
            "links": {
                "self": "/v2/credentials/585430d3f02852a8a9fac45f"
            },
            "attributes": {
                "name": "Refined CRM Manager login",
                "keys": {
                    "oauth": {
                        "key": "secret2"
                    },
                    "allowOption": "enabled"
                }
            },
             "relationships": {
                 "user": {
                     "data": {
                         "id": "585430d3f02852a8a9fac45d",
                         "type": "user"
                     },
                     "links": {
                         "self": "/v2/users/585430d3f02852a8a9fac45d"
                     }
                 },
                 "component": {
                     "data": {
                         "id": "585430d2f02852a8a9fac457",
                         "type": "component"
                     },
                     "links": {
                         "self": "/v2/components/585430d2f02852a8a9fac457"
                     }
                 },
                 "organization": {
                    "data": {
                        "id": "59d341e9037f7200184a408b",
                        "type": "organization"
                    },
                    "links": {
                        "self": "/v2/organizations/59d341e9037f7200184a408b"
                    },
                 "agent": {
                    "data": {
                        "id": "59a410d76b670400182f190e",
                        "type": "agent"
                    },
                    "links": {
                        "self": "/v2/agents/59a410d76b670400182f190e"
                    }
                 }
             }
        }
     }
    ],
    "links": {
        "self": "/v2/credentials"
    }
}

This resource allows you to retrieve all credentials belonging to user’s organization.

HTTP Request

GET https://api.elastic.io/v2/credentials/

Query Parameters

Parameter Required Description
filter[component] No Only credentials belong to the given component id

Returns

Returns a list of credentials if the call succeeded.

Retrieve a credential by ID

Example Request:

curl https://api.elastic.io/v2/credentials/{CREDENTIAL_ID}/ \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": {
        "id": "59f9f2ba112f28001921f274",
        "type": "credential",
        "links": {
            "self": "/v2/credentials/59f9f2ba112f28001921f274"
        },
        "attributes": {
            "name": "SFTP account",
            "keys": {
                "host": "sftp.company.org",
                "username": "lord",
                "password": "teststetr"
            }
        },
        "relationships": {
            "user": {
                "data": {
                    "id": "59f747c33f1d3c001901a44e",
                    "type": "user"
                },
                "links": {
                    "self": "/v2/users/59f747c33f1d3c001901a44e"
                }
            },
            "component": {
                "data": {
                    "id": "56793fb4d8057406000000f7",
                    "type": "component"
                },
                "links": {
                    "self": "/v2/components/56793fb4d8057406000000f7"
                }
            },
            "organization": {
                "data": {
                    "id": "59d341e9037f7200184a408b",
                    "type": "organization"
                },
                "links": {
                    "self": "/v2/organizations/59d341e9037f7200184a408b"
                }
            }
        }
    },
    "meta": {}
}

This resource allows you to retrieve a credential by its identifier.

HTTP Request

GET https://api.elastic.io/v2/credentials/{CREDENTIAL_ID}/

URL Parameters

Parameter Required Description
CREDENTIAL_ID Yes Credential identifier

Returns

Returns a credential object if the call succeeded.

Create a credential

Example Request:

curl https://api.elastic.io/v2/credentials/ \
    -X POST \
    -u {EMAIL}:{APIKEY} \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json' -d '
    {
        "data": {
            "type": "credential",
            "attributes": {
                "name": "Spreadsheet",
                    "keys": {
                        "oauth": {
                            "key": "secret1"
                        }
                }
            },
            "relationships": {
                "component": {
                    "data": {
                        "id": "585430d2f02852a8a9fac456",
                        "type": "component"
                    }
                },
                "agent": {
                    "data": {
                        "id": "59a410d76b670400182f190e",
                        "type": "agent"
                    }
                }
            }
        }
    }'

Example Response:

HTTP/1.1 201 Created
Content-Type: application/json

{
    "data": {
        "id": "5abe11edbec1cf00078b81d1",
        "type": "credential",
        "links": {
            "self": "/v2/credentials/5abe11edbec1cf00078b81d1"
        },
        "attributes": {
            "name": "luzho4ek2",
            "keys": {
                "host": "sftp.company.org",
                "username": "lord",
                "password": "hdhajdha"
            }
        },
        "relationships": {
            "user": {
                "data": {
                    "id": "59d3562c68ed850019bde27f",
                    "type": "user"
                },
                "links": {
                    "self": "/v2/users/59d3562c68ed850019bde27f"
                }
            },
            "component": {
                "data": {
                    "id": "56793fb4d8057406000000f7",
                    "type": "component"
                },
                "links": {
                    "self": "/v2/components/56793fb4d8057406000000f7"
                }
            },
            "organization": {
                "data": {
                    "id": "59d341e9037f7200184a408b",
                    "type": "organization"
                },
                "links": {
                    "self": "/v2/organizations/59d341e9037f7200184a408b"
                }
            },
            "agent": {
                "data": {
                    "id": "5a09deda2d5f49665afb739a",
                    "type": "agent"
                },
                "links": {
                    "self": "/v2/agents/5a09deda2d5f49665afb739a"
                }
            }
        }
    },
    "meta": {}
}

This resource allows you to create a credential.

HTTP Request

POST https://api.elastic.io/v2/credentials/

Body Parameters

Parameter Required Description
type yes A value must be credential
attributes.name no Credential name. An automatic name will be generated if the parameter is omitted
relationships.component.data.id yes The component id this credential is for
relationships.component.data.type yes A value must be component
relationships.agent no The agent relation object
relationships.agent.data.id no The agent id this credential is for
relationships.agent.data.type no A value must be agent
attributes.keys no An object which represents component’s configuration (OAuth keys, etc.)

Returns

Returns credential object if the call succeeded.

Update a credential

Example Request:

curl https://api.elastic.io/v2/credentials/{CREDENTIAL_ID}/ \
   -u {EMAIL}:{APIKEY} \
   -X PATCH \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
    {
        "data": {
            "id": "585430d3f02852a8a9fac45e",
            "type": "credential",
            "attributes": {
                "keys": {
                    "key1": "updated value"  
                }
            },                     
            "relationships": {
               "agent": {
                   "data": {
                       "id": "59a410d76b670400182f190e",
                           "type": "agent"
                       }
                   }
               }
           }
        }'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": {
        "id": "5aaff19dbd6d6400079b4624",
        "type": "credential",
        "links": {
            "self": "/v2/credentials/5aaff19dbd6d6400079b4624"
        },
        "attributes": {
            "name": "luzho4ek777",
            "keys": {
                "host": "sftp.company.org",
                "username": "asssssa",
                "password": "qweqweqw"
            }
        },
        "relationships": {
            "user": {
                "data": {
                    "id": "59d3562c68ed850019bde27f",
                    "type": "user"
                },
                "links": {
                    "self": "/v2/users/59d3562c68ed850019bde27f"
                }
            },
            "component": {
                "data": {
                    "id": "56793fb4d8057406000000f7",
                    "type": "component"
                },
                "links": {
                    "self": "/v2/components/56793fb4d8057406000000f7"
                }
            },
            "organization": {
                "data": {
                    "id": "59d341e9037f7200184a408b",
                    "type": "organization"
                },
                "links": {
                    "self": "/v2/organizations/59d341e9037f7200184a408b"
                }
            },
            "agent": {
                "data": {
                    "id": "5a09deda2d5f49665afb739a",
                    "type": "agent"
                },
                "links": {
                    "self": "/v2/agents/5a09deda2d5f49665afb739a"
                }
            }
        }
    },
    "meta": {}
}

This resource allows you to update a credential.

HTTP Request

PATCH https://api.elastic.io/v2/credentials/{CREDENTIAL_ID}/

URL Parameters

Parameter Required Description
CREDENTIAL_ID yes Credential ID

Body Parameters

Parameter Required Description
id yes A value must be the same as URL parameter CREDENTIAL_ID
type yes A value must be credential
attributes.name no Credential name. Will remain untouched if value omitted.
attributes.keys no An object which represents component’s configuration. Will remain untouched if value omitted. Please note, that keys object is overwritten entirely.
relationships.agent no The agent relation object. Will remain untouched if omitted.
relationships.agent.data.id no The agent id this credential is for.
relationships.agent.data.type no A value must be agent

Returns

Returns a modified credential object if the call succeeded.

Delete a credential

Example Request:

curl https://api.elastic.io/v2/credentials/{CREDENTIAL_ID}/ \
   -X DELETE \
   -u {EMAIL}:{APIKEY}

Example Response:

HTTP/1.1 204 No Content

This resource allows you to delete a credential.

HTTP Request

DELETE https://api.elastic.io/v2/credentials/{CREDENTIAL_ID}/

URL Parameters

Parameter Required Description
CREDENTIAL_ID yes Credential ID

Data samples

Request / Role Tenant Admin Organization Admin Integrator Guest
Retrieve data sample - X X X
Create data sample X X X -
Update data sample - X X -

Retrieve data sample

This resource allows you to retrieve data sample.

Example Request:

 curl https://api.elastic.io/v2/data-samples/{DATASAMPLE_ID} \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:

{
    "data": {
        "id": "{DATASAMPLE_ID}",
        "type": "data-sample",
        "links": {
            "self": "/v2/data-samples/585d389b90ea62ce348a478b"
        },
        "relationships": {
            "component_version": {
                "data": {
                    "id": "latest",
                    "type": "version"
                },
                "links": {
                    "self": "/v2/components/5863f7136ef9da255ad9a9bc/versions/latest"
                }
            },
             "organization": {
                "data": {
                    "id": "59d341e9037f7200184a408b",
                    "type": "organization"
                },
                "links": {
                    "self": "/v2/organizations/59d341e9037f7200184a408b"
                }
            },
            "component": {
                "data": {
                    "id": "5863f7136ef9da255ad9a9bc",
                    "type": "component"
                },
                "links": {
                    "self": "/v2/components/5863f7136ef9da255ad9a9bc"
                }
            },
            "user": {
                "data": {
                    "id": "585d389b90ea62ce348a478b",
                    "type": "user"
                },
                "links": {
                    "self": "/v2/users/${client.id}"
                }
            }
        },
        "attributes": {
            "method": "hello123",
            "result": {
                "foo": "bar1",
                "baz": "qwe1"
            }
        }
    },
    "meta": {}
}

Authorization

A member of an organization can get any sample from own organization.

HTTP Request

GET https://api.elastic.io/v2/data-samples/{DATASAMPLE_ID}

Create data sample

Example Request:

 curl https://api.elastic.io/v2/data-samples \
   -X POST \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
   {
        "data": {
            "type": "data-sample",
            "attributes": {
                "method": "hello123",
                "result": {
                    "foo": "bar",
                    "baz": "foo"
                }
            },
            "relationships": {
                "component": {
                    "data": {
                        "id": "5863f7136ef9da255ad9a9bc",
                        "type": "component"
                    }
                },
                "component_version": {
                    "data": {
                        "id": "latest",
                        "type": "version"
                    }
                }
            }
        }
    }'

Example Response:

{
    "data": {
        "id": "585d389b90ea62ce348a478b",
        "type": "data-sample",
        "links": {
            "self": "/v2/data-samples/585d389b90ea62ce348a478b"
        },
        "relationships": {
            "component_version": {
                "data": {
                    "id": "latest",
                    "type": "version"
                },
                "links": {
                    "self": "/v2/components/5863f7136ef9da255ad9a9bc/versions/latest"
                }
            },
             "organization": {
                "data": {
                    "id": "59d341e9037f7200184a408b",
                    "type": "organization"
                },
                "links": {
                    "self": "/v2/organizations/59d341e9037f7200184a408b"
                }
            },
            "component": {
                "data": {
                    "id": "5863f7136ef9da255ad9a9bc",
                    "type": "component"
                },
                "links": {
                    "self": "/v2/components/5863f7136ef9da255ad9a9bc"
                }
            },
            "user": {
                "data": {
                    "id": "585d389b90ea62ce348a478b",
                    "type": "user"
                },
                "links": {
                    "self": "/v2/users/${client.id}"
                }
            }
        },
        "attributes": {
            "method": "hello123",
            "result": {
                "foo": "bar1",
                "baz": "qwe1"
            }
        }
    },
    "meta": {}
}

HTTP Request

POST https://api.elastic.io/v2/data-samples

Body Parameters

Parameter Required Description
type yes A value must be data-sample
attributes.method yes Component’s action or trigger name.
attributes.result yes Data sample body
relationships.component.data.id yes Component’s id
relationships.component_version.data.id yes Revision of the component’s build. Use latest to retrieve the descriptor of the most recent successful build.

Returns

Returns data sample object if the call succeeded.

Update data sample

Example Request:

 curl https://api.elastic.io/v2/data-samples/{DATASAMPLE_ID} \
   -X PATCH \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
   {
        "data": {
            "type": "data-sample",
            "attributes": {
                "method": "hello123",
                "result": {
                    "foo": "bar",
                    "baz": "foo"
                }
            }
        }
    }'

Example Response:

{
    "data": {
        "id": "585d389b90ea62ce348a478b",
        "type": "data-sample",
        "links": {
            "self": "/v2/data-samples/585d389b90ea62ce348a478b"
        },
        "relationships": {
            "component_version": {
                "data": {
                    "id": "latest",
                    "type": "version"
                },
                "links": {
                    "self": "/v2/components/5863f7136ef9da255ad9a9bc/versions/latest"
                }
            },
             "organization": {
                "data": {
                    "id": "59d341e9037f7200184a408b",
                    "type": "organization"
                },
                "links": {
                    "self": "/v2/organizations/59d341e9037f7200184a408b"
                }
            },
            "component": {
                "data": {
                    "id": "5863f7136ef9da255ad9a9bc",
                    "type": "component"
                },
                "links": {
                    "self": "/v2/components/5863f7136ef9da255ad9a9bc"
                }
            },
            "user": {
                "data": {
                    "id": "585d389b90ea62ce348a478b",
                    "type": "user"
                },
                "links": {
                    "self": "/v2/users/${client.id}"
                }
            }
        },
        "attributes": {
            "method": "hello123",
            "result": {
                "foo": "bar",
                "baz": "foo"
            }
        }
    },
    "meta": {}
}

HTTP Request

PATCH https://api.elastic.io/v2/data-samples/{DATASAMPLE_ID}

Body Parameters

Parameter Required Description
type yes A value must be data-sample
attributes.result no Data sample body

Returns

Returns updated data sample object if the call succeeded.

Flows

Request / Role Tenant Admin Organization Admin Integrator Guest
Retrieve all flows - X X X
Retrieve a flow by ID - X X X
Create a flow - X X -
Update a flow - X X -
Start a flow X X X -
Stop a flow X X X -
Delete a flow - X X -

Retrieve all flows

Example Request (with custom paging):

 curl 'https://api.elastic.io/v2/flows?page[size]=20&page[number]=1' \
   -g -u {EMAIL}:{APIKEY}

Example Request (with filter):

 curl 'https://api.elastic.io/v2/flows?filter[status]=active' \
   -g -u {EMAIL}:{APIKEY}

Example Request (with search):

 curl 'https://api.elastic.io/v2/flows?search=webhook' \
   -g -u {EMAIL}:{APIKEY} 

Example Request (with custom sorting):

 curl 'https://api.elastic.io/v2/flows?sort=-updated_at' \
   -g -u {EMAIL}:{APIKEY}

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": [
     {
    "type": "flow",
    "id": "585918da586224001b96de89",
    "links": {
            "self": "/v2/flows/585918da586224001b96de89"
            },
    "attributes": {
      "name": "Timer to E-Mail Test",
      "status": "inactive",
      "type": "ordinary",
       "created_at": "2018-03-27T15:39:02.825Z",
       "current_status": "inactive",
       "default_mapper_type": "jsonata",
       "description": "",
       "updated_at": "2018-03-27T15:39:02.923Z",
      "graph": {
        "nodes": [
          {
            "id": "step_1",
            "command": "elasticio/timer:timer",
             "name": "",
             "description": "",
            "fields": {
              "interval": "minute"
            }
          },
          {
            "id": "step_2",
            "command": "elasticio/email:send",
             "name": "",
             "description": ""
          }
        ],
        "edges": [
          {
              "id": "mapper:step_1:step_2",
              "config": {
                    "mapper_type": "jsonata",
                    "condition": null,
                    "mapper": {
                         "to": "\"test@example.com\"",
                         "subject": "\"StrongMapper\"",
                         "textBody": "Address.Street"
                          }
                      },
                 "source": "step_1",
                 "target": "step_2"
             }
        ]
      }
    },
    "relationships": {
      "user": {
        "data": {
          "type": "user",
          "id": "560e5a27734d480a00000002"
        },
        "links": {
          "self": "/v2/users/560e5a27734d480a00000002"
        }
      },
      "organization": {
        "data": {
          "type": "organization",
          "id": "573dd76962436c349f000003"
        },
        "links": {
          "self": "/v2/organizations/573dd76962436c349f000003"
        }
           },
        "versions": {
             "links": {
                "related": "/v2/flows/585918da586224001b96de89/versions"
                }
            },
         "latest_version": {
              "data": {
                  "id": "787513ee82625ef46bc10372cb6485a535b54c5f",
                  "type": "flow-version"
                },
            "links": {
                 "self": "/v2/flows/585918da586224001b96de89/versions/787513ee82625ef46bc10372cb6485a535b54c5f",
                 "related": "/v2/flows/585918da586224001b96de89/versions/787513ee82625ef46bc10372cb6485a535b54c5f"
                }
            }
        }
    },
        //...
        ],
        "meta": {
            "page": 1,
            "per_page": 10,
            "total": 2,
            "total_pages": 1
        },
        "links": {
            "self": "/v2/flows"
        }
    }

This resource allows you to retrieve flows.

HTTP Request

GET https://api.elastic.io/v2/flows/

Query Parameters

Parameter Required Description
page[size] no Amount of items per page. Default is 50.
page[number] no Number of page you want to display. Default is 1.
filter[has_draft] no Filter flows only with or without a draft. May be true or false.
filter[status] no Filter by status. May be any of: active, inactive.
filter[type] no Filter by flow type. May be any of: ordinary, long_running.
filter[user] no Filter by user. Must be id of User who created the flow. user could be found in relationships of the flow.
sort no Sort flows list by certain field. May be created_at, updated_at or name. Prefix field name with - for reversed (desc) order e.g. sort=-updated_at. Default sort is by id.
search no Search flows by a word or a phrase contained in a description OR in a name. Behavior is similar to operator LIKE in SQL. Case insensitive. Leading/following spaces are trimmed.

Returns

Returns all flows belonging to the given user. If the user is a member of an organization, all the flows of the organization are returned. If the user is a member in multiple organizations, the given API key is used to match the proper organization.

Retrieve a flow by ID

Example Request:

curl https://api.elastic.io/v2/flows/{FLOW_ID} \
   -u {EMAIL}:{APIKEY}
TDB

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "type": "flow",
    "id": "585918da586224001b96de89",
    "links": {
            "self": "/v2/flows/585918da586224001b96de89"
            },
    "attributes": {
      "name": "Timer to E-Mail Test",
      "status": "inactive",
      "type": "ordinary",
       "created_at": "2018-03-27T15:39:02.825Z",
       "current_status": "inactive",
       "default_mapper_type": "jsonata",
       "description": "",
       "updated_at": "2018-03-27T15:39:02.923Z",
      "graph": {
        "nodes": [
          {
            "id": "step_1",
            "command": "elasticio/timer:timer",
             "name": "",
             "description": "",
            "fields": {
              "interval": "minute"
            }
          },
          {
            "id": "step_2",
            "command": "elasticio/email:send",
             "name": "",
             "description": ""
          }
        ],
        "edges": [
          {
              "id": "mapper:step_1:step_2",
              "config": {
                    "mapper_type": "jsonata",
                    "condition": null,
                    "mapper": {
                         "to": "\"test@example.com\"",
                         "subject": "\"StrongMapper\"",
                         "textBody": "Address.Street"
                          }
                      },
                 "source": "step_1",
                 "target": "step_2"
             }
        ]
      }
    },
    "relationships": {
      "user": {
        "data": {
          "type": "user",
          "id": "560e5a27734d480a00000002"
        },
        "links": {
          "self": "/v2/users/560e5a27734d480a00000002"
        }
      },
      "organization": {
        "data": {
          "type": "organization",
          "id": "573dd76962436c349f000003"
        },
        "links": {
          "self": "/v2/organizations/573dd76962436c349f000003"
        }
           },
        "versions": {
             "links": {
                "related": "/v2/flows/585918da586224001b96de89/versions"
                }
            },
         "latest_version": {
              "data": {
                  "id": "787513ee82625ef46bc10372cb6485a535b54c5f",
                  "type": "flow-version"
                },
            "links": {
                 "self": "/v2/flows/585918da586224001b96de89/versions/787513ee82625ef46bc10372cb6485a535b54c5f",
                 "related": "/v2/flows/585918da586224001b96de89/versions/787513ee82625ef46bc10372cb6485a535b54c5f"
                }
            }
        }
    },
  "meta": {}
}

This resource allows you to retrieve a flow by its identifier. If the flow with given ID does not belong to the current user or to one of his organizations, an error is returned.

HTTP Request

GET https://api.elastic.io/v2/flows/{FLOW_ID}

URL Parameters

Parameter Required Description
FLOW_ID Yes Flow identifier

Returns

The flow with given ID

Create a flow

Example Request:

 curl -X POST https://api.elastic.io/v2/flows \
  -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
     {
    "data": {
        "attributes": {
            "default_mapper_type": "jsonata",
            "type": "ordinary",
            "name": "Timer to E-Mail",
            "description": null,
            "cron": null,
            "graph": {
                "nodes": [
                    {
                        "id": "step_1",
                        "command": "elasticio/timer:timer@latest",
                        "fields": {
                            "interval": "minute"
                        }
                     },
                    {
                        "command": "elasticio/email:send@latest",
                        "fields": {},
                        "id": "step_2"
                                            }
                ],
                "edges": [
                    {
                        "config": {
                            "mapper_type": "jsonata",
                            "mapper": {
                                "to": "info@acme.org",
                                "subject": "Subject",
                                "textBody": "fireTime"
                            }
                           },
                        "source": "step_1",
                        "target": "step_2"
                    }
                ]
            }
        },
        "type": "flow"
    }
}'

Example Response:

HTTP/1.1 201 Created
Content-Type: application/json

{
  "data": {
    "type": "flow",
    "id": "585918da586224001b96de89",
    "links": {
            "self": "/v2/flows/585918da586224001b96de89"
            },
    "attributes": {
      "name": "Timer to E-Mail Test",
      "status": "inactive",
      "type": "ordinary",
       "created_at": "2018-03-27T15:39:02.825Z",
       "current_status": "inactive",
       "default_mapper_type": "jsonata",
       "description": null,
       "updated_at": "2018-03-27T15:39:02.923Z",
      "graph": {
        "nodes": [
          {
            "id": "step_1",
            "command": "elasticio/timer:timer",
             "name": "",
             "description": "",
            "fields": {
              "interval": "minute"
            }
          },
          {
            "id": "step_2",
            "command": "elasticio/email:send",
             "name": "",
             "description": ""
          }
        ],
        "edges": [
          {
            "source": "step_1",
            "target": "step_2",
            "config": {
              "mapper": {
                "to": "info@acme.org",
                "subject": "Test",
                "textBody": "FireTime"
              }
            }
          }
        ]
      }
    },
    "relationships": {
      "user": {
        "data": {
          "type": "user",
          "id": "560e5a27734d480a00000002"
        },
        "links": {
          "self": "/v2/users/560e5a27734d480a00000002"
        }
      },
      "organization": {
        "data": {
          "type": "organization",
          "id": "573dd76962436c349f000003"
        },
        "links": {
          "self": "/v2/organizations/573dd76962436c349f000003"
        }
           },
        "versions": {
             "links": {
                "related": "/v2/flows/585918da586224001b96de89/versions"
                }
            },
         "latest_version": {
              "data": {
                  "id": "787513ee82625ef46bc10372cb6485a535b54c5f",
                  "type": "flow-version"
                },
            "links": {
                 "self": "/v2/flows/585918da586224001b96de89/versions/787513ee82625ef46bc10372cb6485a535b54c5f",
                 "related": "/v2/flows/585918da586224001b96de89/versions/787513ee82625ef46bc10372cb6485a535b54c5f"
                }
            }
        }
    },
  "meta": {}
}

This resource allows you to create a new flow.

HTTP Request

POST https://api.elastic.io/v2/flows/

Body Parameters

Parameter Required Description
type yes A value must be flow
attributes.name yes Flow name
attributes.type yes Flow type. May be any of: ordinary, long_running
attributes.graph yes Flow graph representing component connections

Returns

Returns the created flow

Update a flow

Example request

curl https://api.elastic.io/v2/flows/{FLOW_ID} \
   -X PATCH \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
    {
          "data": {
            "type": "flow",
            "id": "{FLOW_ID}",
            "attributes": {
              "name": "this is a test task"
            }
          }
    }'

Example response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "type": "flow",
    "id": "585918da586224001b96de89",
    "links": {
            "self": "/v2/flows/585918da586224001b96de89"
            },
    "attributes": {
      "name": "Timer to E-Mail Test",
      "status": "inactive",
      "type": "ordinary",
       "created_at": "2018-03-27T15:39:02.825Z",
       "current_status": "inactive",
       "default_mapper_type": "jsonata",
       "description": null,
       "updated_at": "2018-03-27T15:39:02.923Z",
      "graph": {
        "nodes": [
          {
            "id": "step_1",
            "command": "elasticio/timer:timer",
             "name": "",
             "description": "",
            "fields": {
              "interval": "minute"
            }
          },
          {
            "id": "step_2",
            "command": "elasticio/email:send",
             "name": "",
             "description": ""
          }
        ],
        "edges": [
          {
            "source": "step_1",
            "target": "step_2",
            "config": {
              "mapper": {
                "to": "info@acme.org",
                "subject": "Test",
                "textBody": "FireTime"
              }
            }
          }
        ]
      }
    },
    "relationships": {
      "user": {
        "data": {
          "type": "user",
          "id": "560e5a27734d480a00000002"
        },
        "links": {
          "self": "/v2/users/560e5a27734d480a00000002"
        }
      },
      "organization": {
        "data": {
          "type": "organization",
          "id": "573dd76962436c349f000003"
        },
        "links": {
          "self": "/v2/organizations/573dd76962436c349f000003"
        }
           },
        "versions": {
             "links": {
                "related": "/v2/flows/585918da586224001b96de89/versions"
                }
            },
         "latest_version": {
              "data": {
                  "id": "787513ee82625ef46bc10372cb6485a535b54c5f",
                  "type": "flow-version"
                },
            "links": {
                 "self": "/v2/flows/585918da586224001b96de89/versions/787513ee82625ef46bc10372cb6485a535b54c5f",
                 "related": "/v2/flows/585918da586224001b96de89/versions/787513ee82625ef46bc10372cb6485a535b54c5f"
                }
            }
        }
    },
  "meta": {}
}

This resource allows you to update the given flow.

HTTP Request

PATCH https://api.elastic.io/v2/flows/{FLOW_ID}

URL Parameters

Parameter Required Description
FLOW_ID yes Flow ID

Body Parameters

Parameter Required Description
type yes A value must be flow
id yes ID of the flow you want to update
attributes.name no Flow name
attributes.type no Flow type. May be any of: ordinary, long_running
attributes.graph no Flow graph representing component connections
attributes.cron no Cron expression representing flow timing

Returns

Returns the updated flow

Start a flow

Example request

curl https://api.elastic.io/v2/flows/{FLOW_ID}/start \
   -X POST \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json'

Example response

HTTP/1.1 202 Accepted

{
  "data": {},
  "meta": {}
 }

This endpoint starts a flow with given ID.

HTTP Request

POST https://api.elastic.io/v2/flows/{FLOW_ID}/start

URL Parameters

Parameter Required Description
FLOW_ID Yes Flow identifier

Returns

Empty response

Stop a flow

Example request

curl https://api.elastic.io/v2/flows/{FLOW_ID}/stop \
   -X POST \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json'

Example response

HTTP/1.1 202 Accepted

{
  "data": {},
  "meta": {}
 }

This endpoint stops a flow with given ID.

HTTP Request

POST https://api.elastic.io/v2/flows/{FLOW_ID}/stop

URL Parameters

Parameter Required Description
FLOW_ID Yes Flow identifier

Returns

Empty response

Delete a flow

Example Request:

curl https://api.elastic.io/v2/flows/{FLOW_ID} \
   -X DELETE \
   -u {EMAIL}:{APIKEY}

This resource allows you to delete a flow.

HTTP Request

DELETE https://api.elastic.io/v2/flows/{FLOW_ID}

URL Parameters

Parameter Required Description
FLOW_ID yes Flow ID

Example Response:

HTTP/1.1 204 No Content

Flow versions

Request / Role Tenant Admin Organization Admin Integrator Guest
Retrieve all flow versions X X X X
Retrieve flow version by hash X X X X

Retrieve all flow versions

Example Request:

curl https://api.elastic.io/v2/flows/{FLOW_ID}/versions?page[size]=20&page[number]=1 \
   -u {EMAIL}:{APIKEY}

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
   "data": [
      {
        "id": "af65130306caf1c421708a1cfe7edcb56900a6af",
        "type": "flow-version",
        "links": {
            "self": "/v2/flows/5ab0eeabbd6d6400079b4628/versions/af65130306caf1c421708a1cfe7edcb56900a6af"
        },
        "attributes": {
            "name": "Node.js Code to Node.js Code draft 2",
            "description": null,
            "graph": {
                "nodes": [
                    {
                        "id": "step_1",
                        "command": "elasticio/code:executeTrigger@latest",
                        "name": "",
                        "description": "",
                        "fields": {
                            "code": "//Your NodeJS code"
                        }
                      },
                    {
                        "id": "step_2",
                        "command": "elasticio/code:execute@latest",
                        "name": "",
                        "description": "",
                        "fields": {
                            "code": "// Your NodeJS code"
                        }
                    },
                    {
                        "id": "step_3",
                        "command": "elasticio/code:execute@latest",
                        "name": "",
                        "description": "",
                        "fields": {
                            "code": "// Your NodeJS code"
                        }
                    }
                ],
                "edges": [
                    {
                        "id": "step_1:step_2",
                        "source": "step_1",
                        "target": "step_2"
                    },
                    {
                        "id": "step_1:step_3",
                        "source": "step_1",
                        "target": "step_3"
                    }
                ]
            },
            "created_at": "2018-03-20T14:12:54.361Z"
        },
        "relationships": {
            "user": {
                "data": {
                    "id": "59d22e7eeb865b0018adc248",
                    "type": "user"
                },
                "links": {
                    "self": "/v2/users/59d22e7eeb865b0018adc248"
                }
            },
            "flow": {
                "data": {
                    "id": "5ab0eeabbd6d6400079b4628",
                    "type": "flow"
                },
                "links": {
                    "self": "/v2/flows/5ab0eeabbd6d6400079b4628"
                }
            }
        }
    },
      //...
   ],
   "meta": {
      "page": 1,
      "per_page": 50,
      "total": 1,
      "total_pages": 1
   }
}

These versions represent the history of changes of the flow and are sorted chronologically by created_at.

Each version has an id and represents a flow’s state at the given created_at time. It also exposes a relationship to the author of the change.

HTTP Request

GET https://api.elastic.io/v2/flows/{FLOW_ID}/versions

URL Parameters

Parameter Required Description Default
FLOW_ID Yes Flow identifier
page[size] No Amount of items per page 50
page[number] No Number of page you want to display 1

Returns

The list of versions for the specified flow.

Retrieve flow version by hash

Example Request:

curl https://api.elastic.io/v2/flows/{FLOW_ID}/versions/{VERSION_HASH} \
   -u {EMAIL}:{APIKEY}

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": {
        "id": "af65130306caf1c421708a1cfe7edcb56900a6af",
        "type": "flow-version",
        "links": {
            "self": "/v2/flows/5ab0eeabbd6d6400079b4628/versions/af65130306caf1c421708a1cfe7edcb56900a6af"
        },
        "attributes": {
            "name": "Node.js Code to Node.js Code draft 2",
            "description": null,
            "graph": {
                "nodes": [
                    {
                        "id": "step_1",
                        "command": "elasticio/code:executeTrigger@latest",
                        "name": "",
                        "description": "",
                        "fields": {
                            "code": "//Your NodeJS code"
                        }
                      },
                    {
                        "id": "step_2",
                        "command": "elasticio/code:execute@latest",
                        "name": "",
                        "description": "",
                        "fields": {
                            "code": "// Your NodeJS code"
                        }
                    },
                    {
                        "id": "step_3",
                        "command": "elasticio/code:execute@latest",
                        "name": "",
                        "description": "",
                        "fields": {
                            "code": "// Your NodeJS code"
                        }
                    }
                ],
                "edges": [
                    {
                        "id": "step_1:step_2",
                        "source": "step_1",
                        "target": "step_2"
                    },
                    {
                        "id": "step_1:step_3",
                        "source": "step_1",
                        "target": "step_3"
                    }
                ]
            },
            "created_at": "2018-03-20T14:12:54.361Z"
        },
        "relationships": {
            "user": {
                "data": {
                    "id": "59d22e7eeb865b0018adc248",
                    "type": "user"
                },
                "links": {
                    "self": "/v2/users/59d22e7eeb865b0018adc248"
                }
            },
            "flow": {
                "data": {
                    "id": "5ab0eeabbd6d6400079b4628",
                    "type": "flow"
                },
                "links": {
                    "self": "/v2/flows/5ab0eeabbd6d6400079b4628"
                }
            }
        }
    },
    "meta": {}
}

This resource allows to you retrieve specific version of the flow by its version hash.

HTTP Request

GET https://api.elastic.io/v2/flows/{FLOW_ID}/versions/{VERSION_HASH}

URL Parameters

Parameter Required Description
FLOW_ID Yes Flow identifier
VERSION_HASH Yes Version hash

Returns

Specific version of the flow.

Flow drafts

Request / Role Tenant Admin Organization Admin Integrator Guest
Retrieve a flow draft X X X X
Create/update a flow draft X X X X
Delete a flow draft X X X X

Retrieve a flow draft

Example Request:

 curl https://api.elastic.io/v2/flows/{FLOW_ID}/draft \
   -X GET \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": {
        "id": "5abe0cabaa56a1749856226b",
        "type": "flow-draft",
        "links": {
            "self": "/v2/flows/5abbb9d4bc984b000739761a/draft"
        },
        "attributes": {
            "name": "2803ANode.js Code to E-Mail",
            "description": null,
            "cron": null,
            "graph": {
                "nodes": [
                    {
                        "id": "step_1",
                        "command": "elasticio/timer:timer@latest",
                        "name": "",
                        "description": "",
                        "agent_id": "5a09deda2d5f49665afb739a",
                        "fields": {
                            "interval": "minute"
                        }
                    },
                    {
                        "id": "step_2",
                        "command": "elasticio/email:send@latest",
                        "name": "",
                        "description": "",
                        "agent_id": "5a09deda2d5f49665afb739a"
                        },
                    {
                        "id": "step_3",
                        "command": "elasticio/code:execute@latest",
                        "name": "",
                        "description": "",
                        "agent_id": "5a09deda2d5f49665afb739a",
                        "fields": {
                            "code": "//Your NodeJS code"
                        }
                    }
                ],
                "edges": [
                    {
                        "id": "step_1:step_3",
                        "source": "step_1",
                        "target": "step_3"
                    },
                    {
                        "id": "mapper:step_3:step_2",
                        "config": {
                            "mapper_type": "jsonata",
                            "condition": null,
                            "mapper": {
                                "textBody": "message",
                                "subject": "\"2803_SW)RT\"",
                                "to": "\"test@example.com\""
                            }
                        },
                        "source": "step_3",
                        "target": "step_2"
                    }
                ]
            },
            "created_at": "2018-03-30T10:08:43.582Z",
            "updated_at": "2018-03-30T10:08:43.582Z"
        },
        "relationships": {
            "user": {
                "data": {
                    "id": "59d3562c68ed850019bde27f",
                    "type": "user"
                },
                "links": {
                    "self": "/v2/users/59d3562c68ed850019bde27f"
                }
            },
            "flow": {
                "data": {
                    "id": "5abbb9d4bc984b000739761a",
                    "type": "flow"
                },
                "links": {
                    "self": "/v2/flows/5abbb9d4bc984b000739761a"
                }
            }
        }
    },
    "meta": {}
}

This resource allows you to get a flow draft.

HTTP Request

GET https://api.elastic.io/v2/flows/{FLOW_ID}/draft

URL Parameters

Parameter Required Description
FLOW_ID yes Flow ID

Returns

Returns a flow draft

Create/update a flow draft

Example Request:

 curl https://api.elastic.io/v2/flows/{FLOW_ID}/draft \
   -X PUT \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
    {
      "data": {
        "type": "flow-draft",
        "attributes": {
          "name": "Timer to E-Mail",
          "description": "Some real description",
          "graph": {
            "nodes": [
              {
                "id": "step_1",
                "command": "elasticio/timer:timer",
                "fields": {
                  "interval": "minute"
                }
              },
              {
                "id": "step_2",
                "command": "elasticio/email:send"
              }
            ],
            "edges": [
              {
                "source": "step_1",
                "target": "step_2",
                "config": {
                  "mapper": {
                    "to": "info@acme.org",
                    "subject": "Test",
                    "textBody": "{{fireTime}}"
                  }
                }
              }
            ]
          }
        }
      }
    }'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": {
        "id": "5abe0cabaa56a1749856226b",
        "type": "flow-draft",
        "links": {
            "self": "/v2/flows/5abbb9d4bc984b000739761a/draft"
        },
        "attributes": {
            "name": "2803ANode.js Code to E-Mail",
            "description": null,
            "cron": null,
            "graph": {
                "nodes": [
                    {
                        "id": "step_1",
                        "command": "elasticio/timer:timer@latest",
                        "name": "",
                        "description": "",
                        "agent_id": "5a09deda2d5f49665afb739a",
                        "fields": {
                            "interval": "minute"
                        }
                    },
                    {
                        "id": "step_2",
                        "command": "elasticio/email:send@latest",
                        "name": "",
                        "description": "",
                        "agent_id": "5a09deda2d5f49665afb739a"
                        },
                    {
                        "id": "step_3",
                        "command": "elasticio/code:execute@latest",
                        "name": "",
                        "description": "",
                        "agent_id": "5a09deda2d5f49665afb739a",
                        "fields": {
                            "code": "//Your NodeJS code"
                        }
                    }
                ],
                "edges": [
                    {
                        "id": "step_1:step_3",
                        "source": "step_1",
                        "target": "step_3"
                    },
                    {
                        "id": "mapper:step_3:step_2",
                        "config": {
                            "mapper_type": "jsonata",
                            "condition": null,
                            "mapper": {
                                "textBody": "message",
                                "subject": "\"2803_SW)RT\"",
                                "to": "\"test@example.com\""
                            }
                        },
                        "source": "step_3",
                        "target": "step_2"
                    }
                ]
            },
            "created_at": "2018-03-30T10:08:43.582Z",
            "updated_at": "2018-03-30T10:08:43.582Z"
        },
        "relationships": {
            "user": {
                "data": {
                    "id": "59d3562c68ed850019bde27f",
                    "type": "user"
                },
                "links": {
                    "self": "/v2/users/59d3562c68ed850019bde27f"
                }
            },
            "flow": {
                "data": {
                    "id": "5abbb9d4bc984b000739761a",
                    "type": "flow"
                },
                "links": {
                    "self": "/v2/flows/5abbb9d4bc984b000739761a"
                }
            }
        }
    },
    "meta": {}
}

This resource allows you to create/update a flow draft.

HTTP Request

PUT https://api.elastic.io/v2/flows/{FLOW_ID}/draft

URL Parameters

Parameter Required Description
FLOW_ID yes Flow ID

Body Parameters

Parameter Required Description
type yes A value must be flow-draft
attributes.name no Flow name
attributes.description no Flow description
attributes.graph no Flow graph representing component connections
attributes.cron no Cron expression

Returns

Returns the created/updated flow draft

Delete a flow draft

Example Request:

curl https://api.elastic.io/v2/flows/{FLOW_ID}/draft \
   -X DELETE \
   -u {EMAIL}:{APIKEY}

This resource allows you to delete a flow draft.

HTTP Request

DELETE https://api.elastic.io/v2/flows/{FLOW_ID}/draft

URL Parameters

Parameter Required Description
FLOW_ID yes Flow ID

Example Response:

HTTP/1.1 204 No Content

Lookup tables (Deprecated)

Retrieve all lookup tables

This resource allows you to retrieve all lookup tables.

Example Request:

 curl https://api.elastic.io/v2/lookups \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:


{
    "data": [
        {
            "type": "lookup",
            "id": "5863f65ecc753f2441c88e68",
            "attributes": {
                "title": "lookup title",
                "data": {
                "key": "value"
                }
            },
            "relationships": {
                "user": {
                    "data": {
                        "type": "user",
                        "id": "585d389b90ea62ce348a478b"
                    },
                    "links": {
                        "self": "/v2/users/585d389b90ea62ce348a478b"
                    }
                },
                "organization": {
                    "data": {
                        "type": "organization",
                        "id": "58400dc7c9ab5757f8ef1f81"
                    },
                    "links": {
                        "self": "/v2/organizations/58400dc7c9ab5757f8ef1f81"
                    }
                }
            }
        }
    ],
    "meta": {}
}

HTTP Request

GET https://api.elastic.io/v2/lookups

Create a lookup table

Example Request:

 curl https://api.elastic.io/v2/lookups \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
   {
      "data": {
          "type": "lookup",
          "attributes": {
              "title": "lookup example",
              "data": {
                  "key": "value"
              }
          }
      }
   }'

Example Response:

{
    "data": {
        "type": "lookup",
        "id": "5863f7136ef9da255ad9a9bc",
        "attributes": {
            "title": "mylookuptitle",
            "data": {
                "key": "value"
            }
        },
        "relationships": {
            "user": {
                "data": {
                    "type": "user",
                    "id": "585d389b90ea62ce348a478b"
                },
                "links": {
                    "self": "/v2/users/585d389b90ea62ce348a478b"
                }
            },
            "organization": {
                "data": {
                    "type": "organization",
                    "id": "58400dc7c9ab5757f8ef1f81"
                },
                "links": {
                    "self": "/v2/organizations/58400dc7c9ab5757f8ef1f81"
                }
            }
        }
    },
    "meta": {}
}

HTTP Request

POST https://api.elastic.io/v2/lookups

Body Parameters

Parameter Required Description
type yes A value must be lookup
attributes.title yes Lookup table title.
attributes.data yes A JSON object representing a lookup table

Update a lookup table

Example Request:

 curl https://api.elastic.io/v2/lookups/{LOOKUP_ID} \
   -X PUT \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
   {
      "data": {
          "type": "lookup",
          "id": "{LookupId}",
          "attributes": {
              "title": "new lookup title",
              "data": {
                  "key": "value"
              }
          }
      }
   }'

This resource allows you to update a lookup table.

HTTP Request

PUT https://api.elastic.io/v2/lookups

URL Parameters

Parameter Required Description
LOOKUP_ID yes Lookup table ID

Body Parameters

Parameter Required Description
type yes A value must be lookup
attributes.title yes Lookup table title.
attributes.data yes A JSON object representing a lookup table

Delete a lookup table

Example Request:

curl https://api.elastic.io/v2/organizations/{LOOKUP_ID} \
   -X DELETE \
   -u {EMAIL}:{APIKEY}

This resource allows you to delete a lookup table.

HTTP Request

DELETE https://api.elastic.io/v2/lookups/{LOOKUP_ID}

URL Parameters

Parameter Required Description
LOOKUP_ID yes Lookup table ID

Example Response:

HTTP/1.1 204 No Content

Organizations

Request / Role Tenant Admin Organization Admin Integrator Guest
Create an organization X - - -
Get organization X X X X
Get a list of members of Organization - X X X
Get a list of pending members (invites) of Organization - X X X
Invite a user to organization - X - -
Add a new member to organization X - - -
Update membership in Organization - X - -
Remove member from organization - X - -

Create an organization

Example Request:

 curl https://api.elastic.io/v2/organizations \
   -X POST \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
       {
           "data": {         
               "type": "organization",
               "attributes": {
                   "name": "My Org"
               }
           }
       }'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{ 
  "data":
    { 
      "id": "58455777a0aec4f377faefc1",
      "type": "organization",
      "links": {
            "self": "/v2/organizations/58455777a0aec4f377faefc1"
       },
      "attributes": { 
        "name": "My Org"
      } 
   },
  "meta": {} 
}

This endpoint allows to create an organization.

HTTP Request

POST https://api.elastic.io/v2/organizations

Authorization

This request is authorized to only a user with TenantAdmin role. Contact support team to get this role.

Parameter Required Description
type yes A value should be “organization”
attributes.name yes Name of the organization

Returns

Returns Organization object if the call succeeded

Get organization

Example Request:

 curl https://api.elastic.io/v2/organizations/{ORGANIZATION_ID}?include=members,invites \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "meta": {},
    "data": {
        "id": "58400dc7c9ab5757f8ef1f81",
        "type": "organization",
        "attributes": {
            "name": "horns&hoofs"
        },
        "relationships": {
            "members": {
                "data": [
                    {
                        "type": "member",
                        "id": "588f832b87d7c27c7d5cc37b"
                    },
                    {
                        "type": "member",
                        "id": "588f832b87d7c27c7d5cc37a"
                    }
                ],
                "links": {
                    "self": "/v2/organizations/58400dc7c9ab5757f8ef1f81/members"
                }
            },
            "invites": {
                "data": [
                    {
                        "type": "organization-invite",
                        "id": "588f832b87d7c27c7d5cc37e"
                    },
                    {
                        "type": "organization-invite",
                        "id": "588f832b87d7c27c7d5cc37f"
                    }
                ],
                "links": {
                    "self": "/v2/organizations/58400dc7c9ab5757f8ef1f81/members/pending"
                }
            }
        }
    },
    "included": [
        {
            "type": "member",
            "id": "588f832b87d7c27c7d5cc37a",
            "attributes": {
                "first_name": "Santos",
                "last_name": "Mitchell",
                "email": "Katelynn_Fritsch@gmail.com",
                "role": "admin"
            }
        },
        {
            "type": "member",
            "id": "588f832b87d7c27c7d5cc37b",
            "attributes": {
                "first_name": "Kacie",
                "last_name": "Howe",
                "email": "Rusty_Goodwin@hotmail.com",
                "role": "integrator"
            }
        },
        {
            "type": "organization-invite",
            "id": "588f832b87d7c27c7d5cc37e",
            "attributes": {
                "email": "invited-1@example.org",
                "role": "guest"
            }
        },
        {
            "type": "organization-invite",
            "id": "588f832b87d7c27c7d5cc37f",
            "attributes": {
                "email": "invited-2@example.org",
                "role": "integrator"
            }
        }
    ]
}

This endpoints returns an Organization object for certain organization id.

HTTP Request

GET https://api.elastic.io/v2/organizations/ORGANIZATION_ID/

Authorization

Client has to be a member of the organization or to have TenantAdmin role (contact support team to get this role).

URL Parameters

Parameter Description
ORGANIZATION_ID The ID of the organization

URL Query Parameters

Parameter Required Description
include no Whether include or not full resource objects in response for related entities. Possible values: members and/or invites.

Get a list of members of Organization

Example Request:

 curl https://api.elastic.io/v2/organizations/{ORGANIZATION_ID}/members/ \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "meta": {},
    "data": [
        {
            "type": "member",
            "id": "588f832b87d7c27c7d5cc37a",
            "links": {
                "self": "/v2/members/588f832b87d7c27c7d5cc37a"
            },
            "attributes": {
                "first_name": "Santos",
                "last_name": "Mitchell",
                "email": "Katelynn_Fritsch@gmail.com",
                "role": "admin"
            }
        },
        {
            "type": "member",
            "id": "588f832b87d7c27c7d5cc37b",
            "links": {
                "self": "/v2/members/588f832b87d7c27c7d5cc37b"
            },
            "attributes": {
                "first_name": "Kacie",
                "last_name": "Howe",
                "email": "Rusty_Goodwin@hotmail.com",
                "role": "integrator"
            }
        }
    ],
    "links": {
        "self": "/v2/organizations/{ORGANIZATION_ID}/members"
    }
}

This endpoints returns a list of all members of certain Organization.

HTTP Request

GET https://api.elastic.io/v2/organizations/ORGANIZATION_ID/members/

Authorization

Client has to be a member of the organization.

URL Parameters

Parameter Description
ORGANIZATION_ID The ID of the organization

Get a list of pending members (invites) of Organization

Example Request:

 curl https://api.elastic.io/v2/organizations/{ORGANIZATION_ID}/invites/ \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "data": [
        {
            "id": "5aafd335bd6d6400079b4617",
            "type": "organization-invite",
            "links": {
                "self": "/v2/organizations/59d22e7eeb865b0018adc247/invite/5aafd335bd6d6400079b4617"
            },
            "attributes": {
                "email": "invited-1@example.org",
                "role": "integrator"
            }
        },
        {
            "id": "5aafda89bd6d6400079b4618",
            "type": "organization-invite",
            "links": {
                "self": "/v2/organizations/59d22e7eeb865b0018adc247/invite/5aafda89bd6d6400079b4618"
            },
            "attributes": {
                "email": "invited-2@example.org",
                "role": "guest"
            }
        }
    ],
    "meta": {}
}

This endpoints returns a list of pending members (invites) for certain Organization.

HTTP Request

GET https://api.elastic.io/v2/organizations/ORGANIZATION_ID/invites/

Authorization

Client has to be a member of the organization.

URL Parameters

Parameter Description
ORGANIZATION_ID The ID of the organization

Invite a user to organization

Example Request:

curl https://api.elastic.io/v2/organizations/{ORGANIZATION_ID}/invites/ \
    -X POST \
    -u {EMAIL}:{APIKEY} \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json' -d '
    {
       "data": {
           "type": "invite",
           "attributes": {
               "email": "user-to-invite@my-company.com",
               "role": "admin"
           }
       }
    }'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{
   "data": {
       "id": "5abceeb7bc984b00073976f6",
       "type": "organization-invite",
       "links": {
            "self": "/v2/organizations/59d22e7eeb865b0018adc247/invite/5abceeb7bc984b00073976f6"
        },
       "attributes": {
           "email": "user-to-invite@my-company.com",
           "role": "admin"
       }
   },
   "meta": {}
}

This endpoint allows to invite a user to organization.

HTTP Request

POST https://api.elastic.io/v2/organizations/{ORGANIZATION_ID}/invites/

Authorization

This request is authorized for organization members with role Admin.

URL Parameters

Parameter Description
ORGANIZATION_ID The ID of the organization

Payload Parameters

Parameter Required Description
type yes A value should be “invite”.
attributes.email yes Email.
attributes.role yes Available roles are: admin, integrator and guest.

Returns

Returns invite object if the call succeeded

Add a new member to organization

Example Request:

curl https://api.elastic.io/v2/organizations/{ORGANIZATION_ID}/members/ \
    -X POST \
    -u {EMAIL}:{APIKEY} \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json' -d '
    {
       "data": {
           "type": "member",
           "id": "{USER_ID}",
           "attributes": {
               "role": "{ROLE}"
           }
       }
    }'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{
   "data": {
        "type": "member",
        "id": "588f832b87d7c27c7d5cc37a",
        "attributes": {
            "first_name": "Santos",
            "last_name": "Mitchell",
            "email": "Santos_Mitchell@example.com",
            "role": "admin"
        }
   }
}

This endpoint allows adding a user to a certain organization as a member. No invitation email will be sent. The user becomes a member immediately.

HTTP Request

POST https://api.elastic.io/v2/organizations/{ORGANIZATION_ID}/members

Authorization

This request is authorized for a user with TenantAdmin role only. Contact support team to get this role.

Payload Parameters

Parameter Required Description
id yes id of an already registered user, who will be added as a member of the organization
type yes A value should be “member”.
attributes.role yes Available roles are: admin, integrator and guest.

Returns

Returns member object if the call succeeded

Update membership in Organization

Example Request:

curl https://api.elastic.io/v2/organizations/{ORGANIZATION_ID}/members/{USER_ID}/ \
    -X PATCH  \
    -u {EMAIL}:{APIKEY} \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json' -d '
    {
       "data": {
           "type": "member",
           "id": "{USER_ID}",
           "attributes": {
               "role": "{NEW_ROLE}"
           }
       }
    }'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "data": {
        "id": "59f747c33f1d3c001901a44e",
        "type": "member",
        "links": {
            "self": "/v2/members/59f747c33f1d3c001901a44e"
        },
        "attributes": {
            "role": "integrator"
        }
    },
    "meta": {}
}

This endpoint allows updating a membership of a given user. Only role attribute can be updated.

HTTP Request

PATCH https://api.elastic.io/v2/organizations/{ORGANIZATION_ID}/members/{USER_ID}/

Authorization

This request is authorized for organization members with role Admin.

URL Parameters

Parameter Description
ORGANIZATION_ID The ID of the organization
USER_ID The ID of the user to be updated

Payload Parameters

Parameter Required Description
type yes A value should be “member”.
id yes id of an already registered user, must match URL param {USER_ID}
attributes.role yes Available roles are: admin, integrator and guest.

Returns

Returns member object if the call succeeded

Remove member from organization

Example Request:

 curl https://api.elastic.io/v2/organizations/{ORGANIZATION_ID}/members/{USER_ID}/ \
    -X DELETE    \
    -u {EMAIL}:{APIKEY}

Example Response:

HTTP/1.1 204 No Content

Remove a membership of the User in the Organization. Ownership of those user’s associated data will be transferred to admin User performing this operation: * flows * credentials * lookups * developers teams membership

HTTP Request

DELETE https://api.elastic.io/v2/organizations/{ORGANIZATION_ID}/members/{USER_ID}/

Authorization

This request is authorized for organization members with role Admin.

URL Parameters

Parameter Description
ORGANIZATION_ID The ID of the organization
USER_ID The ID of the user, which should leave the organization

Returns

Responds with 204 No content if the call succeeded (with empty body).

Scheduled Executions

Preamble

What are scheduled executions?

In order to set up usage of some component in a certain node in certain Flow, some available configuration options could not be described in advance, because they depend on the context in each case.

Let’s consider an example when we have a component with a module, which allows retrieving a list of goods from some e-commerce platform. In this case, we have few configuration parameters, which should be configured in order to use a component in some flow, but all available options are different for different e-commerce installations.

The first such “dynamic” parameter is a category of a good. Each installation has its own set of goods categories.

Goods in different categories have different attributes set, so the structure of data in messages (metadata), produced by the module is dependent on selected category. So metadata also should be retrieved for each case.

And finally, each client uses own credential in order to connect connector with the e-commerce platform installation. Credential parameters have to be verified somehow before usage (at least in order to avoid confusing bugs while using component).

In order to solve each of three problems above, there are so-called scheduled executions, which allow running special methods of a component.These methods are:

Each of the methods is executed in the same environment as a module of a component while executing of flows.

Scheduled execution workflow

A component execution is an asynchronous operation. Upon an client request an execution is scheduled and needs to wait for the next available worker. Once a worker is available the component is executed and the results are sent back to the client. Because the results of an execution cannot be created and returned immediately the client needs to wait and poll for the results.

For more details about asynchronous REST please read RESTful CookBook and A day in the life of - Asynchronous operations in REST.

The following diagram displays the process of component scheduling:

  1. A method execution is scheduled by sending a request corresponding endpoint (see below). The API responds with 202 Accepted. The resource in the Location HTTP header is the URL to poll for execution results.
  2. The execution result is polled periodically by sending requests to the polling resourceexec/poll/{EXECUTION_ID}. The API responds with 200 OK if the result is not available yet. Please see how to poll execution results.
  3. Once the result is available the polling resource responds with 303 See Other. The resource in the Location HTTP header is the URL to get the results of the execution. Please see how to poll execution results.
  4. The results are retrieved from exec/result/{EXECUTION_ID}. Please see how to retrieve execution results.

Scheduled Executions

Request / Role Tenant Admin Organization Admin Integrator Guest
Verify credentials - X X X
Retrieve component’s metamodel - X X X
Retrieve component’s select model - X X X
Poll a result of an execution X X X X
Retrieve execution result X X X X

Verify credentials

Example Request:

 curl https://api.elastic.io/v2/components/{COMPONENT_ID}/versions/{GIT_REVISION}/verify-credential \
 -u {EMAIL}:{APIKEY} \ 
 -X POST -H 'Content-Type: application/json' -d '
 {
     "data": {
         "type": "verify-credential",
         "attributes": {
             "fields": {
                 "apiKey" : "secret"
             }
         }
     }
 }'

Example Response:

HTTP/1.1 202 Accepted
Content-Type: application/json; charset=utf-8
Location: 'https://api.elastic.io/v2/exec/poll/58becb8259a65f18c5c60eb0'

{
    "data": {
        "id": "5aaf90a2d0516d00077556cf",
        "type": "execution-result",
        "links": {
            "self": "/v2/exec/result/5aaf90a2d0516d00077556cf"
        },
        "attributes": {
            "result": {},
            "status": "Pending request, waiting other process"
        }
    },
    "meta": {}
}

This resource allows you to verify credentials. The verification credential is an asynchronous process because it is accomplished by sending a request to an external API. The entire process is described here. This page describes how to perform the 1st step of this process. Please also read details on polling execution results and retrieving execution results.

HTTP Request

POST https://api.elastic.io/v2/components/{COMPONENT_ID}/versions/{GIT_REVISION}/verify-credential

Authorization

The component should be accessible to the client.

URL Parameters

Parameter Required Description
COMPONENT_ID Yes Name of a component’s module.
GIT_REVISION Yes Revision of the component’s build. For available versions see here. For latest version use latest.

Body Parameters

Parameter Required Description
type Yes A value must be verify-credential.
attributes.fields Yes An object which represents the configuration of credential. The semantics are same as in creating a credential.
relationships.agent.data.id No ID of the agent
relationships.agent.data.type No In case, agent specified, this must be agent

Retrieve component’s metamodel

Example Request:

curl https://api.elastic.io/v2/components/{COMPONENT_ID}/versions/{GIT_REVISION}/dynamic-metadata \
 -u {EMAIL}:{APIKEY} \
 -X POST -H 'Content-Type: application/json' -d '
 {
    "data": {
        "type": "dynamic-metadata",
        "attributes": {
            "module": "{MODULE}",
            "fields": {
                "some_field" : "value",
                "another_field" : "another_value"
            }
        },
        "relationships": {
            "credential": {
                "data": {
                    "id": "{CREDENTIAL_ID}",
                    "type": "credential"
                }
            }
        }
    }
 }'

Example Response:

HTTP/1.1 202 Accepted
Content-Type: application/json; charset=utf-8
Location: 'https://api.elastic.io/v2/exec/poll/58becb8359a65f18c5c60ec4'

{
    "data": {
        "id": "5aaf9d5bd0516d000775621c",
        "type": "execution-result",
        "links": {
            "self": "/v2/exec/result/5aaf9d5bd0516d000775621c"
        },
        "attributes": {
            "result": {},
            "status": "Pending request, waiting other process"
        }
    },
    "meta": {}
}

This resource allows you to retrieve component’s metamodel. The retrieval of metamodel is an asynchronous process because it is accomplished by sending a request to an external API. The entire process is described here. This page describes how to perform the 1st step of this process. Please also read details on polling execution results and retrieving execution results.

HTTP Request

POST https://api.elastic.io/v2/components/{COMPONENT_ID}/versions/{GIT_REVISION}/dynamic-metadata

Authorization

The component should be accessible to the client.

URL Parameters

Parameter Required Description
COMPONENT_ID Yes Name of a component’s module.
GIT_REVISION Yes Revision of the component’s build. For available versions see here. For latest version use latest.

Body Parameters

Parameter Required Description
type Yes A value must be dynamic-metadata.
attributes.module Yes Name of the component’s module as defined in component.json.
attributes.fields Yes Contains values for component’s fields. Semantics are same as defining fields for a node in a flow graph.
relationships.credential.data.id No If credentials are specified in the component’s descriptor, create a credential first and use its id.
relationships.credential.data.type No If credentials are specified in the component’s descriptor, value credential must be used here.
relationships.agent.data.id No ID of the agent
relationships.agent.data.type No In case, agent specified, this must be agent

Retrieve component’s select model

Example Request:

 curl https://api.elastic.io/v2/components/{COMPONENT_ID}/versions/{GIT_HASH}/select-model\
 -u {EMAIL}:{APIKEY} \ 
 -X POST -H 'Content-Type: application/json' -d '
 {
    "data": {
        "type": "select-model",
        "attributes": {
            "module": "{MODULE}",
            "method": "{METHOD}",
            "fields": {
                "some_field" : "value",
                "another_field" : "another_value"
            }
        },
        "relationships": {
            "credential": {
                "data": {
                    "id": "{CREDENTIAL_ID}",
                    "type": "credential"
                }
            }
        }
    }
 }'

Example Response:

HTTP/1.1 202 Accepted
Content-Type: application/json; charset=utf-8
Location: 'https://api.elastic.io/v2/exec/poll/58becb8059a65f18c5c60e41'

{
    "data": {
        "id": "5aafb9e1d0516d0007757b71",
        "type": "execution-result",
        "links": {
            "self": "/v2/exec/result/5aafb9e1d0516d0007757b71"
        },
        "attributes": {
            "result": {},
            "status": "Pending request, waiting other process"
        }
    },
    "meta": {}
}

This resource allows you to retrieve component’s select model. The retrieval of select model is an asynchronous process because it is accomplished by sending a request to an external API. The entire process is described here. This page describes how to perform the 1st step of this process. Please also read details on polling execution results and retrieving execution results.

HTTP Request

POST https://api.elastic.io/v2/components/{COMPONENT_ID}/versions/{GIT_HASH}/select-model

Authorization

The component should be accessible to the client.

URL Parameters

Parameter Required Description
COMPONENT_ID yes Name of a component’s module.
GIT_REVISION Yes Revision of the component’s build. For available versions see here. For latest version use latest.

Body Parameters

Parameter Required Description
type Yes A value must be select-model
attributes.module Yes Name of the component’s module as defined in component.json.
attributes.method Yes Name of the method, which returns select model data.
attributes.fields Yes Contains values for component’s fields. Semantics are same as defining fields for a node in a flow graph.
relationships.credential.data.id No If credentials are specified in the component’s descriptor, create a credential first and use its id.
relationships.credential.data.type No If credentials are specified in the component’s descriptor, value credential must be used here.
relationships.agent.data.id No ID of the agent
relationships.agent.data.type No In case, agent specified, this must be agent

Poll a result of an execution

Example Request:

curl https://api.elastic.io/v2/exec/poll/{EXECUTION_ID} \
 -u {EMAIL}:{APIKEY}

Response “In progress”:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": {
        "type": "execution-result",
        "id": "58becb8059a65f18c5c60e41",
        "attributes": {
            "result": {},
            "status": "Pending request, waiting other process"
        },
        "links": {
            "self": "/v2/exec/result/58becb8059a65f18c5c60e41"
        }
    },
    "meta": {}
}

Response “Result ready”:

HTTP/1.1 303 See Other
Content-Type: application/json
Location: /v2/exec/result/58becb8059a65f18c5c60e41

{
    "data": {},
    "meta": {}
}

This resource allows you to poll a result of an execution. Once the execution is done, the endpoint responds with HTTP 303 and provides a resource for querying the result in the Location header.

HTTP Request

GET https://api.elastic.io/v2/exec/poll/{EXECUTION_ID}

URL Parameters

Parameter Required Description
EXECUTION_ID yes Execution identifier.

Response status codes

Status Code Header Description
200 - The execution is still in progress.
303 Location The execution is finished and the result is ready. Resource to get the result is found in the Location header.
500 - Internal server error
404 - The execution does not exist (e.g. an attempt to poll for a non scheduled execution was made)

Retrieve execution result

Example Request:

curl https://api.elastic.io/v2/exec/result/{EXECUTION_ID}  \
 -u {EMAIL}:{APIKEY}

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": {
        "id": "5aafcd56d0516d0007758cff",
        "type": "execution-result",
        "links": {
            "self": "/v2/exec/result/5aafcd56d0516d0007758cff"
        },
        "attributes": {
            "result": {
                "data": {
                    "some_field_of_result": "value",
                    "another_field": "another_value"
                }
            }
        }
    },
    "meta": {}
}

HTTP Request

GET https://api.elastic.io/v2/exec/result/{EXECUTION_ID}

URL Parameters

Parameter Required Description
EXECUTION_ID yes Execution identifier.

Response status codes

Status Code Description
200 The execution result is ready.
409 The execution result is not ready yet.

Returns

This endpoint returns a result of the execution. When execution is in progress and result is not ready yet, HTTP status code 409 is returned.

SSH keys

Request / Role Tenant Admin Organization Admin Integrator Guest
Retrieve all SSH keys X* X X* X*
Create a new SSH key X* X X* X*
Delete a SSH key X* X X* X*

*- only for ssh-keys, which belong to this user

Retrieve all SSH keys

Example Request:

curl https://api.elastic.io/v2/sshkeys/ \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": [
        {
            "id": "5a4f59dbcbe7940019697ec5",
            "type": "sshkey",
            "links": {
                "self": "/v2/sshkeys/5a4f59dbcbe7940019697ec5"
            },
            "attributes": {
                "key": "ssh-key",
                "title": "test@example-UX430UQ",
                "fingerprint": "fd:d4:98:92:ed:d7:3a:0c:a2:42:ff:78:57:15:88:fa"
            },
            "relationships": {
                "user": {
                    "data": {
                        "id": "59d22e7eeb865b0018adc248",
                        "type": "user"
                    },
                    "links": {
                        "self": "/v2/users/59d22e7eeb865b0018adc248"
                    }
                }
            }
        }
    ],
    "meta": {},
    "links": {
        "self": "/v2/sshkeys"
    }
}

This resource allows you to retrieve all SSH keys of the current user.

HTTP Request

GET https://api.elastic.io/v2/sshkeys/

Returns

Returns an ssh key’s metadata object if the call succeeded.

Create a new SSH key

Example Request:

curl https://api.elastic.io/v2/sshkeys/ \
    -X POST \
    -u {EMAIL}:{APIKEY} \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json' -d '
    {
"data": {
        "type": "sshkey",
        "attributes": {
            "key": "ssh-rsa YOUR KEY GOES HERE",
           "title": "My New Key"
         }
    }
}'

Example Response:

HTTP/1.1 201 Created
Content-Type: application/json

{
    "data": {
        "id": "5aabedf5bd6d6400079b45f1",
        "type": "sshkey",
        "links": {
            "self": "/v2/sshkeys/5aabedf5bd6d6400079b45f1"
        },
        "attributes": {
            "key": "ssh-key",
            "title": "1603testAndDelMe",
            "fingerprint": "3a:2b:8e:7c:dc:82:3e:de:54:f4:58:8a:7d:55:fb:15"
        },
        "relationships": {
            "user": {
                "data": {
                    "id": "59d22e7eeb865b0018adc248",
                    "type": "user"
                },
                "links": {
                    "self": "/v2/users/59d22e7eeb865b0018adc248"
                }
            }
        }
    },
    "meta": {}
}

This resource allows you to create a new SSH key.

HTTP Request

POST https://api.elastic.io/v2/sshkeys/

Body Parameters

Parameter Required Description
type yes A value must be sshkey
attributes.key yes A valid RSA or DSA SSH public key.
attributes.title no Title of the key

Returns

Returns an ssh key’s metadata object if the call succeeded.

Delete a SSH key

Example Request:

curl https://api.elastic.io/v2/sshkeys/{KEY_ID} \
   -X DELETE \
   -u {EMAIL}:{APIKEY}

Example Response:

HTTP/1.1 204 No Content

This resource allows you to delete a SSH key.

HTTP Request

DELETE https://api.elastic.io/v2/sshkeys/{KEY_ID}

URL Parameters

Parameter Required Description
KEY_ID yes SSH key ID

Teams

Request / Role Tenant Admin Organization Admin Integrator Guest
Retrieve all teams - X X X
Create a team - X - -
Add a new member to a team - X - -
Remove a member from a team - X - -
Delete a team - X - -

Retrieve all teams

Example Request:

curl https://api.elastic.io/v2/teams/ \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "data": [
   {
            "id": "5aa7de77a0c086000785c53e",
            "type": "team",
            "links": {
                "self": "/v2/teams/5aa7de77a0c086000785c53e"
            },
            "attributes": {
                "name": "Team_name"
            },
            "relationships": {
                "organization": {
                    "data": {
                        "id": "59d341e9037f7200184a408b",
                        "type": "organization"
                    },
                    "links": {
                        "self": "/v2/organizations/59d341e9037f7200184a408b"
                    }
                },
                "users": {
                    "data": [
                        {
                            "id": "5a816bebcad2b40007adcaf2",
                            "type": "user"
                        },
                        //...
                    ]
                }
            }
        },
        //...
    ],
    "meta": {},
    "links": {
        "self": "/v2/teams"
    }
}

This resource allows you to retrieve all teams the current user is member in.

HTTP Request

GET https://api.elastic.io/v2/teams/

Returns

Returns teams metadata object if the call succeeded.

Create a team

Example Request:

 curl https://api.elastic.io/v2/teams \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
   {
       "data": {
            "attributes": {
                "name": "myteam"
            }
       }
   }'

Example Response:

HTTP/1.1 201 Created
Content-Type: application/json

{
    "data": {
        "id": "5aabe01bbd6d6400079b45c4",
        "type": "team",
        "links": {
            "self": "/v2/teams/5aabe01bbd6d6400079b45c4"
        },
        "attributes": {
            "name": "1503myteam"
        },
        "relationships": {
            "organization": {
                "data": {
                    "id": "59d341e9037f7200184a408b",
                    "type": "organization"
                },
                "links": {
                    "self": "/v2/organizations/59d341e9037f7200184a408b"
                }
            },
            "users": {
                "data": [
                    {
                        "id": "59d22e7eeb865b0018adc248",
                        "type": "user"
                    }
                ]
            }
        }
    },
    "meta": {}
}

This resource allows you to create a new team.

HTTP Request

POST https://api.elastic.io/v2/teams/

Body Parameters

Parameter Required Description
type yes A value must be team
attributes.name no A team name.

Returns

Returns teams metadata object if the call succeeded.

Add a new member to a team

Example Request:

 curl https://api.elastic.io/v2/teams/{TEAM_ID}/relationships/members \
   -X POST \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
   {
       "data": {
            "type": "user",
            "id": "{USER_ID}"
       }
   }'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": {
        "id": "59d3ace74a819c0018e9bb92",
        "type": "team",
        "links": {
            "self": "/v2/teams/59d3ace74a819c0018e9bb92"
        },
        "attributes": {
            "name": "Test_Team"
        },
        "relationships": {
            "organization": {
                "data": {
                    "id": "59d22e7eeb865b0018adc247",
                    "type": "organization"
                },
                "links": {
                    "self": "/v2/organizations/59d22e7eeb865b0018adc247"
                }
            },
            "users": {
                "data": [
                    {
                        "id": "59d22e7eeb865b0018adc248",
                        "type": "user"
                    },
                    {
                        "id": "59f747c33f1d3c001901a44e",
                        "type": "user"
                    },
                    {
                        "id": "59d3562c68ed850019bde27f",
                        "type": "user"
                    }
                ]
            }
        }
    },
    "meta": {}
}

This resource allows you to add a new member to a team.

HTTP Request

POST https://api.elastic.io/v2/teams/{TEAM_ID}/relationships/members

URL Parameters

Parameter Required Description
TEAM_ID yes Team identifier

Body Parameters

Parameter Required Description
type yes A value must be user
id yes Id of an already registered user, who will be added as a member of the team

Returns

Returns teams metadata object if the call succeeded.

Remove a member from a team

Example Request:

 curl https://api.elastic.io/v2/teams/{TEAM_ID}/relationships/members \
   -X DELETE \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
   {
       "data": {
            "type": "user",
            "id": "{user_id}"
       }
   }'

Example Response:

HTTP/1.1 204 No Content
Content-Type: application/json

{}

This resource allows you to remove a member from a team.

HTTP Request

DELETE https://api.elastic.io/v2/teams/{TEAM_ID}/relationships/members

URL Parameters

Parameter Required Description
TEAM_ID yes Team identifier

Body Parameters

Parameter Required Description
type yes A value must be user
id yes User identifier

Returns

Returns teams metadata object if the call succeeded.

Delete a team

Example Request:

 curl https://api.elastic.io/v2/teams/{TEAM_ID} \
   -X DELETE \
   -u {EMAIL}:{APIKEY}

Example Response:

HTTP/1.1 204 No Content
Content-Type: application/json

{}

This resource allows you to delete a team. You cannot remove team which contains the repos, you should delete all repos first.

HTTP Request

DELETE https://api.elastic.io/v2/teams/{TEAM_ID}

URL Parameters

Parameter Required Description
TEAM_ID yes Team ID

Returns

Returns empty body

Agents

Request / Role Tenant Admin Organization Admin Integrator Guest
Retrieve all agents - X X X
Сreate agent - X X X

Retrieve all agents

Example Request:

curl https://api.elastic.io/v2/agents \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": [
    {
      "id": "{AGENT_ID}",
      "type": "agent",
      "links": {
        "self": "/v2/agents/{AGENT_ID}"
      },
      "attributes": {
        "title": "agent title",
        "status": "online",
        "last_seen": "2017-10-04T19:02:19.188Z"
      },
      "relationships": {
        "organization": {
          "data": {
            "id": "{ORGANIZATION_ID}",
            "type": "organization"
          },
          "links": {
            "self": "/v2/organizations/{ORGANIZATION_ID}"
          }
        }
      }
    }
  ],
  "meta": {}
}

This resource allows you to retrieve all the agents belonging to the given organization.

HTTP Request

GET https://api.elastic.io/v2/agents/

Returns

Returns all the agents belonging to the given organization.

Сreate agent

Example Request:

curl https://api.elastic.io/v2/agents \
   -X POST \
   -u {EMAIL}:{APIKEY} \
   -H 'Content-Type: application/json' -d '
    {
      "data": {
        "type": "agent",
        "attributes": {
          "title": "agent title",
          "description": "agent description"
        }
      }
    }'

Example Response:

HTTP/1.1 201 OK
Content-Type: application/json

{
  "data": {
    "id": "{AGENT_ID}",
    "type": "agent",
    "links": {
      "self": "/v2/agents/{AGENT_ID}"
    },
    "attributes": {
      "title": "agent title",
      "description": "agent description",
      "status": "pending"
    },
    "relationships": {
      "organization": {
        "data": {
          "id": "{ORGANIZATION_ID}",
          "type": "organization"
        },
        "links": {
          "self": "/v2/organizations/{ORGANIZATION_ID}"
        }
      }
    }
  }
  "meta": {}
}

This resource allows you to create a new agent. The agent is created in pending state and our support is informed about it. We will contact you within 2-3 working days.

HTTP Request

POST https://api.elastic.io/v2/agents/

Body Parameters

Parameter Required Description
type yes A value must be agent
attributes.title yes Agent title
attributes.description yes Agent description

Returns

Returns the created agent object.

Users

Request / Role Tenant Admin Organization Admin Integrator Guest
Retrieve your user X X X X
Retrieve a user by ID X X X X
Retrieve all users X - - -
Create a user X - - -
Delete a user X - - -

Retrieve your user

Example Request:

curl https://api.elastic.io/v2/users/me \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": {
        "id": "59d22e7eeb865b0018adc248",
        "type": "user",
        "links": {
            "self": "/v2/users/59d22e7eeb865b0018adc248"
        },
        "attributes": {
            "first_name": "John",
            "last_name": "Doe",
            "email": "test@example.com",
            "company": "company",
            "registered": "2017-10-02T12:18:06.274Z",
            "last_login": "2018-03-15T16:53:57.696Z"
        }
    },
    "meta": {}
}

This resource allows you to retrieve your user.

HTTP Request

GET https://api.elastic.io/v2/users/me

Returns

Returns a user object if the call succeeded.

Retrieve a user by ID

Example Request:

curl https://api.elastic.io/v2/users/{USER_ID} \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": {
        "id": "59d3562c68ed850019bde27f",
        "type": "user",
        "links": {
            "self": "/v2/users/59d3562c68ed850019bde27f"
        },
        "attributes": {
            "first_name": "John",
            "last_name": "Doe",
            "email": "test@example.com",
            "company": "company_name",
            "registered": "2017-10-03T09:19:40.598Z",
            "last_login": "2018-03-16T10:30:38.656Z"
        }
    },
    "meta": {}
}

This resource allows you to retrieve a user by ID.

HTTP Request

GET https://api.elastic.io/v2/users/{USER_ID}

URL Parameters

Parameter Required Description
USER_ID yes User identifier

Authorization

This request is authorized to a user with Admin role to retrieve users belong to his Organization. User with TenantAdmin role (contact support to get this role) can retrieve users from all Organizations of the Tenant.

Returns

Returns a user object if the call succeeded.

Retrieve all users

Example Request (with paging):

curl https://api.elastic.io/v2/users/?page[size]=1&page[number]=5 \
   -g \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response (with paging):

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": [
        {
            "id": "560e5a27734d480a00000002",
            "type": "user",
            "links": {
                "self": "/v2/users/560e5a27734d480a00000002"
            },
            "attributes": {
                "first_name": "John",
                "last_name": "Doe",
                "email": "test@example.com",
                "company": "company_name",
                "registered": "2015-10-02T10:19:19.697Z",
                "last_login": "2018-02-08T16:07:52.495Z"
            }
        },
        //...
    ],
    "meta": {
        "page": 1,
        "per_page": 1,
        "total": 646,
        "total_pages": 646
    }
}

Example Request (default paging):

curl https://api.elastic.io/v2/users/ \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response (default paging):

HTTP/1.1 200 OK
Content-Type: application/json

{
    "meta": {
        "total": 6,
        "page": 1,
        "per_page": 50,
        "total_pages": 1
    },
    "data": [
        {
            "id": "588f8b04b84a6a7f3e47668d",
            "type": "user",
            "attributes": {
                "first_name": "Joannie",
                "last_name": "Smitham",
                "email": "client@my.org",
                "company": "Ward - Wiegand"
            }
        },
        {
            "id": "588f8b04b84a6a7f3e47668e",
            "type": "user",
            "attributes": {
                "first_name": "Eulalia",
                "last_name": "Hyatt",
                "email": "user-2@my.org",
                "company": "Pfannerstill and Sons"
            }
        },
        {
            "id": "588f8b04b84a6a7f3e47668f",
            "type": "user",
            "attributes": {
                "first_name": "Bertram",
                "last_name": "Davis",
                "email": "user-1@aliens.org",
                "company": "Auer, Ebert and Ledner"
            }
        },
        {
            "id": "588f8b04b84a6a7f3e476690",
            "type": "user",
            "attributes": {
                "first_name": "Marianne",
                "last_name": "Sawayn",
                "email": "client@outcast.org",
                "company": "O'Kon, Abshire and Dooley"
            }
        },
        {
            "id": "588f8b04b84a6a7f3e476691",
            "type": "user",
            "attributes": {
                "first_name": "Esta",
                "last_name": "Abbott",
                "email": "another@outcast.org",
                "company": "Turcotte - Christiansen"
            }
        },
        {
            "id": "588f8b04b84a6a7f3e476692",
            "type": "user",
            "attributes": {
                "first_name": "Kayleigh",
                "last_name": "Howell",
                "email": "tenant-admin@example.com",
                "company": "Zemlak, Thiel and O'Kon"
            }
        }
    ]
}

This endpoint returns a list of users.

HTTP Request

GET https://api.elastic.io/v2/users/

Query Parameters

Parameter Required Description Default
page[size] No Amount of items per page 50
page[number] No Number of page you want to display 1

Authorization

This request is authorized for a user with TenantAdmin role only. Contact support team to get this role.

Returns

Returns a list of user objects if the call succeeded.

Create a user

Example Request:

curl https://api.elastic.io/v2/users \
   -X POST \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
    {
        "data": {
            "type": "user",
            "attributes": {
                "first_name": "John",
                "last_name": "Doe",
                "email": "test@example.com",
                "password": "secret11",
                "company": "Doe & Partners"
            },
            "relationships": {
                "organizations": {
                    "data": [
                        {"id": "54f4be3fe7d5224f91000001"}
                    ]
                }
            }
        }
    }'

Example Response:

HTTP/1.1 201 Created
Content-Type: application/json

{
    "data": {
        "id": "5aabc258bd6d6400079b4592",
        "type": "user",
        "links": {
            "self": "/v2/users/5aabc258bd6d6400079b4592"
        },
        "attributes": {
            "first_name": "John",
            "last_name": "Doe",
            "email": "test@example.com",
            "company": "Doe & Partners",
            "registered": "2018-03-16T13:10:48.221Z",
            "last_login": "2018-03-16T13:10:48.221Z"
        }
    },
    "meta": {}
}

This resource allows you to create a user.

HTTP Request

POST https://api.elastic.io/v2/users

Body Parameters

Parameter Required Description
type yes A value must be user
attributes.first_name yes User’s first name.
attributes.last_name yes User’s last name.
attributes.email yes User’s email.
attributes.password yes User’s password.
attributes.company no User’s company.
relationships.organizations.data yes Organizations to join.

Authorization

This request is authorized only for a user with TenantAdmin role. Contact support team to get this role.

Returns

New user objects will be provided with an id field - this value cannot be created or edited by clients.

Delete a user

Example Request:

curl https://api.elastic.io/v2/users/{USER_ID} \
    -X DELETE \
    -u {EMAIL}:{APIKEY}

Example Response:

HTTP/1.1 204 No Content

This resource allows you to delete a user. When a user is delete following data are deleted as well:

Not deleted immediately

These data objects are deleted automatically (e.g. due to expiration), hence won’t be deleted right after user deletion:

Data associated with organization

Public components

If there is any public component, associated to the user and the component is used in not deleted flows of someone else, the user can not be deleted automaticaly – contact technical support.

Authorization

This request is allowed with Organization Admin API key.

HTTP Request

DELETE https://api.elastic.io/v2/users/{USER_ID}

URL Parameters

Parameter Required Description
USER_ID yes User identifier