Exporting a pin to an application

Is there a way for an external API to access a pin published on a private Posit Connect server?

My company has a private Posit Connect server. I have a long block of code that imports data from one of our databases, pre-processes it, runs it through a model, and then does some post-processing. I would like to do this on a schedule. I know I can pin the model and prepare an RMarkdown document that runs my code, and I can pin the output.

The issue is I need to get the post-processed data to another application (built in Appian, for what it's worth). The developers have proposed building a web API--can pins be accessed that way? I feel this may be a simple question but I can't find a direct answer.

I’m not sure about accessing Pins outside of Python/R, however it should be possible to use https://www.rplumber.io/. Maybe create an API using plumber that grabs the pinned data, and then Appian will just call the API

You can totally do that! (Wrap the pin in a plumber API). We actually have some examples that do this with a model "router" that chooses between two models at varying probabilities / weightedness (although this one doesn't use pins):

Another way to do it is definitely to interact with the pins directly via API. It is a bit tricky to do so, but you definitely can using Connect's Server API. I don't know that we have fantastic guidance on doing this, to be honest... I suspect it would be something along the lines of:

  • Use an API Key with the "Authorization" header
  • Make sure to set a "Content URL" / "Vanity URL" (this gives you a bit of protection in case you do want to change the pin at some point, replace with an API, etc.)
  • Fetch the resource directly ( to get the latest )
  • Fetching a specific version of the pin would likely require a bit more effort to figure out the particular "variant" URL :grimacing:

For example, here is a pin that is on our public demo server in .rds format:

curl -I https://colorado.posit.co/rsc/bike-predict-r-model-metrics-pin/bike-predict-model-metrics.rds
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: must-revalidate, no-cache, max-age=0
Content-Length: 6601
Content-Type: application/x-gzip
Date: Tue, 07 Feb 2023 02:52:50 GMT
Last-Modified: Mon, 06 Feb 2023 20:56:59 GMT
Server: nginx/1.23.3
Set-Cookie: colorado-rsc=11c737a0ec77aab; Path=/; HttpOnly; Secure; SameSite=None
Strict-Transport-Security: max-age=2592000
X-Content-Type-Options: nosniff
X-Correlation-Id: b8258b75-8b7a-4d7e-9332-6d8c0826f3ac

For authenticated content, you would need -H 'Authorization: Key my-api-key'

I would probably lean the API route for flexibility, and definitely recommend mapping out a diagram so people understand the flow of content!