Skip to main content

HEADERS

Need an auth token or a specific content type? Add a HEADERS declaration for each request header:

CREATE VIRTUAL TABLE links USING vttp (
URL ('https://api.example.com/links'),
HEADERS ('Authorization', 'Bearer old-token'),
HEADERS ('Accept', 'application/json'),
headers ('authorization', 'Bearer replacement-token'),
id INTEGER,
url TEXT
);

If you repeat a header name, the last declaration wins. In this example, authorization replaces Authorization, so the request uses Bearer replacement-token. Header names aren't case-sensitive; their values keep the casing and content you gave them. Double apostrophes inside SQL strings as usual.

An empty value sends an empty header. Invalid header names and control characters in values fail when you create the table.

These headers are used for the initial inference request and every GET after that. You can't change them inside a SELECT; drop and recreate the table when you need to rotate a token. The values are saved as literal strings in the database's schema SQL, including any credentials you put there.

A payload column named headers remains an ordinary column.