// First, create an API key const response = await fetch('https://api.well.com/v1/api-key', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_AUTH_TOKEN' }, body: JSON.stringify({ data: { type: 'api-key', attributes: { name: 'Production API Key', organisation: { id: 'your-org-uuid' } } } }) }); const { data } = await response.json(); const apiKey = data.attributes.value; // Then use it for API calls const companyResponse = await fetch('https://api.well.com/v1/companies', { headers: { 'Authorization': `Bearer ${apiKey}` } });
{ "data": { "type": "api_key", "attributes": { "id": "api-key-uuid", "value": "well_key_xxxxxxxxxxxx", "name": "Production API Key", "expiration_at": "2024-02-15T10:30:00Z" } } }
Was this page helpful?