Create a repository import remote - Spacefast Docs
Create a repository import remote
Creates a signed Git remote for pushing an existing repository into the Space once, and returns a push URL that expires. The connection it creates does not queue builds on push.
POST /v1/spaces/{spaceId}/source/import-remote
Authorization
Authorization Bearer token · header required
Authorization: Bearer <token> with an API key (sfa_ prefix), an OAuth access token, a session token, or a Space machine credential (sfm_ prefix).
or
Authorization OAuth2 access token · header required
OAuth 2.0 with Spacefast scopes. People use the authorization code flow; machines use client credentials.
Scopes: spaces:read
Path parameters
spaceId string required
Request body
required application/json
ttlSeconds integer
max 86400
readOnlyRefs string[]
max items 25
Responses
200 Response for status 200
{
"$schema": "string",
"data": {
"repositoryConnection": {
"id": "string",
"spaceId": "string",
"provider": "github",
"connectionType": "connected",
"repositoryId": "string",
"installationId": null,
"cloneUrlConfigured": false,
"upstreamUrlConfigured": false,
"repositoryName": "string",
"repositoryFullName": "string",
"defaultBranch": "string",
"productionBranch": "string",
"credentialConfigured": true,
"autoDeployProduction": true,
"autoDeployPreviews": true,
"buildSettings": {
"rootDirectory": null,
"installDirectory": null,
"installCommand": null,
"buildCommand": null,
"outputDirectory": null,
"ignoredBuildCommand": null,
"frameworkPreset": null,
"platformPreset": null,
"allowUnsupportedPlatformFeatures": false,
"timeoutSeconds": 900
},
"syncStatus": "idle",
"providerAccessStatus": "active",
"providerAccessError": null,
"lastSyncedAt": "2019-08-24T14:15:22Z",
"lastSyncError": "string",
"syncRunId": "string",
"connectedUserId": "string",
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
},
"remote": {
"repositoryId": "string",
"pushUrl": "string",
"expiresInSeconds": 9007199254740991,
"readOnlyRefs": ["string"]
}
}
}
Example Request
curl -X POST "https://api.spacefast.com/v1/spaces/string/source/import-remote" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"ttlSeconds": 86400,
"readOnlyRefs": ["string"]
}'
const response = await fetch("https://api.spacefast.com/v1/spaces/string/source/import-remote", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: "{\n \"ttlSeconds\": 86400,\n \"readOnlyRefs\": [\n \"string\"\n ]\n}"
});
import requests
response = requests.post(
"https://api.spacefast.com/v1/spaces/string/source/import-remote",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
data="{\n \"ttlSeconds\": 86400,\n \"readOnlyRefs\": [\n \"string\"\n ]\n}"
)
Error Response
{
"$schema": "http://example.com",
"type": "string",
"title": "string",
"status": -9007199254740991,
"detail": "string",
"code": "string",
"pointer": "string",
"details": {
"property1": null,
"property2": null
},
"suggestions": ["string"],
"next": ["string"],
"requestId": "string"
}