openapi: 3.2.0 info: title: G2 Credit Account API version: v2 description: '## Rate Limiting Cloudflare limits requests to the G2 API to **100 requests per second** per source IP address. ' servers: - url: https://{defaultHost} variables: defaultHost: default: data.g2.com tags: - name: Credit Account paths: /api/v2/organization/{organization_id}/credit_account: get: summary: Retrieve credit account details for an organization operationId: getOrganizationCreditAccount tags: - Credit Account description: '**No scope required.** Retrieve API metering credit account details including balance and total credits. Use `?include=deductions` to include the last month of deductions in the response. ' security: - AccountAPIToken: [] parameters: - name: organization_id in: path description: Organization UUID or slug required: true schema: type: string - name: fields[credit_account] in: query explode: false description: Comma separated list of fields for credit_account to include in response schema: type: array items: type: string enum: - name - slug - available_balance - purchased_credits - total_deductions - name: include in: query explode: false description: Comma-separated list of relationships to include (e.g. deductions) schema: type: array items: type: string enum: - deductions responses: '401': description: Unauthenticated content: application/vnd.api+json: example: errors: - status: '401' title: Bad Credentials schema: $ref: '#/components/schemas/Errors' '404': description: Organization not found content: application/vnd.api+json: example: errors: - status: '404' title: Not Found schema: $ref: '#/components/schemas/Errors' '200': description: Credit account details content: application/vnd.api+json: schema: type: object required: - data properties: data: type: object required: - id - type - attributes properties: id: type: string description: Organization UUID type: type: string example: credit_account attributes: type: object properties: name: type: string description: Organization name slug: type: string description: Organization slug available_balance: type: number format: float description: Current available credit balance purchased_credits: type: number format: float description: Total credits purchased total_deductions: type: number format: float description: Total credits consumed relationships: type: object properties: deductions: type: object properties: data: type: array items: type: object properties: id: type: string type: type: string example: deductions included: type: array description: Included deduction resources items: type: object required: - id - type - attributes properties: id: type: string description: Deduction ID type: type: string example: deductions attributes: type: object properties: amount: type: number format: float request_count: type: - integer - 'null' description: type: - string - 'null' credit_usage_by_entity: type: - object - 'null' description: Breakdown of credits consumed by record type additionalProperties: type: number format: float example: reviews: 50.0 products: 20.0 aasm_state: type: string enum: - pending - processed - failed created_at: type: string format: date-time updated_at: type: string format: date-time examples: without includes: value: data: id: 4e342c16-8e21-444a-8101-000000000001 type: credit_account attributes: name: Teams Org slug: teams-org-3 available_balance: 100.0 purchased_credits: 100.0 total_deductions: 100.0 relationships: deductions: data: - id: '26' type: deductions - id: '27' type: deductions with included deductions: value: data: id: 4e342c16-8e21-444a-8101-000000000001 type: credit_account attributes: name: Teams Org slug: teams-org-4 available_balance: 100.0 purchased_credits: 100.0 total_deductions: 100.0 relationships: deductions: data: - id: '29' type: deductions - id: '30' type: deductions included: - id: '29' type: deductions attributes: amount: 70.0 description: Processed 5 metered request(s) for organization request_count: 5 credit_usage_by_entity: reviews: 50.0 products: 20.0 created_at: '2022-01-01T00:00:00.000-06:00' updated_at: '2022-01-01T00:00:00.000-06:00' aasm_state: processed - id: '30' type: deductions attributes: amount: 30.0 description: Processed 2 metered request(s) for organization request_count: 2 credit_usage_by_entity: products: 30.0 created_at: '2022-01-01T00:00:00.000-06:00' updated_at: '2022-01-01T00:00:00.000-06:00' aasm_state: processed example: data: id: 4e342c16-8e21-444a-8101-000000000001 type: credit_account attributes: name: Teams Org slug: teams-org-4 available_balance: 100.0 purchased_credits: 100.0 total_deductions: 100.0 relationships: deductions: data: - id: '29' type: deductions - id: '30' type: deductions included: - id: '29' type: deductions attributes: amount: 70.0 description: Processed 5 metered request(s) for organization request_count: 5 credit_usage_by_entity: reviews: 50.0 products: 20.0 created_at: '2022-01-01T00:00:00.000-06:00' updated_at: '2022-01-01T00:00:00.000-06:00' aasm_state: processed - id: '30' type: deductions attributes: amount: 30.0 description: Processed 2 metered request(s) for organization request_count: 2 credit_usage_by_entity: products: 30.0 created_at: '2022-01-01T00:00:00.000-06:00' updated_at: '2022-01-01T00:00:00.000-06:00' aasm_state: processed /api/v2/organization/{organization_id}/credit_deductions: get: summary: Retrieve aggregated credit deductions by month and year operationId: getOrganizationCreditDeductions tags: - Credit Account description: '**No scope required.** Retrieve credit account deductions aggregated by month and year. Use filter parameters to narrow results: - `filter[month]`: Filter by month (1-12) - `filter[year]`: Filter by year (e.g., 2024) ' security: - AccountAPIToken: [] parameters: - name: organization_id in: path description: Organization UUID or slug required: true schema: type: string - name: filter[month] in: query required: false description: Filter by month (1-12) schema: type: integer - name: filter[year] in: query required: false description: Filter by year schema: type: integer - name: fields[credit_deduction_aggregations] in: query explode: false description: Comma separated list of fields for credit_deduction_aggregations to include in response schema: type: array items: type: string enum: - month - year - total_amount - deduction_count responses: '401': description: Unauthenticated content: application/vnd.api+json: example: errors: - status: '401' title: Bad Credentials schema: $ref: '#/components/schemas/Errors' '404': description: Organization not found content: application/vnd.api+json: example: errors: - status: '404' title: Not Found schema: $ref: '#/components/schemas/Errors' '200': description: Aggregated credit deductions content: application/vnd.api+json: schema: type: object required: - data - links properties: data: type: array items: type: object properties: id: type: string type: type: string attributes: type: object properties: month: type: integer description: Month (1-12) example: 1 year: type: integer description: Year example: 2024 total_amount: type: number description: Total credits deducted in this month example: 75.0 deduction_count: type: integer description: Number of deductions in this month example: 2 relationships: type: object required: - id - type - attributes included: $ref: '#/components/schemas/included' links: $ref: '#/components/schemas/cursor_pagination' examples: without filters: value: data: - id: 2024-02 type: credit_deduction_aggregations attributes: month: 2 year: 2024 total_amount: 30.0 deduction_count: 1 - id: 2024-01 type: credit_deduction_aggregations attributes: month: 1 year: 2024 total_amount: 75.0 deduction_count: 2 links: {} with year filter: value: data: - id: 2024-02 type: credit_deduction_aggregations attributes: month: 2 year: 2024 total_amount: 30.0 deduction_count: 1 - id: 2024-01 type: credit_deduction_aggregations attributes: month: 1 year: 2024 total_amount: 75.0 deduction_count: 2 links: {} example: data: - id: 2024-01 type: credit_deduction_aggregations attributes: month: 1 year: 2024 total_amount: 75.0 deduction_count: 2 links: {} components: schemas: Errors: type: object properties: errors: type: array items: type: object properties: status: type: string title: type: string links: type: - object - 'null' source: type: - object - 'null' cursor_pagination: type: object properties: next: type: - string - 'null' prev: type: - string - 'null' self: type: - string - 'null' included: type: array items: type: object properties: id: type: string type: type: string attributes: type: object relationships: type: object securitySchemes: AccountAPIToken: type: http scheme: bearer G2OAuth: type: oauth2 flows: authorizationCode: tokenUrl: https://www.g2.com/oauth/token authorizationUrl: https://www.g2.com/oauth/authorize scopes: openid: OpenID Connect default scope profile: Profile information on current user data_subscriptions.read: Read Data Subscription records data_subscriptions.read_write: Modify Data Subscription records partner:partner-id.read: Access records created in Partner realm performance_analytics.read: Read Performance Analytics data