{"openapi":"3.1.0","info":{"title":"Adifile API","version":"1.0.0","description":"Read and create your company's data from your own tools (Entreprise plan). Create a key in Settings › Integrations › API and send it as `Authorization: Bearer adf_…`. A key acts for the administrator who created it, with their spaces and levels; a read key only reads. 300 requests per minute per key. Errors: `{ \"error\": { \"code\", \"message\" } }`."},"servers":[{"url":"https://adifile.vercel.app/api/open/v1"}],"security":[{"bearer":[]}],"tags":[{"name":"Account"},{"name":"Contacts"},{"name":"Invoices"},{"name":"Documents"},{"name":"Planning"}],"paths":{"/me":{"get":{"operationId":"getMe","tags":["Account"],"summary":"The key, its company and the person it acts for","responses":{"200":{"description":"The key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/contacts":{"get":{"operationId":"listContacts","tags":["Contacts"],"summary":"The company's shared contacts, newest first","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}},{"name":"q","in":"query","description":"Search in name, organisation and email","schema":{"type":"string"}}],"responses":{"200":{"description":"Contacts","content":{"application/json":{"schema":{"type":"object","required":["data","hasMore","nextOffset"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"hasMore":{"type":"boolean"},"nextOffset":{"type":["integer","null"]}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"operationId":"createContact","tags":["Contacts"],"summary":"Add a contact shared with the whole company (write key)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/contacts/{id}":{"get":{"operationId":"getContact","tags":["Contacts"],"summary":"A contact","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/invoices":{"get":{"operationId":"listInvoices","tags":["Invoices"],"summary":"Sales and purchase invoices, the most recent first","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}},{"name":"kind","in":"query","schema":{"type":"string","enum":["sale","purchase"]}},{"name":"status","in":"query","schema":{"type":"string","enum":["draft","approved","paid","unpaid"]}},{"name":"from","in":"query","description":"Issue date from (YYYY-MM-DD)","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","description":"Issue date to (YYYY-MM-DD)","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"Invoices","content":{"application/json":{"schema":{"type":"object","required":["data","hasMore","nextOffset"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"}},"hasMore":{"type":"boolean"},"nextOffset":{"type":["integer","null"]}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"operationId":"createInvoice","tags":["Invoices"],"summary":"Create an invoice waiting for approval (write key); a sale gets the next number","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/invoices/{id}":{"get":{"operationId":"getInvoice","tags":["Invoices"],"summary":"An invoice with its lines","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The invoice","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/documents":{"get":{"operationId":"listDocuments","tags":["Documents"],"summary":"Archived documents, the most recent first","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}},{"name":"folderId","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"q","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Documents","content":{"application/json":{"schema":{"type":"object","required":["data","hasMore","nextOffset"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Document"}},"hasMore":{"type":"boolean"},"nextOffset":{"type":["integer","null"]}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/documents/{id}":{"get":{"operationId":"getDocument","tags":["Documents"],"summary":"A document","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The document","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/documents/{id}/download":{"get":{"operationId":"downloadDocument","tags":["Documents"],"summary":"Redirects to the file; recorded in the access journal","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"302":{"description":"Redirect to the file"},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/events":{"get":{"operationId":"listEvents","tags":["Planning"],"summary":"Planning events between two dates (a year at most)","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Events","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Event"}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"operationId":"createEvent","tags":["Planning"],"summary":"Add an event to the planning (write key)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"A key created in Settings › Integrations › API (adf_…)"}},"responses":{"Unauthenticated":{"description":"Missing, unknown or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"PlanRequired":{"description":"The company's plan does not include the API","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"A read key writing, or a space the key's creator cannot use","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Invalid":{"description":"Invalid data: details.issues lists the fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"More than 300 requests in a minute","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}}}}},"Me":{"type":"object","properties":{"company":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"currency":{"type":"string"}}},"key":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"scope":{"type":"string","enum":["read","write"]}}},"actingAs":{"type":"object","properties":{"id":{"type":"string"},"fullName":{"type":"string"}}}}},"Contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"fullName":{"type":"string"},"organization":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"address":{"type":["string","null"]},"vatNumber":{"type":["string","null"]},"notes":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"ContactInput":{"type":"object","required":["fullName"],"properties":{"fullName":{"type":"string","maxLength":255},"organization":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string","maxLength":60},"address":{"type":"string"},"vatNumber":{"type":"string","maxLength":40},"notes":{"type":"string","maxLength":2000}}},"InvoiceLine":{"type":"object","required":["description","quantity","unitPrice","vatRate"],"properties":{"description":{"type":"string"},"quantity":{"type":"number"},"unitPrice":{"type":"number"},"vatRate":{"type":"number","description":"Percent, e.g. 21"}}},"Invoice":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["sale","purchase"]},"number":{"type":["string","null"]},"title":{"type":"string"},"issueDate":{"type":"string","format":"date"},"dueDate":{"type":["string","null"],"format":"date"},"currency":{"type":"string"},"subtotal":{"type":"number"},"vatTotal":{"type":"number"},"total":{"type":"number"},"counterparty":{"type":"string"},"contactId":{"type":["string","null"]},"communication":{"type":["string","null"]},"isApproved":{"type":"boolean"},"isPaid":{"type":"boolean"},"paidAt":{"type":["string","null"],"format":"date-time"},"isRecorded":{"type":"boolean","description":"Recorded in the accounting software"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/InvoiceLine"},"description":"Only on a single invoice"},"url":{"type":"string","description":"The invoice in Adifile"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"InvoiceInput":{"type":"object","required":["kind","title","issueDate","currency","counterparty","lines"],"properties":{"kind":{"type":"string","enum":["sale","purchase"]},"number":{"type":"string","description":"Leave out for a sale: Adifile numbers it"},"title":{"type":"string"},"issueDate":{"type":"string","format":"date"},"dueDate":{"type":"string","format":"date"},"currency":{"type":"string","example":"EUR"},"counterparty":{"type":"string"},"contactId":{"type":"string","format":"uuid"},"communication":{"type":"string"},"observation":{"type":"string"},"lines":{"type":"array","minItems":1,"maxItems":200,"items":{"$ref":"#/components/schemas/InvoiceLine"}}}},"Document":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"folder":{"type":"object","properties":{"id":{"type":"string"},"path":{"type":"array","items":{"type":"string"},"description":"Cabinet, shelf, folder"}}},"file":{"type":"object","properties":{"name":{"type":"string"},"mimeType":{"type":"string"},"bytes":{"type":"integer"}}},"downloadUrl":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"Event":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"location":{"type":["string","null"]},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":["string","null"],"format":"date-time"},"allDay":{"type":"boolean"},"eventTypeId":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"}}},"EventInput":{"type":"object","required":["title","startsAt"],"properties":{"title":{"type":"string"},"description":{"type":"string"},"location":{"type":"string"},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"allDay":{"type":"boolean","default":false},"eventTypeId":{"type":"string","format":"uuid"}}}}}}