{"openapi":"3.0.3","info":{"description":"API for Fetchify partner client account creation","version":"1.13.0","title":"Account Automation API","contact":{"email":"support@fetchify.com"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"servers":[{"url":"https://api.admin.fetchify.com"}],"paths":{"/client":{"get":{"security":[{"bearerAuth":[]}],"summary":"list Fetchify client accounts","operationId":"clientGet","description":"passing in a valid token will list all client accounts\n","parameters":[{"in":"query","name":"min_id","description":"The minimum id to return (inclusive)","required":false,"schema":{"type":"integer"}},{"in":"query","name":"max_id","description":"The maximum id to return (inclusive)","required":false,"schema":{"type":"integer"}},{"in":"query","name":"filters","description":"One or more filters to be applied","required":false,"content":{"application/json":{"schema":{"type":"array"}}}},{"in":"query","name":"columns","description":"The desired columns of results to return","required":false,"content":{"application/json":{"schema":{"type":"array"}}}},{"in":"query","name":"tags","description":"The desired tags of results to return","required":false,"content":{"application/json":{"schema":{"type":"array"}}}},{"in":"query","name":"limit","description":"The maximum number of results to return","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/ClientGetResult"}},"paging":{"type":"object","properties":{"previous":{"type":"string","example":"https://api.admin.fetchify.com/client?max_id=1099"},"next":{"type":"string","example":"https://api.admin.fetchify.com/client?min_id=2214"}}}}}}},"headers":{"X-API-Version":{"description":"Current version of the API","schema":{"type":"string","example":"1.0.0"}}}},"401":{"description":"invalid or missing access token"}}},"post":{"security":[{"bearerAuth":[]}],"summary":"create a new Fetchify client account","operationId":"clientPost","description":"passing in a valid token and a company name will create a new\nclient account\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"client_name":{"type":"string","example":"XYZ Inc."},"trial_enabled":{"type":"boolean","description":"Whether to create the client as a trial account instead of active. Trial accounts do not get a credit pack created for them, so initial_pack_size must not be provided if this is true. Defaults to false","example":false},"initial_pack_size":{"type":"integer","description":"The size of the credit pack to create for the new client account. Must be at least 100 and a multiple of 100. Defaults to the requesting partner's \"Auto-Renew Size\" setting if configured, otherwise 100","example":200},"auto_renew_enabled":{"type":"boolean","description":"Whether the client's credit pack should automatically renew. Defaults to the requesting partner's \"Auto-Renew\" setting if configured, otherwise false","example":true},"auto_renew_size":{"type":"integer","description":"The size of the credit pack to renew with, if auto_renew_enabled is true. Must be at least 100 and a multiple of 100. Defaults to the requesting partner's \"Auto-Renew Size\" setting if configured, otherwise 100","example":200}}}}}},"responses":{"201":{"description":"successful operation","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/ClientPostResult"}}}}}},"headers":{"X-API-Version":{"description":"Current version of the API","schema":{"type":"string","example":"1.0.0"}}}},"400":{"description":"invalid or missing input data"},"401":{"description":"invalid or missing access token"}}}},"/client_list":{"get":{"security":[{"bearerAuth":[]}],"summary":"list Fetchify client account IDs","operationId":"clientListGet","description":"passing in a valid token will list the IDs of all client accounts accessible to the partner\n","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"type":"object","properties":{"client_ids":{"type":"array","items":{"type":"integer"},"example":[12345,12346,12347]}}}}}},"401":{"description":"invalid or missing access token"}}}},"/client_usage":{"get":{"security":[{"bearerAuth":[]}],"summary":"get client credit pack usage statistics","operationId":"clientUsageGet","description":"Returns aggregated credit usage statistics for a single client account, optionally\nfiltered to credit packs created within a given date range\n","parameters":[{"in":"query","name":"client_id","description":"The ID of the client account to return usage statistics for","required":true,"schema":{"type":"integer","example":12345}},{"in":"query","name":"start_date","description":"Only include credit packs created on or after this date (YYYY-MM-DD)","required":false,"schema":{"type":"string","format":"date","example":"2026-01-01"}},{"in":"query","name":"end_date","description":"Only include credit packs created on or before this date (YYYY-MM-DD)","required":false,"schema":{"type":"string","format":"date","example":"2026-12-31"}}],"responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientUsageResult"}}}},"400":{"description":"invalid or missing input data"},"401":{"description":"invalid or missing access token"},"404":{"description":"client not found"}}}},"/credit_allocation":{"post":{"security":[{"bearerAuth":[]}],"summary":"allocate a credit pack to a client from a partner's credit pool","operationId":"creditAllocationPost","description":"Allocates a new credit pack to a client account, deducting the size from the\ncalling partner's credit pool. If the target client account is currently\n'pending' or 'trial', it is activated as part of this operation.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["client_id","size"],"properties":{"client_id":{"type":"integer","description":"The ID of the client account to allocate the credit pack to","example":12345},"size":{"type":"integer","description":"The size of the credit pack. Must be at least 100 and a multiple of 100","example":100}}}}}},"responses":{"201":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditAllocationResult"}}},"headers":{"X-API-Version":{"description":"Current version of the API","schema":{"type":"string","example":"1.0.0"}}}},"400":{"description":"invalid or missing input data, or insufficient credit in the partner pool"},"401":{"description":"invalid or missing access token"},"404":{"description":"client not found, or not controlled by the calling partner"}}}},"/contact":{"get":{"security":[{"bearerAuth":[]}],"summary":"list client contact persons","operationId":"contactGet","description":"Returns contact persons for client accounts with optional filtering and column selection\n","parameters":[{"in":"query","name":"min_id","description":"The minimum contact id to return (inclusive)","required":false,"schema":{"type":"integer"}},{"in":"query","name":"max_id","description":"The maximum contact id to return (inclusive)","required":false,"schema":{"type":"integer"}},{"in":"query","name":"filters","description":"One or more filters to be applied","required":false,"content":{"application/json":{"schema":{"type":"array"}}}},{"in":"query","name":"columns","description":"The desired columns of results to return","required":false,"content":{"application/json":{"schema":{"type":"array"}}}},{"in":"query","name":"tags","description":"The desired tags of results to return","required":false,"content":{"application/json":{"schema":{"type":"array"}}}},{"in":"query","name":"limit","description":"The maximum number of results to return","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/ContactGetResult"}},"total":{"type":"integer","description":"Total count of all contacts","example":5432},"paging":{"type":"object","properties":{"previous":{"type":"string","example":"https://api.admin.fetchify.com/contact?max_id=999"},"next":{"type":"string","example":"https://api.admin.fetchify.com/contact?min_id=1101"}}}}}}}},"401":{"description":"invalid or missing access token"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","description":"API Key"}},"schemas":{"ClientGetResult":{"type":"object","properties":{"client_id":{"type":"number","description":"The ID of the client account","example":12345},"client_name":{"type":"string","description":"The company name of the client account","example":"Fetchify"},"account_status":{"type":"string","description":"The status of the client account","example":"Active"},"partner_id":{"type":"number","description":"The ID of the parner account for the client","example":12345},"expected_expiry":{"type":"string","description":"The timestamp that current pack will run out of credits based on usage","example":"2022-12-18T03:37:01.000Z"},"expires":{"type":"string","description":"The timestamp that the current pack expires","example":"2022-12-18T03:37:01.000Z"},"credits_used":{"type":"number","description":"The number of credits used from the current pack","example":123},"trial_clicks_used":{"type":"number","description":"The number of trial clicks used","example":123},"pack_id":{"type":"number","description":"The ID for the currently applied pack","example":123},"pack_size":{"type":"number","description":"The total number of credits for the currently applied pack","example":1234},"available_credits":{"type":"number","description":"The number of credits remaining for the currently applied pack","example":123},"percentage_used":{"type":"number","description":"The percentage of credits used out of the currently applied pack","example":12},"spend":{"type":"number","description":"Total value (ex. VAT) of all invoices in the last 12 months","example":12},"product_description":{"type":"string","description":"The description of the last invoice item on the last invoice issued","example":"Monthly Subscription (1,000 lookups included)"},"payment_method":{"type":"string","description":"Type of payment method used for most recent payment","example":"direct_debit"},"last_click_used":{"type":"string","description":"The timestamp of the last time the client used a click/lookup/credit","example":"2022-08-18T02:53:43.000Z"},"days_since_last_usage":{"type":"number","description":"Number of days since the last time the client used a click/lookup/credit","example":30},"industry_name":{"type":"string","description":"The industry in which the client operates","example":"Charity"},"tags":{"type":"object","description":"Tags key/value pairs","example":{"dog":"Jock"}}}},"ClientPostResult":{"type":"object","properties":{"client_id":{"type":"number","description":"The ID of the created client account","example":12345},"client_name":{"type":"string","description":"The company name of the created client account","example":"Fetchify"},"client_code":{"type":"string","description":"The generated code for the created client account","example":"XYZ12345"},"token":{"type":"string","description":"Fetchify access token for created client account","example":"63a07-714ed-9a4d4-687b3"},"credit_pack_id":{"type":"integer","nullable":true,"description":"The ID of the credit pack created for the new client account, or null if trial_enabled was true and no credit pack was created","example":98765}}},"ClientUsageResult":{"type":"object","properties":{"client_id":{"type":"integer","description":"The ID of the client account","example":12345},"credit_pack_ids":{"type":"array","items":{"type":"integer"},"description":"List of credit pack IDs created within the date range","example":[1,2,5]},"total_credits_assigned":{"type":"number","description":"Sum of all credit pack sizes assigned in the date range","example":1500},"total_credits_used":{"type":"number","description":"Sum of used credits from all packs assigned in the date range","example":800.25},"total_credits_expired":{"type":"number","description":"Sum of unused credits from expired packs","example":50},"total_credits_remaining":{"type":"number","description":"Sum of unused credits from active/unstarted packs","example":649.75}}},"CreditAllocationResult":{"type":"object","properties":{"credit_pack_id":{"type":"integer","description":"The ID of the newly created credit pack","example":98765}}},"ContactGetResult":{"type":"object","properties":{"contact_id":{"type":"integer","description":"The ID of the contact","example":456},"contact_type":{"type":"string","description":"Type of contact (main, billing, technical, other)","example":"main"},"contact_first_name":{"type":"string","description":"Contact's first name","example":"John"},"contact_last_name":{"type":"string","description":"Contact's last name","example":"Smith"},"contact_email":{"type":"string","description":"Contact's email address","example":"john.smith@example.com"},"contact_phone_number":{"type":"string","description":"Primary phone number","example":"+44 20 1234 5678"},"contact_address1":{"type":"string","description":"First line of address","example":"123 Main Street"},"contact_town":{"type":"string","description":"Town/city","example":"London"},"contact_postcode":{"type":"string","description":"Postal code","example":"SW1A 1AA"},"client_id":{"type":"integer","description":"Associated client account ID","example":12345},"client_name":{"type":"string","description":"Associated client company name","example":"Acme Corp"}}},"ErrorResponse":{"type":"object","properties":{"type":{"type":"string","description":"error identifier","example":"token_missing"},"message":{"type":"string","description":"error message","example":"An access token is required"}}}}}}