### GET /programs with Nested Resources Source: https://docs.bugcrowd.com/api/usage This example demonstrates how to use the 'include' parameter to fetch nested resources for the /programs endpoint. It shows how to specify relationships using dot notation and how to use 'fields' to control the data returned for each resource type. ```APIDOC ## GET /programs?include=current_brief.target_groups.reward_range ### Description Fetches a list of programs, including nested resources such as the current brief, its target groups, and their associated reward ranges. This utilizes the JSON API specification for compound documents. ### Method GET ### Endpoint /programs ### Query Parameters - **include** (string) - Optional - Comma-separated list of relationships to include. Supports dot notation for nested resources (e.g., `current_brief.target_groups.reward_range`). - **fields[program]** (string) - Optional - Specifies which fields to return for the 'program' resource (e.g., `current_brief`). - **fields[program_brief]** (string) - Optional - Specifies which fields to return for the 'program_brief' resource (e.g., `target_groups`). - **fields[target_group]** (string) - Optional - Specifies which fields to return for the 'target_group' resource (e.g., `reward_range`). - **fields[reward_range]** (string) - Optional - Specifies which fields to return for the 'reward_range' resource (e.g., `p1_max_cents`). ### Request Example ``` api.bugcrowd.com/programs?include=current_brief.target_groups.reward_range&fields[program]=current_brief&fields[program_brief]=target_groups&fields[target_group]=reward_range&fields[reward_range]=p1_max_cents ``` ### Response #### Success Response (200) Returns a JSON API compliant response containing 'data' for the primary resource (programs) and 'included' for related nested resources. The structure follows the JSON API specification for compound documents. #### Response Example ```json { "data": [ { "type": "program", "id": "RANDOM_UUID", "attributes": {}, "relationships": { "current_brief": { "data": { "type": "program_brief", "id": "RANDOM_UUID" }, "links": { "related": "(NOT IMPLEMENTED)" } } } } ], "included": [ { "type": "program_brief", "id": "RANDOM_UUID", "attributes": {}, "relationships": { "target_groups": { "data": [ { "type": "target_group", "id": "RANDOM_UUID" } ], "links": { "related": { "href": "(NOT IMPLEMENTED)", "meta": { "count": 1, "total_hits": 1 } } } } } }, { "type": "target_group", "id": "RANDOM_UUID", "attributes": {}, "relationships": { "reward_range": { "data": { "type": "reward_range", "id": "RANDOM_UUID" }, "links": { "related": "(NOT IMPLEMENTED)" } } } }, { "type": "reward_range", "id": "RANDOM_UUID", "attributes": { "p1_max_cents": 10000 } } ], "links": { "self": "api.bugcrowd.com/programs?include=current_brief.target_groups.reward_range&fields[program]=current_brief&fields[program_brief]=target_groups&fields[target_group]=reward_range&fields[reward_range]=p1_max_cents" } } ``` ``` -------------------------------- ### Basic Ruby Code Example Source: https://docs.bugcrowd.com/researchers/reporting-managing-submissions/commenting A simple example of Ruby code that can be used to demonstrate syntax highlighting. ```ruby puts "Highlight me!" ``` -------------------------------- ### Fetch Program Roles Request Source: https://docs.bugcrowd.com/api/latest Example of a GET request to retrieve program roles using cURL. ```shell curl --request GET \ --url 'https://api.bugcrowd.com/organizations/%7Bid%7D/program_roles?fields%5Borganization_program_role%5D=SOME_ARRAY_VALUE&filter%5Buser_id%5D=SOME_ARRAY_VALUE&filter%5Bprogram_id%5D=SOME_ARRAY_VALUE' \ --header 'Authorization: REPLACE_KEY_VALUE' ``` -------------------------------- ### Fetch Team Request Sample Source: https://docs.bugcrowd.com/api/latest Example cURL request to retrieve team information using the GET method. ```shell curl --request GET \ --url 'https://api.bugcrowd.com/teams/%7Bid%7D?include=SOME_ARRAY_VALUE&fields%5Bteam%5D=SOME_ARRAY_VALUE&fields%5Brole%5D=SOME_ARRAY_VALUE&fields%5Bteam_member%5D=SOME_ARRAY_VALUE' \ --header 'Authorization: REPLACE_KEY_VALUE' ``` -------------------------------- ### List Organizations GET Request Source: https://docs.bugcrowd.com/api/latest Example cURL command to retrieve a list of organizations with optional query parameters. ```bash curl --request GET \ --url 'https://api.bugcrowd.com/organizations?fields%5Borganization%5D=SOME_ARRAY_VALUE&fields%5Bprogram%5D=SOME_ARRAY_VALUE&fields%5Btarget%5D=SOME_ARRAY_VALUE&page%5Blimit%5D=SOME_INTEGER_VALUE&page%5Boffset%5D=SOME_INTEGER_VALUE&include=SOME_ARRAY_VALUE&sort=SOME_ARRAY_VALUE' \ --header 'Authorization: REPLACE_KEY_VALUE' ``` -------------------------------- ### Authentication Logs API Response Source: https://docs.bugcrowd.com/api/latest Example JSON response body returned by the GET /authentication_logs endpoint. ```json { * "data": [ * { * "id": { * "$ref": "https://bugcrowd.com/openapi/1.0.0/external_elements.yml#/general_helpers/ValidUUID" }, * "type": "authentication_log", * "attributes": { * "action": "Login", * "actor": "email@example.com", * "ip_address": null, * "reason": null, * "time": "2018-11-18T23:09:29.992Z" } }, * { * "id": { * "$ref": "https://bugcrowd.com/openapi/1.0.0/external_elements.yml#/general_helpers/ValidUUID" }, * "type": "authentication_log", * "attributes": { * "action": "Logout", * "actor": "email@example.com", * "ip_address": null, * "reason": null, * "time": "2018-11-18T23:09:29.992Z" } } ], * "meta": { * "total_hits": 2, * "count": 2 }, * "links": { * "self": "/authentication_logs?fields[authentication_log]=time,actor,action,ip_address,reason&filter[end_date]=2018-12-5T01:34:14Z&filter[organization_id]=10000000-0000-0000-0000-000000000000&filter[start_date]=2018-11-13T01:33:02Z&filter[organization_id]=10000000-0000-0000-0000-000000000000&page[limit]=50&page[offset]=0", * "next": "/authentication_logs?fields[authentication_log]=time,actor,action,ip_address,reason&filter[end_date]=2018-12-5T01:34:14Z&filter[organization_id]=10000000-0000-0000-0000-000000000000&filter[start_date]=2018-11-13T01:33:02Z&page[limit]=50&page[offset]=50", * "previous": "/authentication_logs?fields[authentication_log]=time,actor,action,ip_address,reason&filter[end_date]=2018-12-5T01:34:14Z&filter[organization_id]=10000000-0000-0000-0000-000000000000&filter[start_date]=2018-11-13T01:33:02Z&page[limit]=50&page[offset]=0" } } ``` -------------------------------- ### Fetching a Specific Program with Custom Fields Source: https://docs.bugcrowd.com/api/usage Example of how to fetch a specific program and customize the returned fields for the program and its brief, including related resources. ```APIDOC ## GET /programs/{PROGRAM_UUID} ### Description Fetches a specific program, allowing customization of returned fields and inclusion of related resources. ### Method GET ### Endpoint /programs/PROGRAM_UUID ### Query Parameters - **fields[program]** (string) - Optional - Comma-separated list of program fields to return (e.g., `code`). - **fields[program_brief]** (string) - Optional - Comma-separated list of program brief fields to return (e.g., `tagline,demo`). - **include** (string) - Optional - Comma-separated list of relationship names to include in the response (e.g., `current_brief`). ### Request Example ``` api.bugcrowd.com/programs/PROGRAM_UUID?fields[program]=code&fields[program_brief]=tagline,demo&include=current_brief ``` ### Response #### Success Response (200) - **data** (object) - The main resource object. - **type** (string) - The type of the resource (e.g., `program`). - **id** (string) - The unique identifier (UUID) of the resource. - **attributes** (object) - Contains the resource's data attributes. - **relationships** (object) - Contains links to related resources. - **links** (object) - Links related to the resource, including `self`. - **included** (array) - An array of related resources that were included in the response. #### Response Example ```json { "data": { "type": "program", "id": "PROGRAM_UUID", "attributes": { "code": "EXAMPLE_CODE" }, "relationships": { "current_brief": { "data": {"type": "program_brief", "id": "BRIEF_UUID"}, "links": { "related": {"href": "/program_brief/BRIEF_UUID"} } } } }, "links": { "self": "/programs/PROGRAM_UUID" }, "included": [ { "type": "program_brief", "id": "BRIEF_UUID", "attributes": { "tagline": "Example tagline", "demo": false }, "relationships": {} } ] } ``` ``` -------------------------------- ### Create Team Role - Ruby Native Sample Source: https://docs.bugcrowd.com/api/latest Example of creating a team role using Ruby's native `Net::HTTP` library, demonstrating request construction and response handling. ```ruby require 'net/http' require 'uri' uri = URI.parse('https://api.bugcrowd.com/teams/{id}/roles') request = Net::HTTP::Post.new(uri) request['Content-Type'] = 'application/vnd.bugcrowd.v4+json' request['Authorization'] = 'Bearer YOUR_API_TOKEN' payload = { "data": { "type": "team_role", "attributes": { "role": "admin" }, "relationships": { "program": { "data": { "type": "program", "id": "YOUR_PROGRAM_UUID" } } } } } request.body = payload.to_json response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end puts response.code puts response.body ``` -------------------------------- ### Sort Submissions Example Source: https://docs.bugcrowd.com/api/latest Demonstrates how to sort submissions using tokenized sort options. Supports multiple sort criteria. ```text sort=submitted-asc,severity-desc ``` -------------------------------- ### Get Authorization Logs with Query Parameters Source: https://docs.bugcrowd.com/api/latest Use this endpoint to retrieve authorization logs. You can filter by organization ID, start date, and end date, and specify which fields to include in the response. Ensure you replace `REPLACE_KEY_VALUE` with your actual API key. ```Shell curl --request GET \ --url 'https://api.bugcrowd.com/authorization_logs?fields%5Bauthorization_log%5D=SOME_ARRAY_VALUE&filter%5Borganization_id%5D=SOME_ARRAY_VALUE&filter%5Bstart_date%5D=SOME_STRING_VALUE&filter%5Bend_date%5D=SOME_STRING_VALUE' \ --header 'Authorization: REPLACE_KEY_VALUE' ``` -------------------------------- ### Create Team Role - Shell + Curl Sample Source: https://docs.bugcrowd.com/api/latest Example of creating a team role using cURL, demonstrating the HTTP method, endpoint, headers, and request body. ```shell curl -X POST https://api.bugcrowd.com/teams/{id}/roles \ -H "Content-Type: application/vnd.bugcrowd.v4+json" \ -H "Authorization: Bearer YOUR_API_TOKEN" \ -d '{ "data": { "type": "team_role", "attributes": { "role": "admin" }, "relationships": { "program": { "data": { "type": "program", "id": "YOUR_PROGRAM_UUID" } } } } }' ``` -------------------------------- ### Create Team Role - Python3 Sample Source: https://docs.bugcrowd.com/api/latest Example of creating a team role using Python 3's `requests` library, showing how to send a POST request with JSON payload. ```python import requests url = "https://api.bugcrowd.com/teams/{id}/roles" headers = { "Content-Type": "application/vnd.bugcrowd.v4+json", "Authorization": "Bearer YOUR_API_TOKEN" } payload = { "data": { "type": "team_role", "attributes": { "role": "admin" }, "relationships": { "program": { "data": { "type": "program", "id": "YOUR_PROGRAM_UUID" } } } } } response = requests.post(url, headers=headers, json=payload) print(f"Status Code: {response.status_code}") print(response.json()) ``` -------------------------------- ### Monetary Reward Response Example Source: https://docs.bugcrowd.com/api/latest Example of a successful response when creating or retrieving a monetary reward. Includes details like ID, attributes, relationships, and links. ```json { "data": { "id": { "$ref": "https://bugcrowd.com/openapi/1.0.0/external_elements.yml#/general_helpers/ValidUUID" }, "type": "monetary_reward", "attributes": { "amount_cents": 1000, "cancellation_comment": null, "cancellation_reason": null, "cancelled_at": null, "comment": null, "created_at": "2018-11-13T20:20:39.000Z", "reason": "tip", "rewarded_at": "2018-11-13T20:20:39.000Z", "formatted_amount": "$10", "cancelled": false }, "relationships": { "submission": { "data": { "type": "submission", "id": { "$ref": "https://bugcrowd.com/openapi/1.0.0/external_elements.yml#/general_helpers/ValidUUID" } }, "links": { "related": { "href": "/submissions/10000000-0000-0000-0000-000000000000" } } }, "rewarded_by": { "data": { "type": "identity", "id": { "$ref": "https://bugcrowd.com/openapi/1.0.0/external_elements.yml#/general_helpers/ValidUUID" } }, "links": { "related": { "href": "(NOT IMPLEMENTED YET)" } } }, "cancelled_by": { "$ref": "https://bugcrowd.com/openapi/1.0.0/external_elements.yml#/general_helpers/EmptySingleRelationship" }, "payments": { "data": [ { "type": "payment", "id": { "$ref": "https://bugcrowd.com/openapi/1.0.0/external_elements.yml#/general_helpers/ValidUUID" } } ], "links": { "related": { "href": "(NOT IMPLEMENTED YET)", "meta": { "count": 1, "total_hits": 1 } } } } }, "links": { "self": "/monetary_rewards/10000000-0000-0000-0000-000000000000" } } } ``` -------------------------------- ### Fetch Specific Program with Fields and Include Source: https://docs.bugcrowd.com/api/usage Use this to retrieve a specific program, limiting the returned fields to the program code and tagline, and including the current brief. ```api api.bugcrowd.com/programs/PROGRAM_UUID?fields[program]=code&fields[program_brief]=tagline,demo&include=current_brief ``` -------------------------------- ### Create Team Role - Node.js Native Sample Source: https://docs.bugcrowd.com/api/latest Example of creating a team role using Node.js native `https` module, showing how to construct the request and handle the response. ```javascript const https = require('https'); const options = { hostname: 'api.bugcrowd.com', port: 443, path: '/teams/{id}/roles', method: 'POST', headers: { 'Content-Type': 'application/vnd.bugcrowd.v4+json', 'Authorization': 'Bearer YOUR_API_TOKEN' } }; const req = https.request(options, res => { console.log(`statusCode: ${res.statusCode}`); res.on('data', d => { process.stdout.write(d); }); }); req.on('error', error => { console.error(error); }); const payload = { "data": { "type": "team_role", "attributes": { "role": "admin" }, "relationships": { "program": { "data": { "type": "program", "id": "YOUR_PROGRAM_UUID" } } } } }; req.write(JSON.stringify(payload)); req.end(); ``` -------------------------------- ### Create Claim Ticket Request Payload Example Source: https://docs.bugcrowd.com/api/latest This is a valid example of a request payload for creating a claim ticket, specifying the 'claim_ticket' type and its relationship to a 'submission'. ```json { "data": { "type": "claim_ticket", "relationships": { "submissions": { "data": [ { "type": "submission", "id": { "$ref": "https://bugcrowd.com/openapi/1.0.0/external_elements.yml#/general_helpers/ValidUUID" } } ] } } } } ``` -------------------------------- ### Bugcrowd API CVSS Vector Request Example Source: https://docs.bugcrowd.com/api/latest Example URL to fetch submissions including the CVSS vector, specifying fields for both submission and CVSS vector resources. ```http api.bugcrowd.com/submissions?fields[submission]=cvss_vector&include=cvss_vector&fields[cvss_vector]=score ``` -------------------------------- ### Create Team Response Sample Source: https://docs.bugcrowd.com/api/latest Example of a successful response (201 Created) when creating a team. It includes the team's ID and details. ```json { "data": { "id": { "$ref": "https://bugcrowd.com/openapi/1.0.0/external_elements.yml#/general_helpers/ValidUUID" }, "type": "team", "attributes": null, "name": "New team Name", "description": "New team Description", "relationships": { "organization": { "data": { "id": { "$ref": "https://bugcrowd.com/openapi/1.0.0/external_elements.yml#/general_helpers/ValidUUID" }, "type": "organization" }, "links": { "related": { "href": "/organizations/10000000-0000-0000-0000-000000000000" } } } }, "links": { "self": "/programs/10000000-0000-0000-0000-000000000000" } } } ``` -------------------------------- ### GET /teams Source: https://docs.bugcrowd.com/changelog/api/api-version-2025-02-25 Retrieves a list of all teams in the organization. ```APIDOC ## GET /teams ### Description Returns a list of all teams associated with the organization. ### Method GET ### Endpoint /teams ### Response #### Success Response (200) - **data** (array) - List of team objects - **included** (array) - Included related resources like team members - **meta** (object) - Metadata including total_hits and count - **links** (object) - Pagination links #### Response Example { "data": [ { "id": "10000000-0000-0000-0000-000000000001", "type": "team", "attributes": { "name": "Team", "description": "Description" }, "relationships": { "team_members": { "data": [ { "id": "10000000-0000-0000-0000-000000000001", "type": "team_member" } ], "links": { "related": { "href": "/teams/10000000-0000-0000-0000-000000000001/members", "meta": { "count": 1, "total_hits": 1 } } } } } } ], "included": [ { "id": "b5b7c6b2-03e4-4086-bf03-fcb37259c9dd", "type": "team_member", "attributes": { "name": "Buddy Stokes", "email": "joker@bugcrowd.com" }, "relationships": { "team": { "data": { "id": "10000000-0000-0000-0000-000000000001", "type": "team" } } } } ], "meta": { "total_hits": 1, "count": 1 }, "links": { "self": "/teams?include=team_members", "next": "/teams?include=team_members&page[limit]=25&page[offset]=25", "previous": "/teams?include=team_members" } } ``` -------------------------------- ### Retrieve Authentication Logs via cURL Source: https://docs.bugcrowd.com/api/latest Example request to fetch authentication logs using the cURL command-line tool. ```bash curl --request GET \ --url 'https://api.bugcrowd.com/authentication_logs?fields%5Bauthentication_log%5D=SOME_ARRAY_VALUE&filter%5Borganization_id%5D=SOME_ARRAY_VALUE&page%5Blimit%5D=SOME_INTEGER_VALUE&page%5Boffset%5D=SOME_INTEGER_VALUE&filter%5Bstart_date%5D=SOME_STRING_VALUE&filter%5Bend_date%5D=SOME_STRING_VALUE' \ --header 'Authorization: REPLACE_KEY_VALUE' ``` -------------------------------- ### GET /teams Source: https://docs.bugcrowd.com/changelog/api/api-version-2025-02-25 Fetches a list of all teams in the organization. ```APIDOC ## GET /teams ### Description Lists all teams within the organization, optionally including team members. ### Method GET ### Endpoint /teams ### Response #### Success Response (200) - **data** (object) - Team details - **included** (array) - Related resources like team members #### Response Example { "data": { "id": "10000000-0000-0000-0000-000000000001", "type": "team", "attributes": { "name": "Team", "description": "Description" } } } ``` -------------------------------- ### GET /authorization_logs Source: https://docs.bugcrowd.com/api/latest Retrieves a list of authorization logs for the organization. ```APIDOC ## GET /authorization_logs ### Description Returns a historic log of authorization access granted to an organization and the roles assigned. ### Method GET ### Endpoint /authorization_logs ### Request Headers - **accept** (string) - Required - application/vnd.bugcrowd+json ### Response #### Success Response (200) - **id** (string) - Unique identifier - **type** (string) - Value: "authorization_log" - **attributes** (object) - Contains time, actor, object, action, attribute, and resource details #### Response Example { "id": "10000000-0000-0000-0000-000000000000", "type": "authorization_log", "attributes": { "time": "string", "actor": "string", "object": "string", "action": "string", "attribute": "string", "resource": "string" } } ``` -------------------------------- ### Fetch Programs using cURL Source: https://docs.bugcrowd.com/api/latest Use this cURL command to make a GET request to the programs endpoint. Include authorization and specify desired fields, pagination, and filters. ```shell curl --request GET \ --url 'https://api.bugcrowd.com/programs?fields%5Borganization%5D=SOME_ARRAY_VALUE&fields%5Bprogram%5D=SOME_ARRAY_VALUE&fields%5Bsubmission%5D=SOME_ARRAY_VALUE&fields%5Bengagement%5D=SOME_ARRAY_VALUE&page%5Blimit%5D=SOME_INTEGER_VALUE&page%5Boffset%5D=SOME_INTEGER_VALUE&include=SOME_ARRAY_VALUE&filter%5Borganization_id%5D=SOME_ARRAY_VALUE&sort=SOME_ARRAY_VALUE' \ --header 'Authorization: REPLACE_KEY_VALUE' ``` -------------------------------- ### Create Program Role Response Source: https://docs.bugcrowd.com/api/latest JSON response returned after successfully creating a program role. ```json { "data": { "id": { "$ref": "https://bugcrowd.com/openapi/1.0.0/external_elements.yml#/general_helpers/ValidUUID" }, "type": "program_role", "attributes": { "name": "Sam Block", "email": "qateam@bugcrowd.com", "program_name": "RedamaLLC Ongoing", "program_code": "redamallcongoing", "role": "analyst" } } } ```