The following query parameters can be used to control the order, offset and size of the returned data
| Parameter | Description | Example |
|---|
index | The 0-based index of the page of data desired (default: 0) | ?index=2 |
size | The size of the page of data desired (min: 1, max: 1000, default: 50) | ?size=10 |
sort | The sort terms and (optional) directions for the desired ordering of data (default: specific to each resource) | ?sort=scan.submit_time,DESC,scan.status |
page-token | The page token, used as an alternative to index (default: Not provided) | ?page-token=NDM0NTk0NTIyOjo6X1M6OjpiYW5hbmFz |
Paging using a page token
When intending to page beyond the 10,000th result, or as an alternative to using the index query parameter, the page-token option may be used instead. After retrieving the first page, the page_token will be present in the metadata section of the response.
For example, with size=99, index=0 to index=99 may be used. To load the next page, use the page_token value used in the response e.g. ?page-token=NDM0NTk0NTIyO
Creating resources
As is generally the accepted practice with REST-ful APIs, creating a resource can be performed by sending an appropriately formatted POST request. Any ID provided for a new resource in a POST request body will simply be ignored (and a new one generated internally and returned as part of the resource in subsequent GET requests), and POST requests to URLs following a format similar to .../resource/ are unsupported and should respond with 415 Method Not Allowed. All requests which successfully create a resource and respond with 201 Created will contain a Location header the value of which is an absolute URI for the resource (the ID of which can be determined as the last section of the path in the given URI). For example:
Location: https://us.api.insight.rapid7.com/ias/v1/scans/12345678-1234-5678-90AB-1234567890AB
Date, Time and Timezone Support
The value of date and date-time type properties are fixed to the common ISO-8601 format. Unless otherwise specified, all date or date-time data in response bodies are expressed in UTC, and it is also expected that data provided in request bodies are also expressed in UTC.
Schedules and Blackouts
The first_start and first_end properties of both Blackouts and Schedules, and the last_start property of Blackouts may be specified with a timezone. If the timezone is not specified, it is assumed to be UTC. For example:
2019-08-12T14:00:00.000000Z[Asia/Tokyo]
It is also possible to specify the timezone as an offset of either GMT or UTC. For example:
2019-09-04T15:00:00.000000Z[GMT+03:00]
| Value | Format | Notes |
|---|
| Date | YYYY-MM-DD | Defaults to 12 am UTC (if used for a date & time) |
| Date & time only | YYYY-MM-DD''T''hh:mm:ss[.nnn] | Defaults to UTC |
| Date & time in UTC | YYYY-MM-DD''T''hh:mm:ss[.nnn]Z | |
| Date & time with specific timezone | YYYY-MM-DD''T''hh:mm:ss[.nnn]Z[TimeZoneId] | |
Searching and Filtering
One characteristic of a powerful API is support for complex search and filtering of resources using a flexible query language. It is entirely possible to provide basic search and filtering functionality on standard GET resource collection operations using HTTP query parameters, but this becomes restrictive when attempting to encode boolean logic. Other solutions are also possible but come with equally restrictive compromises. The most effective way to facilitate this complex search and filtering is to provide it as a top-level API with a robust Domain-Specific Language (DSL).
For simple data retrieval that supports paging and sorting functionality, use the traditional resource-specific GET collection operations; for more complex data retrieval that supports a user-crafted query DSL, use the global Search operation.
Errors
Any response from the API with an HTTP Status Code in the 4xx or 5xx range indicates an error. If in the 4xx range it indicates a client-side error, where in the 5xx range it indicates a server-side error. All responses indicating an error should be JSON formatted, and contain both a "status" and a "message" property indicating the cause of the error, a "r7-correlation-id" header should also always be returned in the format of a UUID, which uniquely identifies the HTTP exchange that took place and caused the error (this header is present on every request). On some occasions, an "error_code" property will be included in the response body, which can provide the support team further context into the cause of the error in cases where the message is not explicitly clear.
When contacting support about error responses received from the API, please attempt to include, at minimum:
- A description of the requests intent
- The request URL
- The request body
- The error response body
- The error response "r7-correlation-id" header
Validation Errors
Specifically, when a response with an HTTP Status Code of 422 is returned, this indicates a validation error, almost always received in a response from a non-idempotent request (normally PUT, POST or DELETE). In this case, there should be an additional "errors" property included in the JSON response body that should describe the cause of the validation exception; this will almost always require a modification to the request body to resolve.
'
version: v1
servers:
- url: https://[region].api.insight.rapid7.com/ias/v1
tags:
- name: Community Threats
description: An API used to add and replace indicators for Community Threats. See https://insightidr.help.rapid7.com/docs/threats#section-threat-api for further information on how to generate threat keys.
paths:
/idr/v1/customthreats:
post:
tags:
- Community Threats
summary: Create a Community Threat
description: Create a private InsightIDR Community Threat and add indicators to this Community Threat. The following Community Threat indicators are supported in the request body, formatted as JSON:- communityThreatName
- notetext
- indicators
- IP addresses (non-CIDR notation)
- Process hashes
- Domain names
- URLs
The request content type must be to in JSON (see request samples).
The maximum file size is 50 MB.
operationId: createCommunityThreat
requestBody:
description: "The request body format must be in JSON. \nThe maximum payload size is 50 MB."
content:
application/json:
schema:
type: string
example:
threat: threatName
note: notetext
indicators:
ips:
- 192.168.0.1
hashes:
- b95663ec7339033cf1fde459a34b6606
domain_names:
- rapid7.com
- mailxpy.com
urls:
- http://example.com/index
- ' http://www.mailxpy.com/login/index.php'
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ThreatUpdateResult'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Insufficient Permissions
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Entity Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'405':
description: Method Not Allowed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'413':
description: Payload Is Too Large
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'502':
description: Bad Gateway
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'503':
description: Service Unavailable
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'504':
description: Gateway Timeout
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/idr/v1/customthreats/key/{key}/indicators/replace:
post:
tags:
- Community Threats
summary: Replace indicators for a Community Threat
description: 'Replace InsightIDR Community Threat indicators for a Community Threat with the given Community Threat key. The following Community Threat indicators are supported in the request body formatted as JSON, STIX XML, or CSV:
- IP addresses
- Process hashes
- Domain names
- URLs
The request content type is expected to match the specified format: "application/json" for "json" format, "text/xml" for "stix_xml" format and "text/csv" for "csv" format. See request samples on the right.
The multipart file upload (with multipart/form-data content type) is also supported by the endpoint. The maximum file size is 50 MB.'
operationId: replaceIndicators
parameters:
- name: key
in: path
description: The key of a Community Threat for which the indicators are going to be added.
required: true
schema:
type: string
example: 156c9e48-64da-4bba-939e-e1c329be591b
- name: format
in: query
description: The input format.
required: true
schema:
type: string
enum:
- json
- csv
- stix_xml
example: json
requestBody:
description: "The request body format should be one of JSON, STIX XML, CSV, or multi-part file data. \nThe maximum payload size is 50 MB."
content:
application/json:
schema:
type: string
example:
ips:
- 192.168.0.1
hashes:
- b95663ec7339033cf1fde459a34b6606
domain_names:
- rapid7.com
urls:
- http://example.com
text/csv:
schema:
type: string
example: 192.168.0.1,b95663ec7339033cf1fde459a34b6606,rapid7.com,http://example.com
text/xml:
schema:
type: string
example: "\n\n \n Example watchlist that contains domain information.\n Indicators - Watchlist\n \n \n \n Domain Watchlist\n Sample domain Indicator for this watchlist\n \n \n \n malicious1.example.com##comma##malicious2.example.com##comma##malicious3.example.com\n \n \n \n \n \n \n 185.134.98.141\n \n \n \n \n \n"
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ThreatUpdateResult'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Insufficient Permissions
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Entity Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'405':
description: Method Not Allowed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'413':
description: Payload Is Too Large
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'502':
description: Bad Gateway
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'503':
description: Service Unavailable
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'504':
description: Gateway Timeout
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/idr/v1/customthreats/key/{key}/indicators/add:
post:
tags:
- Community Threats
summary: Add indicators to a Community Threat
description: 'Add InsightIDR Community Threat indicators to a Community Threat with the given Community Threat key. The following Community Threat indicators are supported in the request body formatted as JSON, STIX XML, or CSV:
- IP addresses
- Process hashes
- Domain names
- URLs
The request content type is expected to match the specified format: "application/json" for "json" format, "text/xml" for "stix_xml" format and "text/csv" for "csv" format. See request samples on the right.
The multipart file upload (with multipart/form-data content type) is also supported by the endpoint. The maximum file size is 50 MB.'
operationId: addIndicators
parameters:
- name: key
in: path
description: The key of a Community Threat for which the indicators are going to be added.
required: true
schema:
type: string
example: 156c9e48-64da-4bba-939e-e1c329be591b
- name: format
in: query
description: The input format.
required: true
schema:
type: string
enum:
- json
- csv
- stix_xml
example: json
requestBody:
description: "The request body format should be one of JSON, STIX XML, CSV, or multi-part file data. \nThe maximum payload size is 50 MB."
content:
application/json:
schema:
type: string
example:
ips:
- 192.168.0.1
hashes:
- b95663ec7339033cf1fde459a34b6606
domain_names:
- rapid7.com
urls:
- http://example.com
text/csv:
schema:
type: string
example: 192.168.0.1,b95663ec7339033cf1fde459a34b6606,rapid7.com,http://example.com
text/xml:
schema:
type: string
example: "\n\n \n Example watchlist that contains domain information.\n Indicators - Watchlist\n \n \n \n Domain Watchlist\n Sample domain Indicator for this watchlist\n \n \n \n malicious1.example.com##comma##malicious2.example.com##comma##malicious3.example.com\n \n \n \n \n \n \n 185.134.98.141\n \n \n \n \n \n"
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ThreatUpdateResult'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Insufficient Permissions
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Entity Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'405':
description: Method Not Allowed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'413':
description: Payload Is Too Large
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'502':
description: Bad Gateway
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'503':
description: Service Unavailable
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'504':
description: Gateway Timeout
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/idr/v1/customthreats/key/{key}/delete:
post:
tags:
- Community Threats
summary: Delete a Community Threat
description: Delete an owned InsightIDR Community Threat.
operationId: deleteCommunityThreat
parameters:
- name: key
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteThreatEvent'
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Threat'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Insufficient Permissions
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Threat with key threatKey was not found.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'405':
description: Method Not Allowed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'502':
description: Bad Gateway
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'503':
description: Service Unavailable
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'504':
description: Gateway Timeout
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
DeleteThreatEvent:
type: object
properties:
reason:
type: string
ThreatUpdateResult:
required:
- threat
type: object
properties:
threat:
$ref: '#/components/schemas/Threat'
rejected_indicators:
type: array
description: The list of indicators that have been rejected during the update.
example:
- blacklisted
- invalid
items:
type: string
Threat:
required:
- indicator_count
- name
- published
type: object
properties:
name:
type: string
description: The name of the threat.
example: Threat
note:
type: string
description: Notes about this threat.
example: Notes
published:
type: boolean
description: Indicates whether this threat has been published.
example: true
indicator_count:
minimum: 0
type: integer
description: The number of indicators in this threat.
format: int64
example: 1
description: The information about the threat.
ErrorResponse:
required:
- message
type: object
properties:
message:
type: string
description: A human-readable message describing the error that occurred.
example: A human-readable message describing the error that occurred.
correlation_id:
type: string
description: An identifier that uniquely identifies the failed request.
example: 6b6503c8-2da9-41c0-94cb-2f34069e00cd