Targets

Operations done on Targets

Base URL

https://app.pentest-tools.com/api/v2

Authorization

Use the "API key" from the profile page as the token


Method
get
Path
/targets

Query parameters

Property
workspace_id
Type
integer

ID of the workspace to show targets from

Property
type
Type
string

the type of target

Possible values:

  • "hostname"
  • "ip_address"
  • "url"
Property
limit
Type
integer

the maximum number of targets to return

Property
page
Type
integer

the page number to return

Responses

400Invalid parameters
500Internal server error

Request

GET
/targets
curl --request GET \
  --url https://app.pentest-tools.com/api/v2/targets \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}'

Response

[
  {
    "id": 1,
    "name": "example.org",
    "type": "hostname",
    "description": "",
    "workspace_id": 1
  }
]

OK


Method
post
Path
/targets

Request parameters

Content type
application/x-www-form-urlencoded
object
Property
name
Type
string
required
Yes
Property
description
Type
string
Property
workspace_id
Type
integer

Responses

400Invalid parameters
403Can't create target because it is blacklisted, the user has too many targets or the license is invalid
404Workspace ID is not valid
409Target already exists
422Target is in a wrong format
500Internal server error

Request

POST
/targets
curl --request POST \
  --url https://app.pentest-tools.com/api/v2/targets \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}'

Response

{
  "created_id": 420323
}

Created


Method
get
Path
/targets/{id}

Path parameters

Property
id
Type
integer
required
Yes

id of target to get

Responses

500Internal server error

Request

GET
/targets/{id}
curl --request GET \
  --url https://app.pentest-tools.com/api/v2/targets/{id} \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}'

Response

{
  "id": 1,
  "name": "example.org",
  "type": "hostname",
  "description": "",
  "workspace_id": 1
}

OK


Method
delete
Path
/targets/{id}

Delete a Target

Delete a target and its scans

Path parameters

Property
id
Type
integer
required
Yes

id of target to get

Responses

204Deleted successfully
400Invalid id
409Target has running scans
500Internal server error

Request

DELETE
/targets/{id}
curl --request DELETE \
  --url https://app.pentest-tools.com/api/v2/targets/{id} \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}'

Response

No Body

Deleted successfully