Skip to the page

Links for every item

Manage with the API

Create and change resource types, templates and the metadata API in code.

Everything in the dashboard's Resources screen is also available with a secret key, so you can script the setup, keep it in version control, and repeat it for test and live. This is the same API the dashboard uses.

What you need#

  • A secret key (sk_test_… or sk_live_…) with the scope links:write (and links:read to read). The key belongs to one environment: run the setup once per environment, test first.
  • Base URL https://api.becklinks.com/v1. Errors are application/problem+json with a stable code; see the error reference.
  • POST calls accept an Idempotency-Key header (a UUID): a retry with the same key returns the first answer instead of creating a second object.

1. Create a resource type#

Bash

The answer has an id; the next calls use it. A key cannot be reused, even after the type is archived.

2. Create a URL template#

Bash

Overlapping patterns are refused with 409; invalid ids, destinations and placeholders with 422 validation_failed and a JSON Pointer per field. Change a template with PATCH /v1/url-templates/{template} (destinations, pass-through, status active, disabled or archived); the pattern itself is fixed. See URL templates.

3. Configure the metadata API#

Bash

The credential is write-only: the answer shows only whether a secret is set and a short hint. Leave auth out of a later update to keep the stored secret. The auth object is {"type":"none"}, {"type":"bearer","secret":"…"} or {"type":"api_key_header","header_name":"X-Api-Key","secret":"…"}. The URL must be https, on a public host, with {id} only in the path or query. See Metadata API.

4. Test it before any phone is involved#

Bash

Everything the API offers here#

ActionCall
List, create resource typesGET, POST /v1/resource-types
Read, rename, archive a typeGET, PATCH /v1/resource-types/{type}
List, create templatesGET, POST /v1/url-templates
Read, change, disable, archive a templateGET, PATCH /v1/url-templates/{template}
Read, set, disable the metadata APIGET, PUT /v1/resource-types/{type}/metadata-api
Test the metadata API, a URL, a previewPOST …/metadata-api/test, POST /v1/url-templates/test, POST /v1/resources/preview
Refresh remembered itemsPOST /v1/resources/invalidate
Clicks and API health per typeGET /v1/resources/stats?range=7d

The full request and response fields are in the Resources reference.

Verify it works#

Run the setup against sk_test_…, then curl -A 'facebookexternalhit/1.1' https://acme-test.becklinks.com/c/4521: the card shows your item. Repeat with sk_live_… when the test environment is accepted.