openapi: 3.2.0
info:
title: FirstPromoter Invoices API
version: 1.0.0
description: API for managing invoices in FirstPromoter
servers:
- url: https://api.firstpromoter.com/api/v2/company
security:
- BearerAuth: []
tags:
- name: Invoices
paths:
/invoices:
get:
summary: Get invoices
description: "Returns all invoices. \n **HTTP Request**
`GET https://api.firstpromoter.com/api/v2/company/invoices`"
tags:
- Invoices
parameters:
- $ref: '#/components/parameters/AccountId'
- in: query
name: filters[promoter_id]
schema:
type: integer
description: Filter by promoter ID
- in: query
name: filters[status]
schema:
type: string
enum:
- draft
- open
- paid
- voided
description: Filter by status
responses:
'200':
description: Invoice preview
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
html:
type: string
'401':
description: Unauthorized
'403':
description: Forbidden
/invoices/{id}:
get:
summary: Get invoice by id
description: "Returns single invoice \n **HTTP Request**
`GET https://api.firstpromoter.com/api/v2/company/invoices/{id}`"
tags:
- Invoices
parameters:
- $ref: '#/components/parameters/AccountId'
- in: path
name: id
required: true
schema:
type: integer
description: Invoice ID
responses:
'200':
description: Invoice details with HTML content
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/Invoice'
- type: object
properties:
html:
type: string
'401':
description: Unauthorized
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/invoices/void:
post:
summary: Void invoices
description: "Marks invoices as void \n **HTTP Request**
`POST https://api.firstpromoter.com/api/v2/company/invoices/void`"
tags:
- Invoices
parameters:
- $ref: '#/components/parameters/AccountId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BatchRequest'
responses:
'200':
description: Void operation completed
content:
application/json:
schema:
$ref: '#/components/schemas/BatchResponse'
'202':
description: Void operation accepted
content:
application/json:
schema:
$ref: '#/components/schemas/BatchResponse'
'401':
description: Unauthorized
'403':
description: Forbidden
'422':
description: Invalid parameters
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/invoices/finalize:
post:
summary: Finalize invoices
description: "Marks invoices as finalized \n **HTTP Request**
`POST https://api.firstpromoter.com/api/v2/company/invoices/finalize`"
tags:
- Invoices
parameters:
- $ref: '#/components/parameters/AccountId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BatchRequest'
responses:
'200':
description: Finalize operation completed
content:
application/json:
schema:
$ref: '#/components/schemas/BatchResponse'
'202':
description: Finalize operation accepted
content:
application/json:
schema:
$ref: '#/components/schemas/BatchResponse'
'401':
description: Unauthorized
'403':
description: Forbidden
'422':
description: Invalid parameters
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/invoices/destroy:
delete:
summary: Destroy invoices
description: "Deletes invoices \n **HTTP Request**
`DELETE https://api.firstpromoter.com/api/v2/company/invoices/destroy`"
tags:
- Invoices
parameters:
- $ref: '#/components/parameters/AccountId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BatchRequest'
responses:
'200':
description: Delete operation completed
content:
application/json:
schema:
$ref: '#/components/schemas/BatchResponse'
'202':
description: Delete operation accepted
content:
application/json:
schema:
$ref: '#/components/schemas/BatchResponse'
'401':
description: Unauthorized
'403':
description: Forbidden
'422':
description: Invalid parameters
/invoices/export:
get:
summary: Export invoices as csv
description: "Exports invoices as csv \n **HTTP Request**
`GET https://api.firstpromoter.com/api/v2/company/invoices/export`"
tags:
- Invoices
parameters:
- $ref: '#/components/parameters/AccountId'
- in: query
name: filters[promoter_id]
schema:
type: integer
description: Filter by promoter ID
responses:
'200':
description: CSV file containing invoice data
content:
text/csv:
schema:
type: string
'401':
description: Unauthorized
'403':
description: Forbidden
/invoices/export_zip:
get:
summary: Export all invoices PDF in a single zip
description: "Exports invoices PDF in a single zip \n **HTTP Request**
`GET https://api.firstpromoter.com/api/v2/company/invoices/export_zip`"
tags:
- Invoices
parameters:
- $ref: '#/components/parameters/AccountId'
responses:
'202':
description: Export request accepted
content:
application/json:
schema:
type: object
properties:
message:
type: string
'401':
description: Unauthorized
'403':
description: Forbidden
/invoices/preview:
get:
summary: Show invoice preview
description: **HTTP Request**
`GET https://api.firstpromoter.com/api/v2/company/invoices/preview`
tags:
- Invoices
parameters:
- $ref: '#/components/parameters/AccountId'
- in: query
name: promoter_id
required: true
schema:
type: integer
description: The promoter id
- in: query
name: payout_ids
schema:
type: array
items:
type: integer
description: Payout ids
responses:
'200':
description: Invoice preview
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
html:
type: string
'401':
description: Unauthorized
'403':
description: Forbidden
components:
schemas:
Error:
type: object
properties:
message:
type: string
code:
type: string
Invoice:
type: object
properties:
id:
type: integer
number:
type: string
date:
type: string
format: date
total:
type: number
total_incl_tax:
type: number
tax_rate:
type: number
pdf_url:
type: string
status:
type: string
enum:
- draft
- open
- paid
- voided
promoter:
type: object
properties:
id:
type: integer
email:
type: string
name:
type: string
payouts:
type: array
items:
type: object
BatchRequest:
type: object
properties:
ids:
type: array
items:
type: integer
description: Array of invoice ids.
BatchResponse:
type: object
properties:
id:
type: integer
status:
type: string
enum:
- pending
- completed
- failed
total:
type: integer
selected_total:
type: integer
processed_count:
type: integer
failed_count:
type: integer
action_label:
type: string
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
meta:
type: object
progress:
type: integer
processing_errors:
type: array
items:
type: object
parameters:
AccountId:
name: Account-ID
in: header
required: true
description: Account identifier that specifies which account is making the request
schema:
type: string
example: acc_123456
securitySchemes:
BearerAuth:
type: http
scheme: bearer
description: Access token passed as a Bearer token in the Authorization header
accountId:
type: apiKey
in: header
name: ACCOUNT-ID
description: Account ID required with bearer token